summaryrefslogtreecommitdiff
path: root/scripts/.local/bin/screenshot
blob: 3c3afcdf3d035e1b21b4947657acf30d57ca46b9 (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
36
37
#!/bin/sh

# Screenshot Tool Script

if [ "$1" = "q" ] || [ "$1" = "quick" ]; then
	{
		maim -u -m 10 ~/Pictures/Screenshots/screenshot-"$(date '+%Y%m%d_%H%M%S')".png
	}
else
	{
		INPUT=$(printf "Screen\nSelection" | dmenu -i -c -l 15 -p "Screenshot: ")

		case "$INPUT" in
			Screen)
				SAVE=$(printf "Clipboard\nPictures Folder" | dmenu -i -c -l 15 -p "Save to: ")
				case "$SAVE" in
					"Clipboard")
						maim -u -q -d 1 -m 10 | xclip -selection clipboard -t image/png
						;;
					"Pictures Folder")
						maim -u -q -d 1 -m 10 ~/Pictures/Screenshots/screenshot-"$(date '+%Y%m%d_%H%M%S')".png
				esac
				;;
			Selection)
				SAVE=$(printf "Clipboard\nPictures Folder" | dmenu -i -c -l 15 -p "Save to: ")
				case "$SAVE" in
					"Clipboard")
						maim -s -u -m 10 | xclip -selection clipboard -t image/png
						;;
					"Pictures Folder")
						maim -s -u -m 10 ~/Pictures/Screenshots/screenshot-"$(date '+%Y%m%d_%H%M%S')".png
				esac
				;;
		esac

	}
fi