This script provides a terminal interface to rotate the display and calibrate the touchscreen input matrix on Wayland and X11 environments automatically.
- Python 3
gnome-randr
andlibinput
(for Wayland)sudo
privileges for modifying udev rules- Users should be in the input group to avoid needing sudo for these operations
- optional
gdm-settings
for login screen
-
Install Python:
sudo apt-get install python3
-
Install Wayland Dependencies
sudo apt-get install libinput-tools
-
Install
gnome-randr
:gnome-randr
can be installed using Cargo, the Rust package manager. First, ensure you have Rust and Cargo installed. Follow the instructions at rust-lang.org, e.g.:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
- Once Rust and Cargo are installed, you can install
gnome-randr
by running:cargo install gnome-randr
-
Add User to the input group:
sudo usermod -a -G input USERNAME
-
Install Python:
sudo pacman -S python
-
Install Wayland Dependencies
sudo pacman -S libinput
-
Install
gnome-randr
:-
gnome-randr
can be installed using Cargo, the Rust package manager. First, ensure you have Rust and Cargo installed. Follow the instructions at rust-lang.org, e.g.:curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
-
Once Rust and Cargo are installed, you can install
gnome-randr
by running:cargo install gnome-randr
-
-
Add User to the input group:
sudo usermod -aG input USERNAME
Run the script using Python:
python3 gptouch.py
- The script checks for the required dependencies (
xrandr
,xinput
,gnome-randr
, andlibinput
). It determines the active display output based on the session type (X11 or Wayland).- It identifies the connected touchscreen device.
- It prompts the user to select the desired screen orientation.
- It applies the selected screen orientation.
- It updates the touchscreen calibration matrix and writes it to the udev rules, using
sudo
. - It prompts the user to reboot the system to apply the changes.
- 1: Landscape (normal)
- 2: Portrait (right side up)
- 3: Portrait (left side up)
- 4: Inverted (upside down)
- Users should be in the
input
group to avoid needingsudo
forlibinnput
. - The script requires
sudo
privileges to modify udev rules. - Use
gdm-settings
to apply rotation on login screen
- Dependency Errors: Ensure all required packages are installed.
- Display Not Found: Verify that your display is correctly connected and detected by the system.
- Touchscreen Device Not Found: Check the connections and ensure user is in input group.
This project is licensed under the MIT License.
gnome-randr
andlibinput
are used for Wayland display and input management.