auto-update-daily-20260202
1#!/usr/bin/env bash
2
3to=""
4if command -v grim &> /dev/null; then
5 case $1 in
6 %c) to='clipboard'; grim -g "$(slurp)" - | wl-copy ;;
7 %d) to=~/desktop/pictures/screenshots/$(hostname)/$(date +'%Y-%m-%d-%H%M%S').png; grim -g "$(slurp)" "$to" ;;
8 *) to=$1; grim -g "$(slurp)" "$to" ;;
9 esac
10else
11 maim -g $(slop; sleep ${2:-0}) | {
12 case $1 in
13 %c) to='clipboard'; xclip -selection clipboard -t image/png ;;
14 %d) to=~/desktop/pictures/screenshots/$(hostname)/$(date +'%Y-%m-%d-%H%M%S').png; cat > "$to" ;;
15 *) to=$1; cat > "$to" ;;
16 esac
17 }
18fi
19notify-send --category=recording \
20 --icon=$to \
21 'Screenshot Taken' "Saved to $to"