#!/bin/bash # Helper script for setting up a wacom tablet. # USAGE: wacom [-r] [-c ] # FLAGS: # -r: rotate the board's input 180°, useful if using the board upside down to # its assumed usage orientation. # -c: uses one of the hardcoded configurations for stylus button bindings. # NOTE: # The configs are currently hardcoded for my personal preferences in several # programs/websites for the One by Wacom tablet. # CONFIGS: # aww: (obsolete) for the AWW shared whiteboard. # krita: the Krita drawing program. # miro: for the Miro shared whiteboard. ID=`xsetwacom list devices | awk '/stylus/ { print $8 }'` function rotate { xsetwacom set $ID Rotate half } # AWW board, eraser + pencil function set_aww { xsetwacom set $ID Button 2 "key e" xsetwacom set $ID Button 3 "key p" } # Krita - right click (tags wheel), middle click (pan) function set_krita { xsetwacom set $ID Button 2 "button +2" xsetwacom set $ID Button 3 "button 3" } function set_miro { xsetwacom set $ID Button 2 "key v" xsetwacom set $ID Button 3 "key p" } function set_config { case "$1" in aww) set_aww ;; krita) set_krita ;; miro) set_miro ;; *) echo "Unexpected config \"$1\""; exit 1 ;; esac } while getopts 'rc:' flag; do case "${flag}" in r) rotate ;; c) set_config $OPTARG ;; *) error "Unexpected option ${flag}" ;; esac done