summaryrefslogtreecommitdiffstats
path: root/dwl-patches/patches/spawninfo/screenshotwin
diff options
context:
space:
mode:
authorLeonard Kugis <leonard@kug.is>2025-05-23 11:41:09 +0000
committerLeonard Kugis <leonard@kug.is>2025-05-23 11:41:09 +0000
commitc70505d7c7b7b48600f273357694b56ccf5d2a15 (patch)
tree21c27ac6ffced8d6d904e35bdb39baa5d685d829 /dwl-patches/patches/spawninfo/screenshotwin
downloaddotfiles-c70505d7c7b7b48600f273357694b56ccf5d2a15.tar.gz
dotfiles-c70505d7c7b7b48600f273357694b56ccf5d2a15.tar.bz2
dotfiles-c70505d7c7b7b48600f273357694b56ccf5d2a15.zip
Initial commit
Diffstat (limited to 'dwl-patches/patches/spawninfo/screenshotwin')
-rwxr-xr-xdwl-patches/patches/spawninfo/screenshotwin21
1 files changed, 21 insertions, 0 deletions
diff --git a/dwl-patches/patches/spawninfo/screenshotwin b/dwl-patches/patches/spawninfo/screenshotwin
new file mode 100755
index 0000000..c8a3ebf
--- /dev/null
+++ b/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"