index — dots-the-third @ d4c614ffeddcdcc507b240580e05b03b4ee71c99

I don't need nix, I have a way worse solution!

scripts/.config/scripts/screenshot.sh (view raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
#!/bin/bash

OPTIONS=a,s,e,m,f,c
LONGOPTS=area,screen,edit,monitor,freeze,freezeedit,active

PARSED=$(getopt --options="$OPTIONS" --longoptions="$LONGOPTS" -- "$@")
eval set -- "$PARSED"

while true; do
    case "$1" in
        -a|--area) grim -g "$(slurp)" - | wl-copy
            shift;;
        -s|--screen) grim - | wl-copy
            shift;;
        -c|--active) grim -g "$(hyprctl activewindow -j | jq -r '"\(.at[0]),\(.at[1]) \(.size[0])x\(.size[1])"')" - | wl-copy
            shift;;
        -e|--edit) exec 3< <(grim -g "$(slurp)" -)
            swappy -f - <&3
            shift;;
        -m|--monitor) grim -o "$(hyprctl monitors -j | jq -r '.[] | select(.focused) | .name')" - | wl-copy
            shift;;
        -f|--freeze) wayfreeze --hide-cursor --after-freeze-cmd 'grim -g "$(slurp)" - | wl-copy; killall wayfreeze'
            shift;;
        --freezeedit) wayfreeze & PID=$!; sleep .1; kill $PID && exec 3< <(grim -g "$(slurp)" -) && swappy -f - <&3;
            shift;;
        --) shift; break;;
    esac
done