aboutsummaryrefslogtreecommitdiffstats
path: root/.config/init/funcs/ssh-scrot
blob: e5a3a364afac33243488defdfd7b929b42aad096 (plain)
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
#!/usr/bin/env zsh
# take a screenshot, upload to /img/scrot, and update current symlink
#

source $HOME/.config/init/vars

archey3

local name
if [[ "$1" != "" ]]; then
	name=$1
else
	echo -n "name: "
	read name
fi

local date=$(date +'%Y-%m-%d')

local folder="http/img/scrot"
ssh airen-no-jikken.icu "mkdir -p $folder/$date"

if [[ "${?#0}" != "" ]]; then
	return 1
fi

ssh airen-no-jikken.icu "cd $folder; rm current 2>/dev/null; ln -s $date current"

for i in {3..1}; do
	echo -n "$i "
	sleep 1
done

echo 'cheese!'
sleep .1

scrot $tmpdir/$name.png
convert -scale 250x $tmpdir/$name.png $tmpdir/${name}_small.png

scp $tmpdir/$name.png $tmpdir/${name}_small.png airen-no-jikken.icu:http/img/scrot/$date

echo "https://airen-no-jikken.icu/img/scrot/$date/$name.png" | tr -d '\n' | xclip -i -selection clipboard
echo "https://airen-no-jikken.icu/img/scrot/$date/$name.png" | tr -d '\n' | xclip -i -selection primary
echo "https://airen-no-jikken.icu/img/scrot/$date/${name}_small.png" | tr -d '\n' | xclip -i -selection clipboard
echo "https://airen-no-jikken.icu/img/scrot/$date/${name}_small.png" | tr -d '\n' | xclip -i -selection primary

echo 'sent!'

rm $tmpdir/$name.png $tmpdir/${name}_small.png