From 6f6d67d20f12f94cacfc0f85a2548cfbe4b972d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Fri, 28 Sep 2018 09:57:47 +0200 Subject: Add xshot package --- x11-misc/xshot/files/xshot | 56 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100755 x11-misc/xshot/files/xshot (limited to 'x11-misc/xshot/files') diff --git a/x11-misc/xshot/files/xshot b/x11-misc/xshot/files/xshot new file mode 100755 index 0000000..decebc5 --- /dev/null +++ b/x11-misc/xshot/files/xshot @@ -0,0 +1,56 @@ +#!/bin/sh + +MODE= +OUTPUT= +while [ $# -gt 0 ]; do + case "$1" in + -h|--help) + echo "Usage: xshot [MODE] [OUTPUT]" + echo "Make Xorg screenshot" + echo + echo "Modes:" + echo " window (w)" + echo " screen (s)" + echo " desktop (d)" + echo "Default mode is window." + exit 0 + ;; + window|screen|desktop) + MODE="$1" + ;; + *) + if [ -z "$MODE" ]; then + MODE="$1" + elif [ -z "$OUTPUT" ]; then + OUTPUT="$1" + else + echo "Unknown argument: $1" >&2 + exit 1 + fi + esac + shift +done + +[ -n "$MODE" ] || MODE=window + +case "$MODE" in + window|w) + # TODO how about getting window class and naming it according to it + [ -n "$OUTPUT" ] || OUTPUT="xshot_$(date +%F_%H%M%S_%N).png" + import "$OUTPUT" + ;; + screen|s) + # TODO mode complicated + # https://unix.stackexchange.com/questions/247935/automatically-take-screenshot-of-specific-display-in-x#247936 + # This is going to work but question is how to specify screen/which screen + # is currently active + exit 1 + ;; + desktop|d) + [ -n "$OUTPUT" ] || OUTPUT="xshot_$(date +%F_%H%M%S_%N).png" + import -window root "$OUTPUT" + ;; + *) + echo "Unknown mode: $MODE" >&2 + exit 1 +esac -- cgit v1.2.3