swaydots

my dotfiles
git clone https://git.awy.one/swaydots.git
Log | Files | Refs | README | LICENSE

commit 7eb284746a8ee189a76dc5c2292504bd0a9027b5
parent 7a402b487b59fef41001254708cb2b43dd5612b6
Author: awy <awy@awy.one>
Date:   Fri, 25 Jul 2025 23:18:59 +0300

maimpick update

now features swappy to make quick annotations to screenshots

Diffstat:
M.local/bin/maimpick | 25++++++++++++++++---------
Mdependencies.txt | 1+
2 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/.local/bin/maimpick b/.local/bin/maimpick @@ -1,6 +1,6 @@ #!/bin/sh -# This is bound to Shift+PrintScreen by default, requires grim. It lets you +# This is bound to Shift+PrintScreen by default, requires grim (also optionally tesseract and swappy). It lets you # choose the kind of screenshot to take, including copying the image or even # highlighting an area to copy. @@ -9,18 +9,25 @@ output="$(date '+%y%m%d-%H%M-%S').png" wclip_cmd="wl-copy -t image/png" ocr_cmd="wl-copy" -case "$(printf "a selected area\\ncurrent window\\nfull screen\\na selected area (copy)\\ncurrent window (copy)\\nfull screen (copy)\\ncopy selected image to text" | bemenu -l 7 -i -p "Screenshot which area?")" in - "a selected area") geometry=$(slurp) && sleep 0.2 && grim -g "$geometry" pic-selected-"${output}" ;; +case "$(printf "a selected area\\ncurrent window\\nfull screen\\na selected area (copy)\\ncurrent window (copy)\\nfull screen (copy)\\na selected area (swappy)\\ncurrent window (swappy)\\nfull screen (swappy)\\ncopy selected image to text" | mew -l 10 -i -p "Screenshot which area?")" in + "a selected area") geometry=$(slurp) && sleep 0.2 && grim -g "$geometry" pic-selected-"${output}" && notify-send "📸 maimpick" "Screenshot saved as pic-selected-$output." ;; "current window") geometry=$(swaymsg --raw -t get_tree | jq -r '.. | select(type == "object" and .focused == true) | .rect | "\(.x),\(.y) \(.width)x\(.height)"') sleep 0.2 - grim -g "$geometry" pic-window-"${output}" ;; - "full screen") geometry=$(slurp -o) && sleep 0.2 && grim -g "$geometry" pic-full-"${output}" ;; - "a selected area (copy)") geometry=$(slurp) && sleep 0.2 && grim -g "$geometry" - | ${wclip_cmd} ;; + grim -g "$geometry" pic-window-"${output}" && notify-send "📸 maimpick" "Screenshot saved as pic-window-$output." ;; + "full screen") geometry=$(slurp -o) && sleep 0.2 && grim -g "$geometry" pic-full-"${output}" && notify-send "📸 maimpick" "Screenshot saved as pic-full-$output." ;; + "a selected area (copy)") geometry=$(slurp) && sleep 0.2 && grim -g "$geometry" - | ${wclip_cmd} && notify-send "📸 maimpick" "Selected area screenshot copied to clipboard." ;; "current window (copy)") geometry=$(swaymsg --raw -t get_tree | jq -r '.. | select(type == "object" and .focused == true) | .rect | "\(.x),\(.y) \(.width)x\(.height)"') sleep 0.2 - grim -g "$geometry" - | ${wclip_cmd} ;; - "full screen (copy)") geometry=$(slurp -o) && sleep 0.2 && grim -g "$geometry" - | ${wclip_cmd} ;; - "copy selected image to text") tmpfile=$(mktemp /tmp/ocr-XXXXXX.png) && slurp | grim -g - - > "$tmpfile" && tesseract "$tmpfile" - -l eng | ${ocr_cmd} && rm "$tmpfile" ;; + grim -g "$geometry" - | ${wclip_cmd} && notify-send "📸 maimpick" "Window screenshot copied to clipboard." ;; + "full screen (copy)") geometry=$(slurp -o) && sleep 0.2 && grim -g "$geometry" - | ${wclip_cmd} && notify-send "📸 maimpick" "Full screen screenshot copied to clipboard.";; + "a selected area (swappy)") geometry=$(slurp) && sleep 0.2 && grim -g "$geometry" - | swappy -f - ;; + "current window (swappy)") + geometry=$(swaymsg --raw -t get_tree | jq -r '.. | select(type == "object" and .focused == true) | .rect | "\(.x),\(.y) \(.width)x\(.height)"') + sleep 0.2 + grim -g "$geometry" - | swappy -f - ;; + "full screen (swappy)") geometry=$(slurp -o) && sleep 0.2 && grim -g "$geometry" - | swappy -f - ;; + "copy selected image to text") tmpfile=$(mktemp /tmp/ocr-XXXXXX.png) && slurp | grim -g - - > "$tmpfile" && tesseract "$tmpfile" - -l eng | ${ocr_cmd} && rm "$tmpfile" && notify-send "📸 maimpick" "Detected text copied to clipboard.\n$(wl-paste)" ;; + *) notify-send "📸 maimpick" "Wrong option." esac diff --git a/dependencies.txt b/dependencies.txt @@ -66,6 +66,7 @@ mpc mpd rmpc grim +swappy slurp swaybg