Skip to content

Instantly share code, notes, and snippets.

@mortie
Created December 6, 2018 18:59
Show Gist options
  • Save mortie/297a966e22e788c80570fa37d4a15809 to your computer and use it in GitHub Desktop.
Save mortie/297a966e22e788c80570fa37d4a15809 to your computer and use it in GitHub Desktop.
Automatically show an on-screen keyboard.
#!/bin/sh
# Automatically show an on-screen keyboard when enabling tablet mode.
# The script depends on the acpi_listen program from the acpid package,
# and the onboard program from the onboard package.
listener() {
pid=
while read -r line; do
if [ "$line" = 00000001 ]; then
onboard &
pid=$!
else
kill $pid
fi
done
}
acpi_listen \
| grep --line-buffered "video/tabletmode" \
| stdbuf -oL cut -d' ' -f4 | listener
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment