#!/bin/sh # This is bound to Shift+PrintScreen by default, requires maim. It lets you # choose the kind of screenshot to take, including copying the image or even # highlighting an area to copy. scrotcucks on suicidewatch right now. case "$(printf "a selected area\\ncurrent window\\nfull screen\\na selected area (copy)\\ncurrent window (copy)\\nfull screen (copy)" | bemenu -p "Screenshot which area?")" in "a selected area") sleep 0.4 && grim -g "$(slurp)" pic-selected-"$(date '+%y%m%d-%H%M-%S').png" ;; # "current window") sleep 0.4 && grim -g "$(swaymsg -t get_tree | jq -r '.. | select(.focused?) | .rect | "\(.x),\(.y) \(.width)x\(.height)"')" pic-window-"$(date '+%y%m%d-%H%M-%S').png" ;; "current window") sleep 0.4 && grim -g "$(hyprctl activewindow | grep 'at:' | cut -d':' -f2 | tr -d ' ' | tail -n1) $(hyprctl activewindow | grep 'size:' | cut -d':' -f2 | tr -d ' ' | tail -n1 | sed s/,/x/g)" pic-window-"$(date '+%y%m%d-%H%M-%S').png" ;; "full screen") sleep 0.4 && grim pic-full-"$(date '+%y%m%d-%H%M-%S').png" ;; "a selected area (copy)") sleep 0.4 && grim -g "$(slurp)" - | wl-copy ;; # "current window (copy)") sleep 0.4 && grim -g "$(swaymsg -t get_tree | jq -r '.. | select(.focused?) | .rect | "\(.x),\(.y) \(.width)x\(.height)"')" - | wl-copy ;; "current window (copy)") sleep 0.4 && grim -g "$(hyprctl activewindow | grep 'at:' | cut -d':' -f2 | tr -d ' ' | tail -n1) $(hyprctl activewindow | grep 'size:' | cut -d':' -f2 | tr -d ' ' | tail -n1 | sed s/,/x/g)" - | wl-copy ;; "full screen (copy)") sleep 0.4 && grim - | wl-copy ;; esac