summaryrefslogtreecommitdiff
path: root/dwl/dwl-patches/patches/spawninfo/screenshotwin
diff options
context:
space:
mode:
authorcoasteen <coasteen@proton.me>2026-07-09 10:42:28 +0330
committercoasteen <coasteen@proton.me>2026-07-09 10:42:28 +0330
commit8cbadb61604667b407b53ee1258433994fa4765a (patch)
tree97765fb29418fd6278fcb4cbb9760893afaf7a58 /dwl/dwl-patches/patches/spawninfo/screenshotwin
Diffstat (limited to 'dwl/dwl-patches/patches/spawninfo/screenshotwin')
-rwxr-xr-xdwl/dwl-patches/patches/spawninfo/screenshotwin21
1 files changed, 21 insertions, 0 deletions
diff --git a/dwl/dwl-patches/patches/spawninfo/screenshotwin b/dwl/dwl-patches/patches/spawninfo/screenshotwin
new file mode 100755
index 0000000..c8a3ebf
--- /dev/null
+++ b/dwl/dwl-patches/patches/spawninfo/screenshotwin
@@ -0,0 +1,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"