summaryrefslogtreecommitdiffstats
path: root/system/snapscreenshot/snapscreenshot.cur
blob: b674c0a8e0e4befe905bd86016fa4987ed636109 (plain)
#!/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 "$@"