The Fat Controller
TFC is a library for simulating mouse and keyboard events. This library was built for use by TFC-server, a server that allows for remote control of a PC via a mobile app.
Features
- Mouse clicks
- Mouse motion (relative and absolute)
- Mouse scrolling (smooth scrolling where supported)
- Key presses
- Translating Unicode characters to key presses
- Typing arbitrary Unicode strings
- Getting the mouse position
- Getting the size of the screen
Platforms
- Linux - With X11
- Linux - Without X11
- macOS
- Windows
Linux
There are two implementations for Linux, one that uses X11, and one that depends only on the Linux kernel. The implementation that doesn't use X11 is missing some features. It is intended for Wayland but Wayland is a bit more locked down compared to X11, hence the missing features.
Before using the X11 implementation, the X11, XTest and xkbcommon development
libraries need to be installed. Using apt
, the following snippet can be used.
sudo apt install libx11-dev libxtst-dev libxkbcommon-dev
The non-X11 implementation uses /dev/uinput
. Before this can be used,
permissions need to be granted. The following snippet can be used.
sudo sh -c 'echo -e "KERNEL==\"uinput\", MODE=\"0666\"" >> /etc/udev/rules.d/50-uinput.rules'
Usage
Add the following to your Cargo.toml
:
[]
= "0.4"
Example
use ;
use ;