Rotate 90 degrees to the left
xinput set-prop 13 'Coordinate Transformation Matrix' 0 -1 0 1 0 0 0 0 1
xrandr -o left
Rotate 90 degrees to the right
xinput set-prop 13 'Coordinate Transformation Matrix' 0 1 0 -1 0 0 0 0 1
xrandr -o right
180 degree rotation
xinput set-prop 13 'Coordinate Transformation Matrix' -1 0 0 0 -1 0 0 0 1
xrandr -o inverted
Return to 0 degrees
xinput set-prop 13 'Coordinate Transformation Matrix' 1 0 0 0 1 0 0 0 1
xrandr -o normal
In the above command, 13
is rewritten to the device id of each terminal.
The device id can be confirmed with the xinput
command as shown below.
kinomi@pop-os:xinput
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ SynPS/2 Synaptics TouchPad id=13 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Power Button id=6 [slave keyboard (3)]
↳ Video Bus id=7 [slave keyboard (3)]
↳ Power Button id=8 [slave keyboard (3)]
↳ Sleep Button id=9 [slave keyboard (3)]
↳ Topre Corporation HHKB Professional id=10 [slave keyboard (3)]
↳ HD Webcam: HD Webcam id=11 [slave keyboard (3)]
↳ MSI WMI hotkeys id=14 [slave keyboard (3)]
↳ AT Translated Set 2 keyboard id=12 [slave keyboard (3)]
1 0 0 0 1 0 0 0 1
Rewrite the part
This represents a matrix
When the rotation angle is 0
| 1 0 0 |
| 0 1 0 |
| 0 0 1 |
In the case of θ rotation counterclockwise,
| cosθ -sinθ 0 |
| sinθ cosθ 0 |
| 0 0 1 |
Rewrite to cos -sin 0 sin cos 0 0 0 1
Affine transformation (https://en.wikipedia.org/wiki/%E3%82%A2%E3%83%95%E3%82%A3%E3%83%B3%E5%86% 99% E5% 83% 8F)
Recommended Posts