diff options
author | Marcin Chrzanowski <m@m-chrzan.xyz> | 2023-03-26 13:49:36 +0200 |
---|---|---|
committer | Marcin Chrzanowski <m@m-chrzan.xyz> | 2023-03-26 13:49:36 +0200 |
commit | 355d4996dc32988aabe000fbfaa1a9bbdd9ec585 (patch) | |
tree | f4af7671f8ed4fd9138d5fe5a723b64046de456f /wacom | |
parent | 2a5b14312110abee3a70a2f59a8deacd6929031a (diff) |
Add initial scripts
Diffstat (limited to 'wacom')
-rwxr-xr-x | wacom | 55 |
1 files changed, 55 insertions, 0 deletions
@@ -0,0 +1,55 @@ +#!/bin/bash + +# Helper script for setting up a wacom tablet. +# USAGE: wacom [-r] [-c <config>] +# 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 |