commit 35329a568d2537bb790a440d5dea089bdfd1cedb parent e01c3c67ab322fbeb0c2421ff7494c44f71cdac6 Author: Jacob R. Edwards <n/a> Date: Thu, 5 May 2022 19:50:48 -0500 Add screen snapshot script Diffstat:
| A | local/bin/bin/snap | | | 28 | ++++++++++++++++++++++++++++ |
1 file changed, 28 insertions(+), 0 deletions(-)
diff --git a/local/bin/bin/snap b/local/bin/bin/snap @@ -0,0 +1,28 @@ +#!/bin/sh +# Copyright 2022 Jacob R. Edwards +# Take a snapshot of an X11 display + +fmt=png + +wd() xwd -nobdrs -silent "$@" +cv() ( + fmt="$1"; shift + convert xwd:- "$@" "$fmt":- +) + +case "${1:-root}" in +(w|win|window) + wd | cv "$fmt" + ;; +(s|sel|select) + crop=$(slop -Dqo -b 2 -c 0,0,0) || + exit 1 + wd -root | cv "$fmt" -crop $crop + ;; +(r|/|root) + wd -root | cv "$fmt" + ;; +(*) + echo 'usage: snap [window | select | root]' 1>&2 + exit 1 +esac