From 355d4996dc32988aabe000fbfaa1a9bbdd9ec585 Mon Sep 17 00:00:00 2001 From: Marcin Chrzanowski Date: Sun, 26 Mar 2023 13:49:36 +0200 Subject: Add initial scripts --- wacom | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100755 wacom (limited to 'wacom') diff --git a/wacom b/wacom new file mode 100755 index 0000000..3c7fa96 --- /dev/null +++ b/wacom @@ -0,0 +1,55 @@ +#!/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 -- cgit v1.2.3