Created
March 8, 2018 11:58
-
-
Save anekos/90a128d630c5b086586028f560011aa3 to your computer and use it in GitHub Desktop.
Tap (メリケンサック)キーボード用スクリプト
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euC | |
# exec 5> /tmp/xmosh/shell-script-debug.out | |
# BASH_XTRACEFD="5" | |
# PS4='$LINENO: ' | |
# set -x | |
if [ "$#" -lt 1 ] | |
then | |
exec >&2 | |
echo "$0 <DEVICE_NAME>" | |
echo '' | |
echo 'Current deivces:' | |
grep '^N: Name=' /proc/bus/input/devices | sed 's/.*="//' | sed 's/"$//' | |
exit 1 | |
fi | |
function die { | |
echo 'Device not found' | |
exit 1 | |
} | |
NAME="$1" | |
dev="$(grep -A 10 "$NAME" /proc/bus/input/devices | grep '^H:')" || die | |
dev="$(expr "$dev" : '.*\(event[0-9]\+\)')" || die | |
echo "/dev/input/$dev" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# shellcheck disable=SC2154 | |
set -euC | |
# exec 5> /tmp/xmosh/shell-script-debug.out | |
# BASH_XTRACEFD="5" | |
# PS4='$LINENO: ' | |
# set -x | |
while read -r line | |
do | |
eval "$line" | |
[ "$value" = 1 ] || continue | |
case "$code" in | |
# .|... | |
18) | |
echo '@next' | |
;; | |
# .||.. | |
20) | |
echo '@input space' | |
;; | |
# ...|. | |
24) | |
echo '@previous' | |
;; | |
*) | |
echo "$code" >&2 | |
esac | |
done < <(devilnput "$(find-input-device Tap_C753)") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment