Repository navigation
Expand file tree
/
Copy pathscreenshot
More file actions
executable file
·42 lines (39 loc) · 1.53 KB
/
Copy pathscreenshot
File metadata and controls
executable file
·42 lines (39 loc) · 1.53 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
#!/bin/bash
# Screenshot wrapper
# Uses maim (which uses slop)
# "Friendship ended with scrot. Now maim is my best friend."
SCREENSHOTS_DIR="$HOME/Screenshots"
TIMESTAMP="$(date +%Y.%m.%d-%H:%M:%S)"
FILENAME=$SCREENSHOTS_DIR/$TIMESTAMP.png
PHOTO_ICON_PATH="$HOME/.config/awesome/themes/skyfall/icons/screenshot.png"
NOTIFY_TIME=4000
# -u option hides cursor
# -m option changes the compression level
# -m 3 takes the shot faster but the file size is slightly bigger
if [[ "$1" = "-s" ]]; then
# Area/window selection.
notify-send 'Select area to capture.' --urgency low -i $PHOTO_ICON_PATH
maim -u -m 3 -s $FILENAME
if [[ "$?" = "0" ]]; then
notify-send 'Screenshot!~' "Name: <span color=\"#EA9090\">$TIMESTAMP.png</span> " -t $NOTIFY_TIME --urgency low -i $PHOTO_ICON_PATH
fi
elif [[ "$1" = "-c" ]]; then
notify-send 'Select area to copy to clipboard.' --urgency low -i $PHOTO_ICON_PATH
# Copy selection to clipboard
#maim -u -m 3 -s | xclip -selection clipboard -t image/png
maim -u -m 3 -s /tmp/maim_clipboard
if [[ "$?" = "0" ]]; then
xclip -selection clipboard -t image/png /tmp/maim_clipboard
notify-send "Copied selection to clipboard." --urgency low -i $PHOTO_ICON_PATH
rm /tmp/maim_clipboard
fi
else
# Full screenshot
notify-send 'Screenshot!~' \
"Name: <span color=\"#EA9090\">$TIMESTAMP.png</span> " \
-t $NOTIFY_TIME \
--urgency low \
-i $PHOTO_ICON_PATH \
&& sleep 0.5
maim -u -m 3 $FILENAME
fi