#!/bin/bash # # waCalibrate.sh: recalibrates the wacom stylus # # Author: Rogan Creswick # License: just be nice # # Calibrates the wacom devices {stylus, eraser, cursor} with the # given offsets: # # Usage: # calibrate # function calibrate { xsetwacom --display :0.0 set stylus TopX $1 xsetwacom --display :0.0 set stylus TopY $2 xsetwacom --display :0.0 set stylus BottomX $3 xsetwacom --display :0.0 set stylus BottomY $4 xsetwacom set eraser TopX $1 xsetwacom set eraser TopY $2 xsetwacom set eraser BottomX $3 xsetwacom set eraser BottomY $4 xsetwacom set cursor TopX $1 xsetwacom set cursor TopY $2 xsetwacom set cursor BottomX $3 xsetwacom set cursor BottomY $4 } function fixCalibration { # get the current orientation: ORIENTATION=`xrandr --verbose --query | grep " connected" | awk '{print $5}'` case "${ORIENTATION}" in normal) calibrate -3 -173 24518 18478 ;; left) calibrate -46 -3 18605 24518 ;; right) calibrate -173 58 18478 24579 ;; inverted) calibrate 58 -46 24579 18605 ;; *) echo "ERROR!! unknown orientation!" ;; esac } case "$1" in resume|thaw) fixCalibration # ( sleep 5; fixCalibration )& date >> /home/rogue/resume_or_thaw.txt echo $DISPLAY >> /home/rogue/resume_or_thaw.txt ;; *) date >> /home/rogue/events.txt ;; esac