summary refs log tree commit diff stats
path: root/bin/screenshot
blob: 67070907d7791a1ff9e835e86dc5c12cadc2f556 (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
#!/bin/sh

# 
# Takes a screenshot with grimshot, in clipboard or in given directory
#

DIR="$HOME/downloads/screenshots"
MODE=$(printf "save\ncopy" | dmenu)

# If dmenu was cancelled, exit program
if [ $? -ne 0 ]; then
    exit 1
fi

mkdir -p $DIR

case "$MODE" in 
  *save*)
    cd $DIR
    timestamp=$(date +"%Y-%m-%d_%H-%M-%S")
    grimshot save area "$timestamp.png"
    ;;
  *copy*)
    grimshot copy area
    ;;
esac