-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsshot
executable file
·50 lines (40 loc) · 1.42 KB
/
sshot
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
#!/usr/bin/env fish
# sshot - Take a screenshot.
# Avoids the junk appearing in the screenshot when scrot is used in selection mode.
# Also automatically copies the path to the screenshot to the clipboard (pass -C to prevent this).
# Requirements: scrot, slop ( https://github.com/naelstrof/slop ), c
# usage:
# sshot [-s] [-C]
# examples:
# select a region and take a screenshot of it:
# sshot -s
# code:
argparse -n sshot 'h/help' 's/select' 'C/no-clipboard' -- $argv
if set -q _flag_h
echo "sshot - Take a screenshot."
echo "Usage: sshot [arguments]"
echo
echo " -h/--help - Print help and exit."
echo " -s/--select - Select a region to screenshot rather than the entire screen."
echo " -C/--no-clipboard - Don't copy the screenshot's path to the clipboard."
exit
end
function filedate
echo (date '+%Y-%m-%d-%H%M%S')
end
# using scrot for now because imagemagick's images fuck up weirdly with twitter
if set -q _flag_s
slop -f "%g " | read G
set GX (string split '+' $G | head -1 | string trim)
set filename ~/(filedate)_$GX.png
set sr (string split '+' $G | string split 'x')
set sr (printf "%s,%s,%s,%s" $sr[3] (string trim "$sr[4]") $sr[1] $sr[2])
scrot -a $sr $filename
else
set filename ~/(filedate)_full.png
scrot -m $filename # add -p argument to capture pointer
# import -window root $filename
end
if not set -q _flag_C
echo -n $filename | c -i
end