Skip to content

Instantly share code, notes, and snippets.

@corentinbettiol
Last active Jul 23, 2021
Embed
What would you like to do?
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: v230721
# 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 "Choose the screen (just enter '1', '2', '3'...):"
read screen
selected=$( echo $screens | cut -d' ' -f$screen )
echo "Sticking all bamboo devices to screen $selected..."
xsetwacom --list devices | awk -F ' ' '{print "xsetwacom set '\''"$1"'\'' MapToOutput '$selected'"}'
xsetwacom --list devices | awk -F ' ' '{print "xsetwacom set '\''"$1"'\'' MapToOutput '$selected'"}' | sh
echo "Done!"
@corentinbettiol

This comment has been minimized.

Copy link
Owner Author

@corentinbettiol corentinbettiol commented Jul 23, 2021

Download this script:

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

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

xsetwacom --list devices

Example:

$ xsetwacom --list devices
Wacom Bamboo Pen stylus                 id: 15  type: STYLUS    
Wacom Bamboo Pen eraser                 id: 16  type: ERASER    
Wacom Bamboo Pen cursor                 id: 23  type: CURSOR    
Wacom Bamboo Pad pad                    id: 24  type: PAD    

Demo:

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

eDP
HDMI-A-0
Choose the screen (just enter '1', '2', '3'...):
1
Sticking bamboo table to screen eDP...
xsetwacom set 'Wacom Bamboo Pen stylus' MapToOutput eDP
xsetwacom set 'Wacom Bamboo Pen eraser' MapToOutput eDP
xsetwacom set 'Wacom Bamboo Pen cursor' MapToOutput eDP
xsetwacom set 'Wacom Bamboo Pad pad' MapToOutput eDP
Done!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment