mirror of
https://github.com/lilymonad/touchscreen-remapper.git
synced 2026-04-28 08:51:59 +00:00
Utility to map touchscreen inputs to their screen. Useful with multiple touchscreens attached.
- Rust 71.7%
- Nix 28.3%
| src | ||
| .gitignore | ||
| Cargo.lock | ||
| Cargo.toml | ||
| flake.lock | ||
| flake.nix | ||
| README.md | ||
Touchscreen Remapper
A Rust application using Iced GUI framework to map touch devices to monitors in a multi-monitor setup.
Features
- Detects all connected screens using xrandr
- Lists touch input devices using xinput
- Allows mapping touch devices to specific screens
- Simple GUI interface with Iced
Requirements
- Rust (latest stable version)
- X11 environment with xrandr and xinput
- Touchscreen devices connected
Installation
- Clone this repository
- Install dependencies:
cargo build --release
Usage
-
Run the application:
./target/release/touchscreen-remapper -
The application will show a list of connected screens
-
Click on the screen you want to map a touch device to
-
Touch the screen when prompted
-
The application will detect the touch device and map it to the selected screen
How It Works
- Screen Detection: Uses
xrandrto list all connected monitors - Touch Detection: Uses
xinput test-xi2 --rootto capture RawTouch events and parse device IDs - Mapping: Uses
xinput map-to-outputto directly map the touch device to the selected screen output
Implementation Notes
- The application uses shell commands (
xrandr,xinput) instead of direct X11 library calls - Uses the simple
xinput map-to-outputapproach for reliable device-to-screen mapping - Touch event listening is simulated in this basic implementation
- For a production version, you would need to implement proper touch event listening using libinput or evdev
Limitations
- This is a basic implementation that demonstrates the concept
- Real touch event detection would require additional implementation
- Currently uses simulated touch devices when xinput is not available
Future Improvements
- Implement proper touch event listening with libinput/evdev
- Add proper screen dimension parsing
- Implement accurate coordinate transformation calculations
- Add error handling and user feedback
- Support for multiple touch devices
- Configuration persistence