blob: 25fc3bd8d6bf687728c251c2e755359a38708f14 (
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
|
#!/bin/bash
DATE="$(date +'%d-%m-%y_%H:%M:%S')"
DIR="$HOME/pictures/screenshots"
PIC="$DIR/$DATE.jpg"
[ ! -d "$DIR" ] && mkdir -pv "$DIR"
abort() {
notify-send -a "Warn" -i dialog-error "Screenshot" "aborted"
exit 1
}
notification() {
NOTIFY=$(notify-send -A open=Open -A delete=Delete -a Screenshot -i "$PIC" "Screenshot" "$PIC")
if [[ $NOTIFY == "open" ]]; then
viewnior "$PIC"
elif [[ $NOTIFY == "delete" ]]; then
rm -rf "$PIC"
else
exit 0
fi
}
case "$1" in
full)
flameshot full -p "$PIC" || abort
#flameshot full -p ~/pictures/screenshots
xclip -selection primary <"$PIC"
notification
;;
crop)
flameshot gui -p "$PIC" || abort
#flameshot gui -p ~/pictures/screenshots
xclip -selection primary <"$PIC"
notification
;;
esac
|