main
 1#!/usr/bin/env bash
 2
 3SCREENSHOT_BIN="main -d"
 4if command -v grim &> /dev/null; then
 5    case $1 in
 6	    %c) to='clipboard'; grim - | wl-copy ;;
 7	    %d) to=~/desktop/pictures/screenshots/$(hostname)/$(date +'%Y-%m-%d-%H%M%S').png; grim "$to" ;;
 8	    *)  to=$1; grim "$to" ;;
 9    esac
10else
11maim -d | {
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"