summaryrefslogtreecommitdiffstats
path: root/dwl-patches/patches/spawninfo/screenshotwin
blob: c8a3ebfa38377879e621adb7e5e45ab83f3bcc23 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/sh

# Get client info
read -r PID
read -r TITLE
read -r APPID
read -r TAGS
read -r GEOMETRY

[ -n "$GEOMETRY" ] || exit 1

tempdir="/tmp/screenshots"
mkdir -p "$tempdir"
file="$(mktemp -p "$tempdir" "XXXXXX.png")"

# Grab the screenshot! Very conviniently, GEOMETRY format matches the one
# expected by grim
grim -g "$GEOMETRY" "$file" || exit

wl-copy -t image/png < "$file"
notify-send -i "$file" "Screenshot taken!" "Image copied to clipboard and saved to $file"