Xubuntu Startup Delay vs. xsetwacom

Over the years, various xsetwacom incantations have confined the tablet stylus to the left-hand landscape monitor on my desk. Updating to Xubuntu 18.04 once again changed the monitors names (from HEAD-0 back to DP-1), but xsetwacom stopped working.

My script runs from Xubuntu’s “Application Autostart” list, so X is already running and xsetwacom should do the right thing. Alas, even with $XAUTHORITY and $DISPLAY set correctly (automagically by X), xsetwacom still didn’t corral the cursor.

Some rummaging around the Intertubes suggested a delay would allow X to get up to speed and, indeed, sleeping for two seconds solved the problem:

logger " - copying Xauthority values"
whoami > /tmp/who
cp /home/ed/.Xauthority /tmp/Xauthority.txt
cp $XAUTHORITY /tmp/xauth.cp
echo $DISPLAY > /tmp/DISPLAY.txt
# xsetwacom needs an additional delay after $XAUTHORITY and $DISPLAY become correct
logger " - waiting aimlessly"
sleep 2s
logger " - doing wacom setup"
xsetwacom --verbose set "Wacom Graphire3 6x8 Pen stylus" MapToOutput "DP-1"
xsetwacom --verbose set "Wacom Graphire3 6x8 Pen eraser" MapToOutput "DP-1"

Sheesh & similar remarks.

The complete Bash script as a GitHub Gist:

The cruft in there reminds me of previous fixes / workarounds / haxx, so it’s not entirely wasted space.