-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscreenshot
More file actions
executable file
·114 lines (85 loc) · 3.13 KB
/
screenshot
File metadata and controls
executable file
·114 lines (85 loc) · 3.13 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#!/usr/bin/env bash
####################################################################
# #
# About #
# #
####################################################################
usage="
NAME
screenshot
SYNOPSIS
screenshot [-h|-q|-s|-f|-b]
ARGUMENTS
-q | --quiet
Don't send notification to dunst.
-s | --selected
Interactively select window or rectangle with the mouse.
-f | --focused
Take screenshot of currently focused window
-b | --border
Include window border
"
####################################################################
# #
# Dependencies #
# #
####################################################################
####################################################################
# #
# Globals & Defaults #
# #
####################################################################
quiet=false
####################################################################
# #
# Parse Command Args #
# #
####################################################################
while test $# -gt 0; do
case "$1" in
-h|--help|-\?)
echo "$usage" >&2
exit 1
;;
-q|--quiet)
quiet=true
;;
-s|--selected)
selected=true
args=" -s"
;;
-f|--focused)
args=$args" -u"
;;
-b|--border)
args=$args" -b"
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1
;;
*)
echo "$usage" >&2
exit 1
;;
esac
shift
done
####################################################################
# #
# Functions #
# #
####################################################################
function main {
if [[ "$quiet" = false ]] && [[ "$selected" = true ]]; then
notify-send "Screenshot" "Select an area to capture in screenshot."
fi
screenshot_directory=~/Dropbox/Screenshots/$(date +"%Y")/
mkdir -p $screenshot_directory
scrot -d 2 $screenshot_directory%Y-%m-%d_%H_%M_%S_\$wx\$h.png $args
if [ "$quiet" = false ]; then
notify-send "Screenshot Taken" "Saved to ${screenshot_directory}"
fi
}
main
exit