Remade typewriter w/ a shellscript
src: https://git.gay/Micro/typewriter
This commit is contained in:
parent
e9a2c969c0
commit
b68a4b7ccb
|
@ -0,0 +1,38 @@
|
|||
#!/bin/bash
|
||||
|
||||
# XXX: CHANGEME
|
||||
KEYBOARD_ID="AT Translated Set 2 keyboard"
|
||||
|
||||
b_isColon=false
|
||||
|
||||
KEY_ENTER=36
|
||||
KEY_SEMICOLON=47
|
||||
KEY_BACKSPACE=22
|
||||
KEY_3=12
|
||||
|
||||
xinput test "$KEYBOARD_ID" | while read -r line; do
|
||||
if [[ "$line" =~ "key press" ]]; then
|
||||
keycode="$(echo "$line" | awk '{print$3}')"
|
||||
case "$keycode" in
|
||||
"$KEY_ENTER")
|
||||
b_isColon=false;
|
||||
sfxc play typewriter/pc_on;;
|
||||
"$KEY_BACKSPACE")
|
||||
b_isColon=false;
|
||||
sfxc play typewriter/bwomp;;
|
||||
"$KEY_SEMICOLON")
|
||||
b_isColon=true;
|
||||
sfxc play typewriter/text;;
|
||||
"$KEY_3")
|
||||
if [ "$b_isColon" = "true" ]; then
|
||||
sfxc play typewriter/meow;
|
||||
else
|
||||
sfxc play typewriter/text;
|
||||
fi;
|
||||
;;
|
||||
*)
|
||||
b_isColon=false;
|
||||
sfxc play typewriter/text;;
|
||||
esac;
|
||||
fi;
|
||||
done
|
Loading…
Reference in New Issue