summaryrefslogtreecommitdiff
path: root/x11-misc
diff options
context:
space:
mode:
Diffstat (limited to 'x11-misc')
-rwxr-xr-xx11-misc/xshot/files/xshot56
-rw-r--r--x11-misc/xshot/xshot-1.ebuild15
2 files changed, 71 insertions, 0 deletions
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
diff --git a/x11-misc/xshot/xshot-1.ebuild b/x11-misc/xshot/xshot-1.ebuild
new file mode 100644
index 0000000..8e89304
--- /dev/null
+++ b/x11-misc/xshot/xshot-1.ebuild
@@ -0,0 +1,15 @@
+EAPI=7
+
+DESCRIPTION="Xorg easy and fast screenshot utility script"
+HOMEPAGE="http://git.cynerd.cz/gentoo-personal-overlay/"
+S="${WORKDIR}"
+
+LICENSE="GPL-3.0+"
+SLOT="0"
+KEYWORDS="amd64 x86"
+
+RDEPEND="media-gfx/imagemagick"
+
+src_install() {
+ doexe "${FILESDIR}/xshot"
+}