From 8a3965e608589bde998d75642106a16357222ab3 Mon Sep 17 00:00:00 2001 From: tiyn Date: Tue, 24 Oct 2023 06:36:43 +0200 Subject: [PATCH] tools: improved screenshotmenu with colorpicker --- .config/sxhkd/sxhkdrc | 2 +- .local/bin/tools/maimpick | 16 ---------------- .local/bin/tools/screenshotmenu | 18 ++++++++++++++++++ 3 files changed, 19 insertions(+), 17 deletions(-) delete mode 100755 .local/bin/tools/maimpick create mode 100755 .local/bin/tools/screenshotmenu diff --git a/.config/sxhkd/sxhkdrc b/.config/sxhkd/sxhkdrc index 4abda15..239cfa8 100644 --- a/.config/sxhkd/sxhkdrc +++ b/.config/sxhkd/sxhkdrc @@ -39,7 +39,7 @@ super + Return $TERMINAL Print - maimpick + screenshotmenu super + shift + space dunstctl close-all diff --git a/.local/bin/tools/maimpick b/.local/bin/tools/maimpick deleted file mode 100755 index a1428f8..0000000 --- a/.local/bin/tools/maimpick +++ /dev/null @@ -1,16 +0,0 @@ -#!/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} ;; -esac diff --git a/.local/bin/tools/screenshotmenu b/.local/bin/tools/screenshotmenu new file mode 100755 index 0000000..4c01b4d --- /dev/null +++ b/.local/bin/tools/screenshotmenu @@ -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_img="xclip -sel clip -t image/png" +xclip_txt="xclip -sel clip -t text/plain" + +case "$(printf "a selected area\\ncurrent window\\nfull screen\\na selected area (copy)\\ncurrent window (copy)\\nfull screen (copy)\\ncolor picker (copy)" | 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 (copy)") maim -s | ${xclip_img} ;; + "current window (copy)") maim -i "$(xdotool getactivewindow)" | ${xclip_img} ;; + "full screen (copy)") maim | ${xclip_img} ;; + "color picker (copy)") xcolor |tr -d '\n' | ${xclip_txt} ;; +esac