-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wlsyshot-bemenu
executable file
·82 lines (71 loc) · 1.83 KB
/
wlsyshot-bemenu
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
#!/bin/env bash
# .m, .,
# 'T[ ][ ][
# W W ][ .dWW,'W W[.dWW,]bWW, dWb ]WWW
# T W P ][ ]bm,` W,W ]bm,`]P ][]P T[ ][
# ]bWd[ ][ ""W, ]WP ""W,][ ][][ ][ ][
# 'W W` ]bm ]mmd[ W[ ]mmd[][ ]['WmW` ]bm
# " " "" """ W """ '` '` '"` ""
# W[
#
# author: (c) Nicola Ferru Aka NFVblog
# The software is subject to license restrictions, for more information read the LICENSE file
command_exists() {
command -v "$@" >/dev/null 2>&1
}
if ! command_exists bemenu; then
echo "bemenu is not installed"
exit -1
fi
if ! command_exists swappy; then
echo "swappy is not installed"
exit -1
fi
if ! command_exists wl-copy; then
echo "wl-clipboard is not installed"
exit -1
fi
# Options
opts="full screen\nselection screen\nselection area\nselection window"
snipping=$(echo -e $opts | bemenu -p "Snipping tool")
if [[ $snipping == "" ]]; then
exit 0
fi
PICTURE_DIR="$HOME/Immagini"
temp="/tmp"
fileName=$(echo "$temp/$(date +'%s_grim.png')")
# function
opts_mod(){
mods="Edit screenshot\nSave\nCopy clipboard\nShare by KDE connect\n"
mods_la=$(echo -e $mods | bemenu -p "Options:")
if [[ $mods_la == "" ]]; then
exit 0
fi
case $mods_la in
"Edit screenshot") swappy -f $1;;
"Save") cp $1 $PICTURE_DIR/screenshot/;;
"Copy clipboard") wl-copy < $1;;
esac
notify-send "Finish!"
}
full_screen(){
actualFile=$fileName
grim $actualFile
opts_mod "$actualFile"
}
selection_screen(){
actualFile=$fileName
grim -o $(slurp -f %o -or) $actualFile
opts_mod "$actualFile"
}
selection_area(){
actualFile=$fileName
grim -g "$(slurp)" $actualFile
opts_mod "$actualFile"
}
# main program
case $snipping in
"full screen") full_screen;;
"selection screen") selection_screen;;
"selection area") selection_area;;
esac