From f721826d92f4d93f44511d8021086c6c40d0cc1c Mon Sep 17 00:00:00 2001 From: Lucas Date: Sun, 20 Mar 2022 04:25:18 +0000 Subject: [PATCH] screenshot: replace xwd+netpbm with maim While at it, add a new keybind for it. --- bin/screenshot.sh | 37 +++------------------------ xdg-config-dir/herbstluftwm/autostart | 1 + 2 files changed, 4 insertions(+), 34 deletions(-) diff --git a/bin/screenshot.sh b/bin/screenshot.sh index c605a9c..d515141 100644 --- a/bin/screenshot.sh +++ b/bin/screenshot.sh @@ -1,6 +1,6 @@ #!/bin/sh # screenshot -# Written in 2019-2020 by Lucas +# Written in 2019-2020,2022 by Lucas # CC0 1.0 Universal/Public domain - No rights reserved # # To the extent possible under law, the author(s) have dedicated all @@ -12,40 +12,9 @@ usage() { - cat - <<. >&2 -Usage: - ${0##*/} - ${0##*/} -id id - ${0##*/} -name name - ${0##*/} -window -. + printf "Usage: %s [maim options]\n" "${0##*/}" >&2 exit 1 } -err() -{ - printf "%s: %s\n" "${0##*/}" "$*" >&2 - exit 1 -} - -case $# in -0) - set -- -root - ;; -1) - [ "$1" = "-window" ] || err "unknown option $1" - set -- - ;; -2) - [ "$1" = "-id" ] || [ "$1" = "-name" ] || err "unknown option $1" - [ -n "$2" ] || err "$1 expects a non-empty parameter" - ;; -*) - usage - ;; -esac - : ${SCREENSHOTS:=~/media/ss} -xwd -silent "$@" | - xwdtopnm | - pnmtopng >"$SCREENSHOTS/$(date +%Y%m%d-%H%M%S).png" +maim "$@" "$SCREENSHOTS/$(date +%Y%m%d-%H%M%S).png" diff --git a/xdg-config-dir/herbstluftwm/autostart b/xdg-config-dir/herbstluftwm/autostart index 897c59b..e680f8d 100755 --- a/xdg-config-dir/herbstluftwm/autostart +++ b/xdg-config-dir/herbstluftwm/autostart @@ -42,6 +42,7 @@ hc keybind $Mod-Control-Return spawn xterm -geometry 80x40 hc keybind $Mod-Control-l spawn xlock hc keybind $Mod-Control-z spawn sh -c 'xlock & doas /usr/sbin/ZZZ' hc keybind $Mod-Print spawn screenshot +hc keybind $Mod-Shift-Print spawn screenshot -s # basic movement # focusing clients