aboutsummaryrefslogtreecommitdiff
path: root/local/bin/screenshot-prompt
blob: b449f60f122aedacef95d21e4073aa696586039d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/sh

set -e

command -v scrot > /dev/null ||
	{ echo "scrot not installed" ; exit 1 ; }
command -v rofi > /dev/null &&
    menu_exec='rofi -dmenu' ||
    menu_exec='dmenu'

choice="$(
$menu_exec <<EOF
Crop to file
Crop to clipboard
Fullscreen to file
Fullscreen to clipboard
EOF
)"

screenshot_dir="$HOME/screenshots"

case "$choice" in
    'Crop to file')
        scrot --select --silent
        ;;
    'Crop to clipboard')
        scrot --select --silent - | xclip -selection clipboard -target image/png
        ;;
    'Fullscreen to file')
        scrot --silent
        ;;
    'Fullscreen to clipboard')
        scrot --silent - | xclip -selection clipboard -target image/png
        ;;
esac