summaryrefslogtreecommitdiff
path: root/scripts/.local/bin/screenshot
blob: b887e3edd938fecc485d12dc901027b3685b169a (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
38
39
40
41
42
43
44
45
46
47
#!/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 -p "Screenshot: ")

		case "$INPUT" in
			Screen)
				SAVE=$(printf "Clipboard\nNote\nPictures Folder" | dmenu -i -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
						;;
					"Note")
						DATE=$(date '+%y%m%d%H%M%S%N')
						maim -u -q -d 1 -m 10 /tmp/screenshot-"$DATE".png
						sxiv /tmp/screenshot-"$DATE".png
				esac
				;;
			Selection)
				SAVE=$(printf "Clipboard\nNote\nPictures Folder" | dmenu -i -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
						;;
					"Note")
						DATE=$(date '+%y%m%d%H%M%S%N')
						maim -s -u -m 10 /tmp/screenshot-"$DATE".png
						sxiv /tmp/screenshot-"$DATE".png
				esac
				;;
		esac

	}
fi