config

OpenBSD system configuration
git clone git://jacobedwards.org/config
Log | Files | Refs | README

commit 9fa99b53bea8a4944de3c4982901f085922b840a
parent 4dbe4d282a47936747d80407c66e914b3826d631
Author: Jacob R. Edwards <jacobouno@protonmail.com>
Date:   Tue, 29 Dec 2020 12:29:54 -0800

Add vt/tty switching script

If I use Linux again, instead of juggling between chvt(1) and
wsconsctl(1) it can be wrapped in this script, with the additional
feature of swapping.

Diffstat:
Amodules/scripts/.local/bin/swtty | 17+++++++++++++++++
1 file changed, 17 insertions(+), 0 deletions(-)

diff --git a/modules/scripts/.local/bin/swtty b/modules/scripts/.local/bin/swtty @@ -0,0 +1,17 @@ +#!/usr/local/bin/rc -e +#! svt -- switch virtual terminals +#! +#! If no argument is given the previous vt is focused, otherwise the +#! given the arguments are taken as a display identifier and you are +#! focused on that. + +if (test -n $XDG_CACHE_HOME) + XDG_CACHE_HOME = $HOME^/.cache; +CACHE = $XDG_CACHE_HOME^/`{ basename $0 } + +fn cache { wsconsctl -n display.focus >$CACHE } +fn focus { cache && wsconsctl 'display.focus='^$* >/dev/null } + +if (test $#* -eq 0) { + focus `{ cat <$CACHE } +} else focus $*