From 76aaa776d50e21ff5b137e4bc9cb34d8b07e0a98 Mon Sep 17 00:00:00 2001 From: tiyn Date: Tue, 10 Jan 2023 01:14:44 +0100 Subject: [PATCH] maimpick: adapted from lukesmithxyz --- .local/bin/tools/maimpick | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 .local/bin/tools/maimpick diff --git a/.local/bin/tools/maimpick b/.local/bin/tools/maimpick new file mode 100755 index 0000000..033b7d6 --- /dev/null +++ b/.local/bin/tools/maimpick @@ -0,0 +1,18 @@ +#!/bin/sh + +# Requires maim. It lets you choose the kind of screenshot to take, +# including copying the image or even highlighting an area to copy. + +output="$HOME/downloads/screenshot-$(date '+%y%m%d-%H%M-%S').png" +xclip_cmd="xclip -sel clip -t image/png" + +case "$(printf "a selected area\\ncurrent window\\nfull screen\\na selected area (clipboard)\\ncurrent window (clipboard)\\nfull screen (clipboard)\\ncolor picker (clipboard)" | dmenu -l 6 -i -p "Screenshot which area?")" in + "a selected area") maim -s $output ;; + "current window") maim -i "$(xdotool getactivewindow)" $output ;; + "full screen") maim $output ;; + "a selected area (clipboard)") maim -s | ${xclip_cmd} ;; + "current window (clipboard)") maim -i "$(xdotool getactivewindow)" | ${xclip_cmd} ;; + "full screen (clipboard)") maim | ${xclip_cmd} ;; + "color picker (clipboard)") maim -st 0 | convert - -resize 1x1\! -format '%[pixel:p{0,0}]' info:- | ${xclip_cmd} ;; +esac +