-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscreenshot-x11.sh
executable file
·36 lines (28 loc) · 1.19 KB
/
screenshot-x11.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
mkdir -p "$HOME/Pictures/Screenshots"
eval $(xdotool getmouselocation --shell)
start_x=$X
start_y=$Y
filename="$HOME/Pictures/Screenshots/screenshot-$(date +"%d-%m-%Y_%H-%M-%S").png"
maim --select --hidecursor > "$filename"
exit_status=$?
if [[ "$exit_status" -ne 0 ]]; then
rm -rf "$filename"
notify-send "Screenshot cancelled" -r 9991 -t 5000 -u low
exit
fi
notify-send "Screenshot saved" -r 9991 -t 5000 -i "$filename"
feh -F "$filename"
choice=$(echo -e "(Y) Yes\n(N) No\n(X) Cut\n(R) Retake screenshot" | rofi -dmenu -i -p "Copy screenshot ? " -l 4)
if [[ "$choice" = "(Y) Yes" ]]; then
notify-send "Screenshot copied" -r 9991 -t 5000 -i "$HOME/.local/share/icons/custom/clipboard.svg"
cat "$filename" | xclip -selection clipboard -t image/png
elif [[ "$choice" = "(X) Cut" ]]; then
notify-send "Screenshot cut" -r 9991 -t 5000 -i "$HOME/.local/share/icons/custom/clipboard.svg"
cat "$filename" | xclip -selection clipboard -t image/png
rm -rf "$filename"
elif [[ "$choice" = "(R) Retake screenshot" ]]; then
notify-send "Screenshot deleted" -r 9991 -t 5000 -i "$HOME/.local/share/icons/custom/delete.svg"
rm -rf "$filename"
screenshot-x11.sh
fi