mirror of
https://github.com/BlackLight/cutiepi-rotation-scripts.git
synced 2024-11-23 20:25:11 +01:00
Dynamically grab the touchscreen id
This commit is contained in:
parent
f341472c17
commit
a49f97c613
1 changed files with 13 additions and 5 deletions
|
@ -1,30 +1,38 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Ensure that the display variable is set
|
# Ensure that the display variable is set
|
||||||
export DISPLAY=:0
|
[ -z "$DISPLAY" ] && export DISPLAY=:0
|
||||||
|
|
||||||
screen_rotation() {
|
screen_rotation() {
|
||||||
cur_rotation=$(xrandr --query --verbose | grep DSI-1 | cut -d ' ' -f 5)
|
cur_rotation=$(xrandr --query --verbose | grep DSI-1 | cut -d ' ' -f 5)
|
||||||
echo $cur_rotation
|
echo $cur_rotation
|
||||||
}
|
}
|
||||||
|
|
||||||
|
touchscreen_id() {
|
||||||
|
xinput | grep -i 'Capacitive TouchScreen' | grep pointer | sed -r -e 's/.*id=([0-9]+).*/\1/'
|
||||||
|
}
|
||||||
|
|
||||||
screen_set_horizontal() {
|
screen_set_horizontal() {
|
||||||
xrandr --output DSI-1 --rotate left
|
xrandr --output DSI-1 --rotate left
|
||||||
xinput set-prop 11 "Coordinate Transformation Matrix" 0 -1 1 1 0 0 0 0 1
|
touch_id=$(touchscreen_id)
|
||||||
|
xinput set-prop $touch_id "Coordinate Transformation Matrix" 0 -1 1 1 0 0 0 0 1
|
||||||
}
|
}
|
||||||
|
|
||||||
screen_set_vertical() {
|
screen_set_vertical() {
|
||||||
xrandr --output DSI-1 --rotate normal
|
xrandr --output DSI-1 --rotate normal
|
||||||
xinput set-prop 11 "Coordinate Transformation Matrix" 1 0 0 0 1 0 0 0 1
|
touch_id=$(touchscreen_id)
|
||||||
|
xinput set-prop $touch_id "Coordinate Transformation Matrix" 1 0 0 0 1 0 0 0 1
|
||||||
}
|
}
|
||||||
|
|
||||||
screen_set_horizontal_inverted() {
|
screen_set_horizontal_inverted() {
|
||||||
xrandr --output DSI-1 --rotate right
|
xrandr --output DSI-1 --rotate right
|
||||||
xinput set-prop 11 "Coordinate Transformation Matrix" 0 1 0 -1 0 1 0 0 1
|
touch_id=$(touchscreen_id)
|
||||||
|
xinput set-prop $touch_id "Coordinate Transformation Matrix" 0 1 0 -1 0 1 0 0 1
|
||||||
}
|
}
|
||||||
|
|
||||||
screen_set_vertical_inverted() {
|
screen_set_vertical_inverted() {
|
||||||
xrandr --output DSI-1 --rotate inverted
|
xrandr --output DSI-1 --rotate inverted
|
||||||
xinput set-prop 11 "Coordinate Transformation Matrix" -1 0 1 0 -1 1 0 0 1
|
touch_id=$(touchscreen_id)
|
||||||
|
xinput set-prop $touch_id "Coordinate Transformation Matrix" -1 0 1 0 -1 1 0 0 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue