Files
nix-thinkcentre/home/desktop/grim.sh

45 lines
915 B
Bash
Raw Normal View History

2025-10-11 19:10:48 +05:00
#!/usr/bin/env bash
screen_name="$(date +%F--%H-%M-%S).png"
screen_path="/home/fox/Pictures"
screen_full="$screen_path$screen_name"
notify_name="Grim"
notify_title="Скриншот сохранён:"
notify_msg="[$screen_full]"
notify_btn="Открыть скриншот"
screen_notify() {
notify_action="$(notify-send -a "$notify_name" "$notify_title" "$notify_msg" -i "$screen_full" --action="open=$notify_btn")"
if [[ "$notify_action" == "open" ]]; then
imv "$screen_full"
fi
}
screen_full() {
grim $screen_full
screen_copy
screen_notify &
}
screen_active() {
grim -g "$(slurp)" $screen_full
screen_copy
screen_notify &
}
screen_area() {
grim -g "$(slurp)" $screen_full
screen_copy
screen_notify &
}
screen_copy() {
wl-copy "$screen_full"
}
case "$1" in
"-f") screen_full; exit ;;
"-a") screen_active; exit ;;
"-s") screen_area; exit ;;
esac