summaryrefslogtreecommitdiff
path: root/.local/bin/screenshot
blob: 7328c106b4475422db8cb34f5ab02b00e82a53ee (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
#!/bin/sh

filename='screenshot_%Y-%m-%d-%H%M%S.png'

case "$1" in 
  "region")
    slurp | grim -t png -g - $HOME/pictures/Screenshots/$(date +$filename)
    ;;
  "window")
    swaymsg -t get_tree \
    | jq -r '.. | select(.pid? and .visible?) | .rect | "\(.x),\(.y) \(.width)x\(.height)"' \
    | slurp \
    | grim -t png -g -  $HOME/pictures/Screenshots/$(date +$filename)
    ;;
  "screen-internal")
    grim -o eDP-1 -t png $HOME/pictures/Screenshots/$(date +$filename)
    ;;
  "screen-external")
    grim -o HDMI-A-1 -t png $HOME/pictures/Screenshots/$(date +$filename)
    ;;
  *)
    grim -t png $HOME/pictures/Screenshots/$(date +$filename)
    ;;
esac