Score:0

xsetwacom settings lost after switching to another computer with kvm switch. Ubuntu 22.04

cz flag

I have a few Wacom settings that I have loading at startup, but they are lost when I switch off my monitor to use another input and then come back. I have been trying to figure out some way to trigger the script again at that point. If I could find some way to make these settings permanent I would be so happy. Thanks!

xsetwacom --set "Wacom Intuos S 2 Pen stylus"  Button 2 "pan"
xsetwacom --set "Wacom Intuos S 2 Pen stylus" "PanScrollThreshold" 30
xsetwacom --set "Wacom Intuos S 2 Pen stylus" Area 0 0 15200 6000
Score:0
cz flag

After trying every solution for a week and a half, I finally got this working through a udev rule. I needed to set the DISPLAY and XAUTORITY, and I was using the wrong settings for those initially. I also needed to call the script through an intermediary script for some reason.

/etc/udev/rules.d/99-wacom.rules

ACTION=="add" SUBSYSTEM=="usb", ENV{ID_VENDOR_ID}=="056a", ENV{ID_MODEL_ID}=="033b", RUN+="/usr/local/bin/wacomconfig.sh"

/usr/local/bin/wacomconfig.sh (set to chmod +x)

#!/bin/bash

/usr/local/bin/wacom.sh &

/usr/local/bin/wacom.sh (set to chmod +x)

#!/bin/bash
export XAUTHORITY=/run/user/501/gdm/Xauthority
export DISPLAY=:1

sleep 1
xsetwacom --set "Wacom Intuos S 2 Pen stylus"  Button 2 "pan"
xsetwacom --set "Wacom Intuos S 2 Pen stylus" "PanScrollThreshold" 30
xsetwacom --set "Wacom Intuos S 2 Pen stylus" Area 0 0 15200 6000

And I found out what my DISPLAY and XAUTHORITY were using these:

ps -u $(id -u) -o pid= |
  xargs -I{} cat /proc/{}/environ 2>/dev/null |
  tr '\0' '\n' |
  grep -m1 '^XAUTHORITY='

ps -u $(id -u) -o pid= |
  xargs -I{} cat /proc/{}/environ 2>/dev/null |
  tr '\0' '\n' |
  grep -m1 '^DISPLAY='

And found out my ID_VENDOR_ID and ID_MODEL_ID using

lsusb
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.