LINUX: Successful Screen rotation & correct touch points via scripts

Anyone who has installed Linux on their Hi10X will know that auto screen rotation does not work and when you manually rotate the display to landscape you will find that the touch points are not reflective of this new rotation.

I have successfully created two scripts that you can create desktop or panel shortcuts to that will simply rotate the display either to portrait mode or landscape mode instantly, but more importantly the touch points will reflect the rotation you have switched to.

It works fantastic under Linux Mint.
I know Its not ideal and that auto screen rotation would be better, that aside, my only gripe is “press & hold” (right click) is non existent but its better than nothing right?
EDIT: I had some success with adding right click/press & hold by installing the program “Touch Egg”, but after I installed that it screwed up the Applications Menu button (start menu), I was unable to press on it, it was like it didn’t exist.
The preinstalled keyboard named “Onboard” in Linux Mint has a key that allows for right clicks

you touch that key so it appears pressed, then your next touch on the screen will be a right click.

I will now write everything I did in Linux mint for the less Linux savvy


here is a zip file that contains the scripts and some shortcut icons
Orientation.zip

right click in a folder and create two new files called Landscape.sh and Portrait.sh
( I created these in /home/user/Documents/Scripts/Orientation )

open Landscape.sh in a text editor and cut and paste the following into that file:-
#!/bin/sh
#landscape
xrandr -o right
xinput set-prop "GXTP7386:00 27C6:011A" --type=float "Coordinate Transformation Matrix" 0 1 0 -1 0 1 0 0 1
xinput set-prop "GXTP7386:00 27C6:011A Stylus" --type=float "Coordinate Transformation Matrix" 0 1 0 -1 0 1 0 0 1

save and exit the file.

open Portrait.sh in a text editor and cut and paste the following into that file:-
#!/bin/sh
#portrait
xrandr -o normal
xinput set-prop "GXTP7386:00 27C6:011A" --type=float "Coordinate Transformation Matrix" 0 0 0 0 0 0 0 0 0
xinput set-prop "GXTP7386:00 27C6:011A Stylus" --type=float "Coordinate Transformation Matrix" 0 0 0 0 0 0 0 0 0

save and exit the file.

right click on the folder /home/user/Documents/Scripts/Orientation and select open in terminal
( or the folder where your new .sh files are)
type the following into the terminal and press enter:-
chmod 777 *.sh

NOTE:
chmod on a file (your scripts) only means, that you’ll make it executable.

you can now create shortcuts to these scripts on the desktop, a panel or under the apps menu.
simply click on the shortcuts to switch orientations.

I also created some keyboard shortcuts:-
System Settings > Keyboard > Shortcuts Tab > Custom Shortcuts > Add custom shortcut:-
I set Name to Landscape
I set Command to /home/user/Documents/Scripts/Orientation/landscape.sh
clicked on Add
clicked on Keyboard Bindings:Unassigned > Set the hotkeys to Ctrl + L

I set Name to Portrait
I set Command to /home/user/Documents/Scripts/Orientation/portrait.sh
clicked on Add
clicked on Keyboard Bindings:Unassigned > Set hotkeys to Ctrl + P

*** REBOOT PC FOR SHORTCUTS TO TAKE EFFECT ***

Display the login screen in Landscape mode:-
open the file /home/user/Desktop/lightdm/lightdm.conf.d/70-linuxmint.conf as ROOT by typing the following into the terminal:-
sudo xed /home/user/Desktop/lightdm/lightdm.conf.d/70-linuxmint.conf

I added the following line to the end of the file,
but make sure it is under the “[SeatDefaults]” section:

display-setup-script=/bin/bash "/home/user/Documents/Scripts/Orientation/landscape.sh"

My 70-linuxmint.conf file now looks like this:-
[SeatDefaults]
user-session=cinnamon
display-setup-script=/bin/bash "/home/user/Documents/Scripts/Orientation/landscape.sh"

To make the login screen bigger I did the following:
system settings > Administration:Login Window > Settings Tab > Changed HiDPI Support to On
( Default was Auto )

FOR FURTHER INFO:





2 Likes

It works perfectly! Thanks!
My touchscreen is ‘Goodix Capacitive TouchScreen’
OS: MX-19.2_x64 patito feo

1 Like

Hello my Chuwi hi10 xr Fyde OS is working. But no auto rotation. And video playing on youtube or facebook are rasterize like old television.