blob: 0ae696a2ebdc163ce2bd8f1c3f9767ae8477f0fa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
#!/bin/sh
# Takes a screenshot
borderColor="0.412,0.431,1"
name="$(date +"%y%m%d_%H%M%S")".png
file="$HOME/images/screenshots/${name}"
# If secondary screen is connected take a screenshot of only it
geometry=""
hdmiLine="$(xrandr | grep '^HDMI-1-1')"
if [ -n "$hdmiLine" ] && ! echo "$hdmiLine" | grep -q 'disconnected'; then
g="$(xrandr | grep '^HDMI-1-1' | grep -E --only-matching '[0-9]+x[0-9]+\+[0-9]+\+[0-9]+')"
geometry="-g $g"
fi
[ "$1" = "" ] && maim -u -m 8 $geometry "$file" && notify-send -t 800 "Screenshot $name taken."
[ "$1" = "-a" ] && maim -u -s -b 2 -c "$borderColor" -m 8 "$file" && notify-send -t 800 "Screenshot $name taken."
[ "$1" = "-c" ] && maim -u -s -b 2 -c "$borderColor" -m 8 | xclip -selection clipboard -t image/png && notify-send -t 800 "Screenshot copied to clipboard."
|