bin/waybar-screenshot 554 B raw
1
#!/bin/sh
2
3
case "$1" in
4
  region)
5
    geometry=$(slurp) || exit
6
    grim -g "$geometry" - | wl-copy
7
    ;;
8
  full)
9
    grim -c - | wl-copy
10
    ;;
11
  window)
12
    regions=$(swmctl window regions) || exit
13
    geometry=$(printf '%s\n' "$regions" | slurp -r) || exit
14
    grim -c -g "$geometry" - | wl-copy
15
    ;;
16
  edit)
17
    grim -c - |
18
      satty --filename - --fullscreen current-screen --initial-tool crop \
19
      --copy-command=wl-copy --early-exit copy
20
    ;;
21
  *)
22
    echo "usage: waybar-screenshot {region|full|window|edit}" >&2
23
    exit 2
24
    ;;
25
esac