summaryrefslogtreecommitdiffstats
path: root/public/.local/bin/screenshot.sh
blob: be4a8f902eba614c13a720c5af84642b734b01d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash

# Takes a screenshot and saves it

# Inspired by Denshi's screenshot script (https://git.denshi.org/Scripts/tree/screenshot).
# See also https://www.youtube.com/watch?v=uYNTFg3_QaY&t=243s

savepath="$HOME/media/Pictures/Screenshots"
filename="$HOSTNAME-$(date -Iseconds | tr -d ':-').png"

if [ "$1" == "screen" ]; then
    # capture the screen determined by the cursor location
    shotgun -s "$savepath/$filename"
elif [ "$1" == "screens" ]; then
    # TODO:  This is not currently possible with shotgun 2.5.1
    :
else
    # capture a region of the screen
    shotgun -g $(hacksaw) "$savepath/$filename"
fi