-
Notifications
You must be signed in to change notification settings - Fork 0
/
screenshot.sh
executable file
·92 lines (90 loc) · 2.77 KB
/
screenshot.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
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
83
84
85
86
87
88
89
90
91
92
#!/usr/bin/env bash
# www.jrodal.dev
source $HOME/.config/dunst/variables.sh
case "$1" in
"scrot")
case "$2" in
fullToFile )
# takes screenshot of full display and moves to SCREENSHOT_DIR
scrot -e "mv \$f $SCREENSHOT_DIR; $ACTIONS_PATH $SCREENSHOT_DIR/\$f"
;;
fullToClip )
# takes screenshot of full display and saves it to clipboard
scrot -e "xclip -selection clipboard -t image/png -i \$f; rm \$f; $ACTIONS_PATH clipboard"
;;
selectToFile )
# takes a screenshot using selection tools and moves in to SCREENSHOT_DIR
scrot -se "mv \$f $SCREENSHOT_DIR; $ACTIONS_PATH $SCREENSHOT_DIR/\$f"
;;
selectToClip )
# takes a screenshot using selection tools and saves it to clipboard
scrot -se "xclip -selection clipboard -t image/png -i \$f; rm \$f; $ACTIONS_PATH clipboard"
;;
windowToFile )
# takes a screenshot of active window and moves it to SCREENSHOT_DIR
scrot -ue "mv \$f $SCREENSHOT_DIR; $ACTIONS_PATH $SCREENSHOT_DIR/\$f"
;;
windowToClip )
# takes a screenshot of active window and saves it to clipboard
scrot -ue "xclip -selection clipboard -t image/png -i \$f; rm \$f; $ACTIONS_PATH clipboard"
;;
*)
send_error "$2 is not a supported action for $1"
;;
esac
;;
"maim")
case "$2" in
fullToFile )
FILENAME=$SCREENSHOT_DIR/$(date +%s).png
maim $FILENAME
$ACTIONS_PATH $FILENAME
;;
fullToClip )
maim | xclip -selection clipboard -t image/png
$ACTIONS_PATH clipboard
;;
selectToFile )
FILENAME=$SCREENSHOT_DIR/$(date +%s).png
maim -s $FILENAME
$ACTIONS_PATH $FILENAME
;;
selectToClip )
maim -s | xclip -selection clipboard -t image/png
$ACTIONS_PATH clipboard
;;
windowToFile )
FILENAME=$SCREENSHOT_DIR/$(date +%s).png
maim -i $(xdotool getactivewindow) $FILENAME
$ACTIONS_PATH $FILENAME
;;
windowToClip )
maim -i $(xdotool getactivewindow) | xclip -selection clipboard -t image/png
$ACTIONS_PATH clipboard
;;
*)
send_error "$2 is not a supported action for $1"
;;
esac
;;
"flameshot")
case "$2" in
full )
flameshot full -p $SCREENSHOT_DIR
;;
select )
flameshot gui -p $SCREENSHOT_DIR
;;
"Flameshot Info" )
FILENAME="${3##* }" # gets the last word in the notification body, which is either the file path or clipboard
$ACTIONS_PATH $FILENAME
;;
*)
send_error "$2 is not a supported action for $1"
;;
esac
;;
* )
send_error "$1 is not a supported screenshot tool."
;;
esac