cutiepi-rotation-scripts/bin/cutiepi-screen-common

39 lines
1.1 KiB
Text
Raw Normal View History

2022-01-27 00:59:07 +01:00
#!/bin/bash
# Ensure that the display variable is set
2022-02-08 23:58:20 +01:00
[ -z "$DISPLAY" ] && export DISPLAY=:0
2022-01-27 00:59:07 +01:00
screen_rotation() {
cur_rotation=$(xrandr --query --verbose | grep DSI-1 | cut -d ' ' -f 5)
echo $cur_rotation
}
2022-02-08 23:58:20 +01:00
touchscreen_id() {
xinput | grep -i 'Capacitive TouchScreen' | grep pointer | sed -r -e 's/.*id=([0-9]+).*/\1/'
}
2022-01-27 00:59:07 +01:00
screen_set_horizontal() {
xrandr --output DSI-1 --rotate left
2022-02-08 23:58:20 +01:00
touch_id=$(touchscreen_id)
xinput set-prop $touch_id "Coordinate Transformation Matrix" 0 -1 1 1 0 0 0 0 1
2022-01-27 00:59:07 +01:00
}
screen_set_vertical() {
xrandr --output DSI-1 --rotate normal
2022-02-08 23:58:20 +01:00
touch_id=$(touchscreen_id)
xinput set-prop $touch_id "Coordinate Transformation Matrix" 1 0 0 0 1 0 0 0 1
2022-01-27 00:59:07 +01:00
}
screen_set_horizontal_inverted() {
xrandr --output DSI-1 --rotate right
2022-02-08 23:58:20 +01:00
touch_id=$(touchscreen_id)
xinput set-prop $touch_id "Coordinate Transformation Matrix" 0 1 0 -1 0 1 0 0 1
2022-01-27 00:59:07 +01:00
}
screen_set_vertical_inverted() {
xrandr --output DSI-1 --rotate inverted
2022-02-08 23:58:20 +01:00
touch_id=$(touchscreen_id)
xinput set-prop $touch_id "Coordinate Transformation Matrix" -1 0 1 0 -1 1 0 0 1
2022-01-27 00:59:07 +01:00
}