#!/bin/bash # adapted from ~/.local/share/omarchy/bin/omarchy-cmd-screenshot [[ -f ~/.config/user-dirs.dirs ]] && source ~/.config/user-dirs.dirs OUTPUT_DIR="${OMARCHY_SCREENSHOT_DIR:-${XDG_PICTURES_DIR:-$HOME/Pictures}}" if [[ ! -d "$OUTPUT_DIR" ]]; then notify-send "Screenshot directory does not exist: $OUTPUT_DIR" -u critical -t 3000 exit 1 fi # if we are in the process of screenshotting, cancel that and exit pkill slurp && exit 0 # freeze display(s) wayfreeze & sleep 0.1 # use process substitution to send to satty rather than piping so that we can kill wayfreeze as soon as hyprshot finishes hyprshot -m ${1:-region} --raw > >( satty --filename - \ --output-filename "$output_dir/screenshot-$(date +'%y-%m-%d_%h-%m-%s').png" \ --early-exit \ --actions-on-enter save-to-clipboard \ --save-after-copy \ --copy-command 'wl-copy' ) & wait $(jobs -p %hyprshot) kill $(jobs -p %wayfreeze) # satty is still running at this point, but we don't particularly care