A modular Python-based gesture recognition tool for Sway/SwayFX
Project description
Swaystroke PoC
A modular Python-based gesture recognition tool for Sway/SwayFX (using GTK Layer Shell and i3ipc).
Architecture
config.py: Settings like the trigger button.gesture.py: Handles point data and normalization.gui.py: Native GTK3 Layer Shell overlay for drawing gestures.storage.py: Manages saving and loading gestures togestures.json.recognizer.py: Compares new gestures against stored templates.focus.py: Usesi3ipcto find and focus the correct window under the mouse before executing commands.main.py: Entry point for recording, listening, and debugging.visualizer.py: Imported comparison tool to see gesture matches.
Prerequisites
- Python 3
python-i3ipc,python-gi,python-xlib,pycairogtk-layer-shelllibrary
Usage
Record a gesture
swaystroke record [--global] [--app-id ID] [--app-class CLASS] [--get-app-id-or-class] <name> [command]
Click and drag to draw your gesture in the transparent overlay. Options:
--global: Record the gesture to be available globally.--app-id ID: Bind the gesture to a specific Wayland application ID.--app-class CLASS: Bind the gesture to a specific XWayland window class.--get-app-id-or-class: Automatically get the app ID or class from the window under the gesture.
If no options are provided, it defaults to a global gesture.
Listen for gestures
swaystroke listen
Draw your gesture. The tool will identify the window under your starting point, focus it, and run the command.
List gestures
swaystroke list
swaystroke list-gui
Show all recorded gestures either in an ASCII table or a scrollable graphical window.
Show a specific gesture
swaystroke show "close"
Open the visualizer to display the recorded path for a specific gesture.
Delete a gesture
swaystroke delete "close"
Delete a recorded gesture by its name.
Debug gestures
swaystroke debug
Draw a gesture to see a side-by-side comparison with the closest match.
Generate config
swaystroke generate-config
Generate the default configuration file in the config directory.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file swaystroke-0.0.1.tar.gz.
File metadata
- Download URL: swaystroke-0.0.1.tar.gz
- Upload date:
- Size: 15.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e311941dfdd5c371de81838f79ae0da7a3a88c20767dd10da81d217b9ded357d
|
|
| MD5 |
55ba0b7c9166cd57142f5ac7ff82a13f
|
|
| BLAKE2b-256 |
3ce7123bb534dbff21a6a736cdc39231ca730faa8bc75100327aa4a081b8d6af
|
File details
Details for the file swaystroke-0.0.1-py3-none-any.whl.
File metadata
- Download URL: swaystroke-0.0.1-py3-none-any.whl
- Upload date:
- Size: 17.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
db7360c21a61ccd6fb7fba61cc7a10d96667dfcac3a72c7070c277d06fbfea6c
|
|
| MD5 |
ced02ae4ae9bd2c9ee57011597ef72a1
|
|
| BLAKE2b-256 |
85c7604c112df5917b0e3830a053b375ffadd17d66eeeb2671087324ebdcb3f3
|