Skip to content
Snippets Groups Projects
Unverified Commit 13b1f62e authored by Caleb Connolly's avatar Caleb Connolly :recycle:
Browse files

main/ttyescape: upgrade to hkdm/buffyboard

This upgrades ttyescape to use buffyboard, a new fbkeyboard replacement
by @cherrypicker. It adds a lot of missing keys and uses the same layout
as Phosh's Squeekboard, so should feel much more like home for Phosh
users.

This also switches to the new HKDM daemon for hotkey handling, replacing
triggerhappy.
parent 6bba554f
No related branches found
No related tags found
No related merge requests found
# Maintainer: Caleb Connolly <caleb@connolly.tech>
pkgname=ttyescape
pkgver=0.1
pkgver=0.2
pkgrel=0
pkgdesc="Daemon to allow users to escape to a tty"
url="https://postmarketos.org"
arch="all"
license="GPL-3.0-or-later"
depends="triggerhappy fbkeyboard terminus-font kbd"
depends="hkdm buffyboard terminus-font kbd"
install="$pkgname.post-install"
source="
togglevt.sh
ttyescape-triggerhappy.conf
ttyescape-hkdm.toml
etc-conf-d-ttyescape.conf
"
options="!check"
......@@ -19,15 +19,15 @@ package() {
install -Dm755 "$srcdir"/togglevt.sh \
"$pkgdir"/usr/bin/togglevt.sh
install -Dm755 "$srcdir"/ttyescape-triggerhappy.conf \
"$pkgdir"/etc/triggerhappy/triggers.d/ttyescape.conf
install -Dm755 "$srcdir"/ttyescape-hkdm.toml \
"$pkgdir"/etc/hkdm/config.d/ttyescape.conf
install -Dm755 "$srcdir"/etc-conf-d-ttyescape.conf \
"$pkgdir"/etc/conf.d/ttyescape.conf
}
sha512sums="
5a56740678073c72c1952e36742fb0786f932e718835c39502ab51f9731426e2b8479de38d4c44c35bc84a895b74ea0dc7bd39fd9eb89b603973ed6e43abb377 togglevt.sh
f8bf3273cf87392ab2092a005417bc58cb3ae6ad25b9118b76c68481d9d8fc7d964a9d16fc7645f6f9ff0676dccd381be3b846464b2e60a6452b8c883bffb6f1 ttyescape-triggerhappy.conf
5429c7029e6db292cccbd4d5fdb4eb07cbbe050fe886784ebb1f88d790de35c06714c2ad38d366d88ed78a09d4d20e0826541f8f578885384ff6b033ac606af8 etc-conf-d-ttyescape.conf
41e48d17e953b9a91bd14aaa7ddcc4cca43df8bbcc47824fb1301c43c24e9cdc829a343f43e3e01d30c6836b72cfbffb81da68fa1f5066499bad198d6e992e44 togglevt.sh
88034b54b06a962ff353a7a5a272352b56fdb564231a13be85b73d9dfc991d1ec8085014ebfcd5c6eaee67e62341dd2c9c7ace91a2c839702ae3b7f6007433f4 ttyescape-hkdm.toml
ac06c2ae2b3b8404d6ed79a046b175abbeb2360033edcaa22c21e1a61c68913e58013e9200ee5b786eee9020a2c78d1bda09c72d87ea0998bf6eeb71da015a2f etc-conf-d-ttyescape.conf
"
......@@ -6,3 +6,4 @@ FONT="/usr/share/consolefonts/ter-128n.psf.gz"
PRESSCOUNT=3
# tmpfile to use for counting state
TMPFILE="/tmp/ttyescape.tmp"
KEYBOARD="buffyboard"
#!/bin/sh
# Toggle between tty1 and tty2, launching fbkeyboard when on tty2
# Toggle between tty1 and tty2, launching $KEYBOARD when on tty2
# THIS SCRIPT MUST BE RUN AS ROOT
# usage:
# togglevt.sh <state>
......@@ -19,6 +19,7 @@ FONT="${FONT:-/usr/share/consolefonts/ter-128n.psf.gz}"
# amount of times power must be pressed to trigger
PRESSCOUNT="${PRESSCOUNT:-3}"
TMPFILE="${TMPFILE:-/tmp/ttyescape.tmp}"
KEYBOARD="${KEYBOARD:-buffyboard}"
if [ ! -e /dev/uinput ]; then
if ! modprobe -q uinput; then
......@@ -26,17 +27,21 @@ if [ ! -e /dev/uinput ]; then
fi
fi
if [ "$KEYBOARD" != "buffyboard" ]; then
KEYBOARD="fbkeyboard"
fi
switchtty() {
currentvt=$(cat /sys/devices/virtual/tty/tty0/active)
if [ "$currentvt" = "tty2" ]; then # switch to tty1 with normal UI
chvt 1
killall fbkeyboard
else # Switch to tty2 with fbkeyboard
killall $KEYBOARD
else # Switch to tty2 with $KEYBOARD
setfont "$FONT" -C /dev/tty2
chvt 2
# sometimes fbkeyboard can be running already, we shouldn't start it in that case
[ "$(pgrep fbkeyboard)" ] || nohup fbkeyboard -r "$(cat /sys/class/graphics/fbcon/rotate)" &
# sometimes they keyboard can be running already, we shouldn't start it in that case
[ "$(pgrep $KEYBOARD)" ] || nohup $KEYBOARD -r "$(cat /sys/class/graphics/fbcon/rotate)" &
fi
}
......
[[events]]
name = "increment"
event_type = "EV_KEY"
key_state = "released"
keys = ["KEY_VOLUMEDOWN", "KEY_POWER"]
command = "/usr/bin/togglevt.sh inc"
[[events]]
name = "start"
event_type = "EV_KEY"
key_state = "pressed"
keys = ["KEY_VOLUMEDOWN"]
command = "/usr/bin/togglevt.sh start"
[[events]]
name = "reset"
event_type = "EV_KEY"
key_state = "released"
keys = ["KEY_VOLUMEDOWN"]
command = "/usr/bin/togglevt.sh reset"
\ No newline at end of file
KEY_POWER+KEY_VOLUMEDOWN 0 /usr/bin/togglevt.sh inc
KEY_VOLUMEDOWN 1 /usr/bin/togglevt.sh start
KEY_VOLUMEDOWN 0 /usr/bin/togglevt.sh reset
# noop to prevent garbage being typed in console
KEY_VOLUMEDOWN 2 /bin/true
#!/bin/sh
# Enable triggerhappy
rc-update -q add triggerhappy default
# Enable hkdm
rc-update -q add hkdm default
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment