39 lines
984 B
Bash
39 lines
984 B
Bash
#!/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
|