aboutsummaryrefslogtreecommitdiff
path: root/.config/awesome/scripts/maimtake
blob: 4b7f9e3994c5cd5616e6ecbe3100c96d7a3ede34 (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
#!/bin/sh

date=$(date +%Y%m%d_%H%M%S)
path=~/Pictures/Screenshot_$date.png
rootid=$(xwininfo -root -int | grep -iPo --color=never "(?<=id:\s)[0-9]*?\s")

if [[ $1 -eq 1 ]]
then
    # fullscreen
    maim $path && xclip -selection clipboard -t image/png $path
    notify-send -a "Maim" "Screenshot taken" "Saved at $path"
elif [[ $1 -eq 2 ]]
then
    # region
    maim -s $path && xclip -selection clipboard -t image/png $path
    if [[ $? -eq 0 ]]
    then
        notify-send -a "Maim" "Screenshot taken" "Saved at $path"
    fi
elif [[ $1 -eq 3 ]]
then
    # current window
    maim -i $(xdotool getactivewindow) $path && xclip -selection clipboard -t image/png $path
fi