Skip to content

Instantly share code, notes, and snippets.

@corentinbettiol
Last active June 4, 2023 18:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save corentinbettiol/de6cbeb7a9286d06339b4a80d64a7876 to your computer and use it in GitHub Desktop.
Save corentinbettiol/de6cbeb7a9286d06339b4a80d64a7876 to your computer and use it in GitHub Desktop.
Utility used to select the screen to link to all devices of wacom bamboo tablets connected to the computer.
#!/bin/sh
# Author: Corentin Bettiol
# Contact: corentin [at] 244466666 [dot] xyz
# Version: v040623
# License: WTFPL2 (https://wtfpl2.com/)
# Source: https://gist.github.com/corentinbettiol/de6cbeb7a9286d06339b4a80d64a7876
echo "Utility used to select the screen to link to all devices of wacom bamboo tablets connected to the computer."
screens=$(xrandr | grep " connected" | awk '{print $1}')
echo "screens:\n"
echo "$screens" | tr " " "\n"
echo "\nChoose the screen (just enter '0' for the first in the list, '1' for the second...):"
read screen
echo "Sticking all bamboo devices to screen $selected..."
xsetwacom --list devices | awk -F ' ' '{print "xsetwacom set '\''"$1"'\'' MapToOutput 'HEAD-$screen'"}'
xsetwacom --list devices | awk -F ' ' '{print "xsetwacom set '\''"$1"'\'' MapToOutput 'HEAD-$screen'"}' | sh
echo "Done!"
@corentinbettiol
Copy link
Author

corentinbettiol commented Jul 23, 2021

Download this script:

wget https://gist.githubusercontent.com/corentinbettiol/de6cbeb7a9286d06339b4a80d64a7876/raw/ -O wacom.sh && chmod +x wacom.sh

Example:

./wacom.sh
Utility used to select the screen to link to all devices of wacom bamboo tablets connected to the computer.
screens:

eDP-1-1
HDMI-1-2

Choose the screen (just enter '0' for the first in the list, '1' for the second...):
1
Sticking all bamboo devices to screen ...
xsetwacom set 'Wacom Bamboo Pen stylus' MapToOutput HEAD-1
xsetwacom set 'Wacom Bamboo Pen eraser' MapToOutput HEAD-1
xsetwacom set 'Wacom Bamboo Pen cursor' MapToOutput HEAD-1
xsetwacom set 'Wacom Bamboo Pad pad' MapToOutput HEAD-1
Done!

Here's how to list your devices without doing anything:

xsetwacom --list devices

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment