From 4c6652a20fe383b04358055497a6d5ac222639df Mon Sep 17 00:00:00 2001 From: Chris Date: Fri, 16 Apr 2021 14:38:33 +0100 Subject: [PATCH] Write scripts for setting up wacom tablet and maptool --- .config/systemd/user/wacom.service | 11 +++++++++++ .local/bin/initwacom | 30 ++++++++++++++++++++++++++++++ .local/bin/setup/maptool | 4 ++++ .local/bin/setup/wacom | 5 +++++ 4 files changed, 50 insertions(+) create mode 100644 .config/systemd/user/wacom.service create mode 100755 .local/bin/initwacom diff --git a/.config/systemd/user/wacom.service b/.config/systemd/user/wacom.service new file mode 100644 index 0000000..3c8ff32 --- /dev/null +++ b/.config/systemd/user/wacom.service @@ -0,0 +1,11 @@ +[Unit] +Description=Configure Wacom tablet +After=graphical-session.target +PartOf=graphical-session.target + +[Service] +Type=oneshot +ExecStart=/home/chris/.local/bin/initwacom + +[Install] +WantedBy=graphical-session.target diff --git a/.local/bin/initwacom b/.local/bin/initwacom new file mode 100755 index 0000000..bedde58 --- /dev/null +++ b/.local/bin/initwacom @@ -0,0 +1,30 @@ +#!/bin/bash + +for i in $(seq 10); do + if xsetwacom list devices | grep -q Wacom; then + break + fi + sleep 1 +done + +list=$(xsetwacom list devices) +pad=$(echo "${list}" | awk '/pad/{print $8}') +stylus=$(echo "${list}" | awk '/stylus/{print $8}') +eraser=$(echo "${list}" | awk '/eraser/{print $8}') + +if [ -z "${pad}" ]; then + exit 0 +fi + +xsetwacom set "${stylus}" MapToOutput DisplayPort-1 +xsetwacom set "${eraser}" MapToOutput DisplayPort-1 + +xsetwacom set "${stylus}" Area "0 0 31496 17716" +xsetwacom set "${eraser}" Area "0 0 31496 17716" + +xsetwacom set "${pad}" Button 11 "key +ctrl z -ctrl" +xsetwacom set "${pad}" Button 10 "key +shift" +xsetwacom set "${pad}" Button 9 "key +ctrl" +xsetwacom set "${pad}" Button 1 "button +15" +#xsetwacom set "${pad}" Button 4 "key 0xffad" +#xsetwacom set "${pad}" Button 4 "button +5" diff --git a/.local/bin/setup/maptool b/.local/bin/setup/maptool index e69de29..2df7b69 100755 --- a/.local/bin/setup/maptool +++ b/.local/bin/setup/maptool @@ -0,0 +1,4 @@ +#! /bin/bash + +# Scale up the GUI by 2 times for HiDPI screens +sed -i '/\[JavaOptions\]/a -Dsun.java2d.uiScale=2' /opt/maptool/lib/app/MapTool.cfg diff --git a/.local/bin/setup/wacom b/.local/bin/setup/wacom index e69de29..b007500 100755 --- a/.local/bin/setup/wacom +++ b/.local/bin/setup/wacom @@ -0,0 +1,5 @@ +#! /bin/bash + +tee /etc/udev/rules.d/99-wacom.rules <