slackbuilds_ponce/system/snapscreenshot/snapscreenshot.cur
B. Watson a274538685
system/snapscreenshot: Added (screenshot program for text consoles).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
2018-07-07 06:54:18 +07:00

22 lines
704 B
Bash

#!/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 "$@"