PalmControl is a desktop application designed to enable mouse-free computer operation using a camera. It is capable of capturing and interpreting hand gestures and facial movements in real-time, converting them into local mouse events. This provides users with a novel and intuitive way to interact with their computers.
The application is built with a modular and extensible architecture, prioritizing performance and user experience. It features a switchable backend for computer vision tasks, allowing users to balance between processing speed and recognition accuracy by choosing a CPU-bound or a GPU-accelerated engine.
- Gesture-based Input Emulation:
- Mouse Control: Smooth, low-latency cursor movement mapped to hand or head position.
- Click Events: Differentiates between left and right-click gestures (e.g., finger pinch vs. V-sign).
- Scrolling: Vertical scrolling controlled by hand gestures.
- System Integration:
- System Tray Icon: Runs unobtrusively in the background. The tray icon provides essential controls to start/stop recognition, open the settings panel, and exit the application.
- Cross-Platform Autostart: A toggle in the settings panel configures the application to launch automatically at system startup. This is handled gracefully across Windows, macOS, and Linux.
- Configuration and Customization:
- Modern GUI: A clean, user-friendly settings panel built with
customtkinterallows for easy adjustment of all parameters. - Engine Selection: Switch between the
mediapipe(CPU) andgpu(placeholder) recognizer backends. - Camera Selection: If multiple cameras are present, the user can select the desired input source.
- Sensitivity Tuning: Adjust the sensitivity of cursor movement to match user preference.
- Persistent Settings: All user configurations are saved to a
config.jsonfile and are automatically loaded on startup.
- Modern GUI: A clean, user-friendly settings panel built with
The application is composed of several key modules:
main.py: The entry point of the application. It initializes all components, manages the application lifecycle, and handles threading for the camera feed and system tray.app_gui.py: Manages thecustomtkinter-based graphical user interface, including the settings window and all its interactive components.config_manager.py: A robust utility for reading from and writing to theconfig.jsonfile, ensuring that user settings persist across sessions.input_controller.py: Handles the translation of normalized coordinates from the recognizer into OS-level mouse and keyboard events usingpyautogui.autostart_manager.py: An OS-aware module that abstracts the logic for enabling or disabling the application's auto-launch on system startup.recognizers/:__init__.py: Makes the directory a Python package.mediapipe_recognizer.py: The default, CPU-efficient recognition engine powered by Google's MediaPipe framework. It performs hand tracking and basic gesture recognition.gpu_recognizer.py: A placeholder module designed for a more powerful, custom-trained, GPU-accelerated model. It provides a clear interface for developers to integrate their own deep learning models (e.g., PyTorch, TensorFlow).
- Python 3.8 or newer
- A connected webcam, accessible by the OS
-
Clone the repository:
git clone https://github.com/your-username/PalmControl.git cd PalmControl -
Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate`
-
Install dependencies from
requirements.txt:pip install -r requirements.txt
Execute the main script from the project root:
python main.pyTo show the GUI on startup, even if start_silently is enabled, use the --show flag:
python main.py --showPyInstaller can be used to package the application into a single executable file for distribution.
-
Install PyInstaller:
pip install pyinstaller
-
Run the build command for your OS:
Windows:
pyinstaller --noconfirm --onefile --windowed --add-data "icon.png;." --add-data "config.json;." --name "PalmControl" main.py
macOS:
pyinstaller --noconfirm --onefile --windowed --add-data "icon.png:." --add-data "config.json:." --hidden-import="pystray._darwin" --name "PalmControl" main.py
Linux:
pyinstaller --noconfirm --onefile --windowed --add-data "icon.png:." --add-data "config.json:." --name "PalmControl" main.py
The resulting executable will be placed in the
dist/directory.
We welcome contributions to improve PalmControl. If you wish to contribute, please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bug fix (
git checkout -b feature/your-feature-name). - Commit your changes with clear, descriptive messages.
- Push your changes to the branch (
git push origin feature/your-feature-name). - Open a pull request against the
mainbranch.
This project is licensed under the MIT License. See the LICENSE file for more details.