Skip to content

Instantly share code, notes, and snippets.

@anekos
Created March 8, 2018 11:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anekos/90a128d630c5b086586028f560011aa3 to your computer and use it in GitHub Desktop.
Save anekos/90a128d630c5b086586028f560011aa3 to your computer and use it in GitHub Desktop.
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