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