Files
hyprdots/hypr/screenshot
2024-10-04 13:19:52 +05:30

30 lines
720 B
Bash
Executable File

#!/bin/sh
tmp_file="/tmp/screenshot.png"
[ -f "$tmp_file" ] && rm -f "$tmp_file"
killall grim slurp
message="Screenshot copied to clipboard."
urgency="normal"
case "$1" in
fullclip)
grim - | tee "$tmp_file" | wl-copy -t image/png
;;
fullsave)
tmp_file="$HOME/Pictures/$(date -u "+%Y-%m-%d_%H-%M-%S").png"
message="Screenshot saved."
[ -d "$HOME/Pictures" ] || mkdir -p "$HOME/Pictures"
grim "$tmp_file"
;;
selclip)
grim -g "$(slurp)" - | tee "$tmp_file" | wl-copy -t image/png
;;
*)
message="Please select one from these -- fullclip,fullsave,selclip"
urgency="critical"
;;
esac
notify-send -e -h "string:x-canonical-private-synchronous:${0##*/}" -u "$urgency" -i "$tmp_file" "$message"