#!/usr/bin/env bash FILE=/tmp/calibration XSETWACOM=/usr/bin/xsetwacom function store_value() { value=`$XSETWACOM --display :0.0 get $1 $2` echo "$XSETWACOM --display :0.0 set $1 $2 $value" >> $FILE } # Store calibration of all devices function store_devices_calibration() { >$FILE store_value "stylus" "TopX" store_value "stylus" "TopY" store_value "stylus" "BottomX" store_value "stylus" "BottomY" chmod +x $FILE } # Store calibration of all devices function restore_devices_calibration() { if [[ -e $FILE ]] then ( sleep 2; $FILE )& fi } MODE=$1 case "$MODE" in hibernate|suspend) store_devices_calibration ;; thaw|resume) restore_devices_calibration ;; *) exit $NA ;; esac