Skip to content

Instantly share code, notes, and snippets.

@P-Louw
Created January 12, 2023 20:43
Show Gist options
  • Save P-Louw/bd37700519f66c25232d6b6c9685dadd to your computer and use it in GitHub Desktop.
Save P-Louw/bd37700519f66c25232d6b6c9685dadd to your computer and use it in GitHub Desktop.
Adjust wacom settings without GUI. This can be done using your distro's GUI (gnome-control-center etc.). But if you need to do it without for some reason these scripts use the official wacom drivers/tool.
#!/bin/bash
<<COMMENT
Setup wacom device:
- Date: 2020-07-11
- Device: 'Wacom one M'
- Dependency:
- xinput
- xsetwacom
Sets pressure sensitivity for wacom pen.
COMMENT
# Multiplier for cursor movement distance:
pFract=$"2.5"
# Bezier(linear) curve values for 'PressureCurve':
declare -a pCurve=( 0 20 80 100 )
# Rotation amount see 'man xsetwacom' 'Rotate':
cRotate=$"half"
# Cursor position, see 'man xsetwacom' 'Mode':
cMode=$"Relative"
# Use xsetwacom and xinput to retrieve and apply values:
# Returns every of wacom device id with max length 2 digits:
wacomIds=$(xsetwacom --list | grep -Eo '[0-9]{1,2}')
# Apply set values to found wacom devices:
for id in $wacomIds; do
xsetwacom --set $id Rotate $cRotate
xsetwacom --set $id PressureCurve ${pCurve[0]} ${pCurve[1]} ${pCurve[2]} ${pCurve[3]}
xsetwacom --set $id Mode $cMode
xinput --set-prop $id 'Device Accel Constant Deceleration' $pFract
done
#!/usr/bin/bash
<<COMMENT
Rotate wacom device:
- Date: 2022-09-11
- Device: 'Wacom one M'
- Requires
- xsetwacom
- xrandr
- xinput
Rotates wacom tablet orientation, for left handed.
This is done by changing the stylus device.
COMMENT
STYLUS_ID = xsetwacom list devices | sed -n '/stylus/p' | grep -Eo '[0-9]{1,2}'
xsetwacom --set $STYLUS_ID Rotate half
#!/usr/bin/bash
<<COMMENT
Setup wacom device:
- Date: 2022-09-11
- Device: 'Wacom one M'
- Requires
- xsetwacom
- xrandr
- xinput
Allows you to limit wacom to a single monitor.
Selection is done through given menu.
COMMENT
for com in xsetwacom xrandr xinput; do
if ! command -v $com &> /dev/null
then
echo "$com could not be found"
exit
fi
done
# Get device names of all connected monitors.
displays=($(xrandr | grep -Po "\K[^+w]+\b(?=connected)"))
echo "Detected ${#displays[@]} connected monitors."
PS3="Select which monitor the wacom should target:"$'\n'"=> "
select disp in "${displays[@]}"
do
if [[ $disp == "" ]]; then
echo Invalid choice!
else
echo "Selected ${disp}"
break
fi
done
echo "Reading all wacom devices..."
# Get wacom device ids:
wacomIds=$(xsetwacom --list | grep -Eo '[0-9]{1,2}')
for id in $wacomIds; do
xinput map-to-output $id $disp
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment