-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmygrimshot.sh
executable file
·37 lines (33 loc) · 930 Bytes
/
mygrimshot.sh
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
#!/bin/bash
function fullscreenshot {
local timestamp=$(date +%m%d%H%M%S)
local save_path=$HOME/Pictures/Screenshots/Screenshot-${timestamp}.png
grim - | swappy -f - -o $save_path
wl-copy < $save_path
if [ -s $save_path ]; then
notify-send --icon=$save_path "Screenshot in $save_path"
else
rm $save_path
fi
}
function selectarea {
local timestamp=$(date +%m%d%H%M%S)
local save_path=$HOME/Pictures/Screenshots/Screenshot-${timestamp}.png
grim -g "$(slurp)" - | swappy -f - -o $save_path
wl-copy < $save_path
if [ -s $save_path ]; then
notify-send --icon=$save_path "Screenshot in $save_path"
else
rm $save_path
fi
}
whichMode(){
if [ "$1" = "full" ] || [ "$1" = "" ]; then
fullscreenshot
elif [ "$1" = "area" ]; then
selectarea
else
notify-send "Please select 'area' or 'full'"
fi
}
whichMode "$@"