{"id":25519601,"url":"https://github.com/amhoba/usb-mouse-touchpad-click-toggle","last_synced_at":"2026-05-07T07:40:26.487Z","repository":{"id":262132519,"uuid":"886299181","full_name":"amhoba/usb-mouse-touchpad-click-toggle","owner":"amhoba","description":"Utility python app to toggle touchpad tap-to-click functionality based on USB mouse connection/disconnection.","archived":false,"fork":false,"pushed_at":"2024-11-12T18:19:09.000Z","size":126,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-14T17:58:29.437Z","etag":null,"topics":["automation","input-devices","linux","python","tap-to-click","touchpad","usb-mouse","xinput"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/amhoba.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-10T17:47:11.000Z","updated_at":"2024-11-12T18:19:12.000Z","dependencies_parsed_at":"2024-11-10T18:39:46.300Z","dependency_job_id":"0a502d4b-656c-4193-8510-503aa46561ea","html_url":"https://github.com/amhoba/usb-mouse-touchpad-click-toggle","commit_stats":null,"previous_names":["amhoba2014/usb-mouse-touchpad-click-toggle","amhoba/usb-mouse-touchpad-click-toggle"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amhoba%2Fusb-mouse-touchpad-click-toggle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amhoba%2Fusb-mouse-touchpad-click-toggle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amhoba%2Fusb-mouse-touchpad-click-toggle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amhoba%2Fusb-mouse-touchpad-click-toggle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amhoba","download_url":"https://codeload.github.com/amhoba/usb-mouse-touchpad-click-toggle/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239699580,"owners_count":19682575,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","input-devices","linux","python","tap-to-click","touchpad","usb-mouse","xinput"],"created_at":"2025-02-19T17:20:21.790Z","updated_at":"2025-12-21T07:30:16.024Z","avatar_url":"https://github.com/amhoba.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# USB Mouse Touchpad Click Toggle\n\nThis project provides a Python script that automatically enables or disables the touchpad's tap-to-click functionality based on whether a USB mouse is connected. When a USB mouse is connected, tap-to-click on the touchpad is disabled to avoid accidental clicks. When the mouse is disconnected, tap-to-click is re-enabled for ease of use.\n\nThe script runs in the background, checking every second for the status of the USB mouse and adjusting the touchpad's click behavior accordingly.\n\n![terminal window](./misc/screenshot.png \"Terminal\")\n\n## Features\n\n- Detects when a USB mouse is connected or disconnected.\n- Disables tap-to-click functionality on the touchpad when a USB mouse is connected.\n- Re-enables tap-to-click functionality when the USB mouse is disconnected.\n- Runs continuously, checking the mouse connection status every second.\n\n## Requirements\n\n- **Linux** operating system (tested on Ubuntu/Debian-based systems).\n- **Python 3** (tested with Python 3.10.12).\n- **xinput**: A utility to configure and manage input devices (used for managing touchpad and pointer device settings).\n- **poetry**: A dependency manager and tool for packaging Python projects (used for managing project dependencies and environment).\n\n## Installation\n\n1. Clone this repository to your local machine:\n\n   ```bash\n   git clone https://github.com/amhoba2014/usb-mouse-touchpad-click-toggle\n   cd usb-mouse-touchpad-click-toggle\n   ```\n\n2. Install the required dependencies:\n\n   ```bash\n   poetry install\n   ```\n\n3. **Initial Setup**: The first time you run the script, it will automatically perform setup if the `.env` file is not present. This setup will guide you through selecting your USB mouse and touchpad devices and the specific property used to toggle tap-to-click functionality. Once completed, this configuration will be saved to a `.env` file for future use.\n\n4. Run the main script:\n\n   ```bash\n   poetry run python main.py\n   ```\n\n## Usage\n\n### Automatic Setup\n\nIf the `.env` file is not found when the script is run, the setup process will be triggered automatically. This will guide you through the following steps:\n\n- **Select USB Mouse Device**: Choose the USB mouse from a list of connected pointer devices.\n- **Select Touchpad Device**: Choose the touchpad device.\n- **Select Tap-to-Click Property**: Choose the property that enables or disables tap-to-click functionality on the touchpad.\n\nThese selections will be saved in the `.env` file for future runs.\n\n### Running the Script\n\nAfter the initial setup, run `main.py` as shown above. The script will monitor the USB mouse connection and automatically toggle the touchpad tap-to-click functionality:\n\n- If the USB mouse is connected, tap-to-click on the touchpad is **disabled**.\n- If the USB mouse is disconnected, tap-to-click is **enabled**.\n\nYou can stop the script by pressing `CTRL + C` in the terminal.\n\n## Restarting Setup Process\n\nIf you wish to manually retrigger the setup process, you can remove the `.env` file and run the script again:\n\n```bash\nrm .env\npoetry run python main.py\n```\n\nThis script will guide you through selecting the devices and properties needed for configuration again and the `.env` file will be created accordingly.\n\n## Todo\n\nEnhance the script to handle device events by actively listening for USB mouse connection and disconnection events. This improvement would eliminate the need for polling and repeatedly parsing the xinput device list.\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.\n\n## Contributing\n\nContributions are welcome! Feel free to fork the repository, make your changes, and submit a pull request.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famhoba%2Fusb-mouse-touchpad-click-toggle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famhoba%2Fusb-mouse-touchpad-click-toggle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famhoba%2Fusb-mouse-touchpad-click-toggle/lists"}