summaryrefslogtreecommitdiffstats
path: root/system/snapscreenshot/snapscreenshot.cur
diff options
context:
space:
mode:
author B. Watson <yalhcru@gmail.com>2018-07-06 22:51:04 +0700
committer Willy Sudiarto Raharjo <willysr@slackbuilds.org>2018-07-07 06:54:18 +0700
commita274538685d16c0f4e6a6e05121a2600f010bc11 (patch)
treedb9d6dd017c59eae6824f92cb83a43cee9b926c7 /system/snapscreenshot/snapscreenshot.cur
parenta2dcdb585af8af69ff73c3e11de684a8906badb9 (diff)
downloadslackbuilds-a274538685d16c0f4e6a6e05121a2600f010bc11.tar.gz
slackbuilds-a274538685d16c0f4e6a6e05121a2600f010bc11.tar.xz
system/snapscreenshot: Added (screenshot program for text consoles).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'system/snapscreenshot/snapscreenshot.cur')
-rw-r--r--system/snapscreenshot/snapscreenshot.cur22
1 files changed, 22 insertions, 0 deletions
diff --git a/system/snapscreenshot/snapscreenshot.cur b/system/snapscreenshot/snapscreenshot.cur
new file mode 100644
index 0000000000..b674c0a8e0
--- /dev/null
+++ b/system/snapscreenshot/snapscreenshot.cur
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+# 20180704 bkw: wrapper for snapscreenshot, determines the current tty
+# and takes a screenshot of it by calling snapscreenshot with the
+# appropriate arguments.
+
+# I tried to make this work under X. You can find out which tty X is using
+# with: xprop -root | grep ^XFree86_VT | cut -d' ' -f3
+# However snapscreenshot itself fails because that console will be in
+# graphics mode (no text to read from /dev/vcs$TTY, so it'd give a
+# blank image).
+
+TTY="$( tty )"
+case "$TTY" in
+ /dev/tty?) TTY="$( echo $TTY | cut -dy -f2 )"
+ ;;
+ *) echo "You must run this from a console login session, not e.g. X or ssh" 1>&2
+ exit 1
+ ;;
+esac
+
+exec snapscreenshot --firstwin "$TTY" -c1 -x1 "$@"