Wacom ExpressKey Remote & xsetwacom

A while back I bought myself a Wacom Cintiq Pro 13", and a short while after that a Wacom ExpressKey Remote Accessory.
As Linux (Manjaro) is the main operating system on my laptop i set up xsetwacom to handle the ExpressKey Remote. (And of course The Linux Wacom Project to handle input of the Cintiq).
The ExpressKey Remote features a mode select which I didn't initially configure... because I found no good resource. After tinkering a bit I discovered that I could read which led was active, and thus which mode. See the first script, remotekey-mode, below. I then mapped the mode select key to run the second script, remotekey-setkeys, to change the action of the wheel on the RemoteKey Express accordingly, see the seconds script below.
Make sure the scripts are executable and in your PATH.

remotekey-mode

#!/bin/bash

led0_path=$(find /sys/class/leds/ -name "*wacom-0.0")
led0_status=$(cat "$led0_path/brightness")

led1_path=$(find /sys/class/leds/ -name "*wacom-0.1")
led1_status=$(cat "$led1_path/brightness")

led2_path=$(find /sys/class/leds/ -name "*wacom-0.2")
led2_status=$(cat "$led2_path/brightness")

if [ "$led0_status" -eq "255" ]
then
   echo "Mode0"
elif [ "$led1_status" -eq "255" ]
then
   echo "Mode1"
elif [ "$led2_status" -eq "255" ]
then
   echo "Mode2"
fi

remotekey-setkeys

#!/bin/bash

mode=$(remotekey-mode)

case "$mode" in
"Mode0")
   echo "mode 0"
   xsetwacom -s set "Wacom Express Key Remote Pad pad" "AbsWheelUp" "key altgr 8"
   xsetwacom -s set "Wacom Express Key Remote Pad pad" "AbsWheelDown" "key altgr 9"
   ;;
"Mode1")
   echo "mode 1"
   xsetwacom -s set "Wacom Express Key Remote Pad pad" "AbsWheelUp" "key k"
   xsetwacom -s set "Wacom Express Key Remote Pad pad" "AbsWheelDown" "key l"
   ;;
"Mode2")
   echo "mode 2"
   xsetwacom -s set "Wacom Express Key Remote Pad pad" "AbsWheelUp" "key i"
   xsetwacom -s set "Wacom Express Key Remote Pad pad" "AbsWheelDown" "key o"
   ;;
esac
2018-12-17Kenneth HedmanEnglishLinuxWacom