blob: 94da565c69e36f902db16cb4c83dbe5cb4ce1c85 (
plain) (
blame)
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
|
#!/usr/local/bin/andy
set -e NOTIFY_LONG screenshot
set -e NOTIFY_SHORT `basename $args[0]
func xnotify {
notify (
'Screenshot Saved'
"The screenshot ‘$filebase’ was successfully saved"
-i $filename
)
}
if test $#args -eq 2 && test $args[1] = '-f' {
set fflag true
set args $args[1..]
}
if test $#args -gt 1 {
echo "Usage: `{basename $args[0]} [-f]" >/dev/stderr
exit 1
}
set outdir $(XDG_PICTURES_DIR:$HOME/Pictures)/screen
set filebase `date +%F_%T.png
set filename $outdir/$filebase
[ -d $outdir ] || mkdir -p $outdir
if $(fflag:false) {
grim $filename
} else {
# TODO: Redirect slurp stderr to /dev/null
slurp | ifne grim -g - $filename
}
[ -f $filename ] || exit 1
set opt `echo "Copy screenshot\nEdit- and copy screenshot" | { osel || true }
if test $opt = 'Copy screenshot' {
wl-copy <$filename
notify (
'Screenshot Copied'
'Screenshot successfully copied to the clipboard'
-i $filename
)
} else if test $opt = 'Edit- and copy screenshot' {
satty -f $filename --save-after-copy
xnotify
# swappy -f $filename -o - | tee >{wl-copy} | sponge $filename
} else {
xnotify
}
|