home

My NixOS systems configurations.
Log | Files | Refs | LICENSE

shotf (611B)


      1 #!/usr/bin/env bash
      2 
      3 SCREENSHOT_BIN="main -d"
      4 if 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
     10 else
     11 maim -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 }
     18 fi
     19 notify-send --category=recording \
     20 	    --icon=$to \
     21 	    'Screenshot Taken' "Saved to $to"