bin: adapt screenshot scripts for x11/wayland - dotfiles - 🍚 personal arsenal of "rice"
HTML git clone https://git.drkhsh.at/dotfiles.git
DIR Log
DIR Files
DIR Refs
DIR Submodules
DIR README
DIR LICENSE
---
DIR commit 87587efa4178beb70a0819d67f6f026a1ed1fbbe
DIR parent 2e991b0fef0f22edcafaa24735ac331f5c0984a1
HTML Author: drkhsh <me@drkhsh.at>
Date: Wed, 16 Jul 2025 19:06:37 +0200
bin: adapt screenshot scripts for x11/wayland
Diffstat:
M bin/.local/bin/screenshot | 16 +++++++++++++---
M bin/.local/bin/screenshot-sel | 16 +++++++++++++---
2 files changed, 26 insertions(+), 6 deletions(-)
---
DIR diff --git a/bin/.local/bin/screenshot b/bin/.local/bin/screenshot
@@ -1,4 +1,14 @@
#!/bin/sh
-
-mkdir ~/screenshots > /dev/null 2>&1 || true
-grim ~/screenshots/$(date +'%s_grim.png')
+dir="${HOME}/screenshots"
+mkdir ${dir} > /dev/null 2>&1 || true
+(
+ fn=""
+ cd ${dir}
+ if [ -z "${WAYLAND_DISPLAY}" ]; then
+ fn="$(scrot -e 'echo $f')"
+ else
+ fn="$(date +'%Y-%m-%d-%H%M%S_grim.png')"
+ grim "${fn}"
+ fi
+ echo "${dir}/${fn}"
+)
DIR diff --git a/bin/.local/bin/screenshot-sel b/bin/.local/bin/screenshot-sel
@@ -1,4 +1,14 @@
#!/bin/sh
-
-mkdir ~/screenshots > /dev/null 2>&1 || true
-grim ~/screenshots/$(date +'%s_grim.png') --select --line mode=edge
+dir="${HOME}/screenshots"
+mkdir ${dir} > /dev/null 2>&1 || true
+(
+ fn=""
+ cd ${dir}
+ if [ -z "${WAYLAND_DISPLAY}" ]; then
+ fn="$(scrot -s -e 'echo $f')"
+ else
+ fn="$(date +'%Y-%m-%d-%H%M%S_grim.png')"
+ slurp | grim -g "${fn}"
+ fi
+ echo "${dir}/${fn}"
+)