config

Personal configuration.
git clone git://code.dwrz.net/config
Log | Files | Refs

rotate (993B)


      1 #!/usr/bin/env bash
      2 
      3 rotate() {
      4   matrix=$1
      5   devices=(
      6     'Wacom Pen and multitouch sensor Finger'
      7     'Wacom Pen and multitouch sensor Pen Pen (0x80210820)'
      8     'Wacom Pen and multitouch sensor Pen Eraser (0x80210820)'
      9   )
     10 
     11   for device in "${devices[@]}"; do
     12     if xinput list | grep -q "$device"; then
     13       xinput set-prop "$device" 'Coordinate Transformation Matrix' "${matrix}"
     14     fi
     15   done
     16 }
     17 
     18 monitor-sensor | while read -r line; do
     19   if [[ $line == *"orientation changed: left-up"* ]]; then
     20     xrandr --output eDP-1 --rotate left
     21     rotate "0 -1 1 1 0 0 0 0 1"
     22   elif [[ $line == *"orientation changed: right-up"* ]]; then
     23     xrandr --output eDP-1 --rotate right
     24     rotate "0 1 0 -1 0 1 0 0 1"
     25   elif [[ $line == *"orientation changed: bottom-up"* ]]; then
     26     xrandr --output eDP-1 --rotate inverted
     27     rotate "-1 0 1 0 -1 1 0 0 1"
     28   elif [[ $line == *"orientation changed: normal"* ]]; then
     29     xrandr --output eDP-1 --rotate normal
     30     rotate "1 0 0 0 1 0 0 0 1"
     31   fi
     32 done