Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Tap (メリケンサック)キーボード用スクリプト
#!/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"
#!/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