screen autorotation and touchscreen matrix in almost any operating environment ubuntu. In my case, I tested on LXQT
Link to githab -
https://github.com/scadl/autorotate-linuxFrom the author of the script - Alexandr scadl
Very sumple script for automaticaly rotating your screen with gyroscope
This is a small tweak script, without which the possibilities of a transformer laptop are actually useless when working on most Debian Linux. Relying on various documentation and examples, managed to write a simple script that tracks the position of the laptop gyroscope via the monitor-sensor (from the IIO-SENSOR-Proxy package), and finding the change of its status through the InotifyWait (from the package of the Inotify-Tools), applies a series of commands to The Xorg (XRANDR) graphic server and the touchscreen matrix (XInput). As a result, it turns out correctly reacting to the change in the position of a laptop or a tablet running Linux.
This script is tested and used on the Dell Inspiron 13 (5378), under the control of Linux kUbuntu 18.04. It is with this device is taken the name of touchscreen, the first parameter passed to the team xinput in the body of the script.
If you do not have touch screen, use a shortened version AutoRotate_noTouch.SH script.
If there is - use basic AutoRotate.SH, but change the name of the touchscreen in quotes after xinput team.
If you do not know what it is, not izmenyate coordinates of the matrix! (This tsiferki at the end of each rotation of the team)
0. If not done before, we do
transformation matrix correction . How do you know you need to do it or not. Run Ubuntu c flash no installation, and the system itself. Or on your tablet you have Ubuntu Desktop environment or Gnome Sell, the pereklyuichitsya him. If everything is correct rotates when you turn the tablet into a different position, then make correction, the transformation matrix is ​​not necessary.
1. For the success of the process, you must first configure the touchscreen work in this guide -
Setting TouchScreen-on on the tablet Irbis_TW78
2. In the best tradition of making the terminal one by one the following commands:
Then install the following packages, if you are not installed:
This package should already be installed if you performed 1 point, well navsyaky case leave the team immediately.
sudo apt-get install iio-sensor-proxy
sudo apt-get install inotify-tools
3. Download the script on githabe (link at the beginning of the post) or here
AutoRotate.zip (844 bytes)
And otkyvaem script from a text editor. We find an inscription
ELAN Touchscreen and replaces it with the name of the sensor (select / copy / find / replace all the values), which can be found by typing in the terminal
In my case -
Silead GSLx680 Touchscreen
AutoRotate - Silead GSLx680 Touchscreen.zip (820 bytes)
#! / bin / sh
# Auto rotate screen based on device orientation
# Receives input from monitor-sensor (part of iio-sensor-proxy package)
# Screen orientation and launcher location is set based upon accelerometer position
# Launcher will be on the left in a landscape orientation and on the bottom in a portrait orientation
# This script should be added to startup applications for the user
# Clear sensor.log so it does not get too long over time
>sensor.log
# Launch monitor-sensor and store the output in a variable that can be parsed by the rest of the script
monitor-sensor>>sensor.log 2>&1 &
# Parse output or monitor sensor to get the new orientation whenever the log file is updated
# Possibles are: normal, bottom-up, right-up, left-up
# Light data will be ignored
while inotifywait -e modify sensor.log; do
# Read the last line that was added to the file and get the orientation
ORIENTATION = $ (tail -n 1 sensor.log | grep 'orientation' | grep -oE '[^] + $')
# Set the actions to be taken for each possible orientation
case "$ ORIENTATION" in
normal)
xrandr -o normal && xinput set-prop "Silead GSLx680 Touchscreen" --type = float "Coordinate Transformation Matrix" 0 0 0 0 0 0 0 0 0 ;;
bottom-up)
xrandr -o inverted && xinput set-prop "Silead GSLx680 Touchscreen" --type = float "Coordinate Transformation Matrix" -1 0 1 0 -1 1 0 0 1 ;;
right-up)
xrandr -o right && xinput set-prop "Silead GSLx680 Touchscreen" --type = float "Coordinate Transformation Matrix" 0 1 0 -1 0 1 0 0 1 ;;
left-up)
xrandr -o left && xinput set-prop "Silead GSLx680 Touchscreen" --type = float "Coordinate Transformation Matrix" 0 -1 1 1 0 0 0 0 1 ;;
esac
done
4. Run the script.
In some working environments it can be done by double-clicking on the script file. The author of the script file extension called zaklavnymi letters "SH", in this state, the script itself will not start. It is necessary to translate the extension to lowercase to looked - Navanie_skripta.sh. We click the right mouse button on the script, and open the "Properties" / "authorization". Tick ​​the "Make executable".
Important!!! If you transferred the file rasshienie to lowercase, then in the console Komad below, the need to write an extension to lowercase.In that way it can be done - it is necessary to do the following - go to the folder where the script is, in my case:
Making the script executable:
Run it:
5. I should think:
5.1. how to add the script to autostart, so it starts with the start of the desktop manager of choice (water and password to login to the desktop).
5.2. It would be nice to come up with how to slow down the script to be able to fix the shield in position. In ubuntu-desktop and gnome-shell, you can disable autorotation, I would like to do the same.
In ubuntu-desktop and gnome-shell is not true, because there are standard things on the screen and turn the matrix, need only podkorektirovat correct position of the matrix. I wrote about this here -
tyk.
5.3. I would like to make gestures to work in other environments besides heavy ubuntu-desktop and gnome-shell, such as LXQT. It is possible to configure the touchpad gestures through touchegg, but I have not yet figured out how to do it - if we can do, make sure you accomplish your goal.
P.S. If anyone can help with the implementation of paragraph 5 - I will be glad and always complemented this statement.
Post has been editedNarovchatus - 20.04.20, 12:40