diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
new file mode 100644
index 0000000..d6c56cf
--- /dev/null
+++ b/.github/FUNDING.yml
@@ -0,0 +1 @@
+github: SumirSeth
diff --git a/.gitignore b/.gitignore
index 77cfa98..40d164e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,8 +1,6 @@
-*.exe
-# Research scratch: downloaded Microsoft PDBs and screenshots of the user's desktop
-trackpad/research/scratch-*/
-
+/target/
*.log
+*.exe
-# Local prototype leftovers (removed from the repo; see history before ef4e728)
-trackpad/
+# Local research and prototype files, kept out of the repository
+/trackpad/
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 928b5a5..2a337dc 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,47 +1,117 @@
# Contributing to Touch
-Thanks for helping! Touch is a small project, so the process is light.
+Thanks for helping. Bug reports, fixes, gesture ideas and features are all welcome.
-## Reporting bugs
+Every change on `main` should be easy to trace: what changed, why, who owns it, how it was checked and which release
+shipped it. The rules below serve that. They apply to everyone, the maintainer included.
-Open an [issue](https://github.com/SumirSeth/touch/issues/new/choose) with:
+## Building, not just coding
-- your Windows version (`winver`) and laptop / touchpad model
-- what you did, what you expected and what happened, and the steps to make it happen again
-- your `%APPDATA%\Touch\config.json` if the bug involves a specific binding
+> Building something has never been about writing code. When I say I built it, it means I have put effort, thought
+> and intention behind every single thing, and got Claude to write the code because it writes better code than almost
+> all humans do.
+>
+> — Sumir Seth, maintainer
-Touchpads report fingers differently from one model to another, so the hardware details matter.
+Touch is built in that spirit. A good change starts with a reason: a bug you hit, a gesture that felt wrong, an idea
+you thought through. The code serves that intention.
-## Suggesting gestures or actions
+## AI agents
-Open a feature request and describe the motion and what it should do. Gestures must not get in the way of normal
-pointing, scrolling and clicking. Proposals that explain how a gesture is told apart from ordinary use are the
-easiest to accept.
+AI agents are welcome. Use them as code writers, tinkerers and partners for ideas. Much of Touch is written this way.
-## Pull requests
+**You own what you submit.** The person who opens a pull request or makes a commit owns that change, whoever or
+whatever typed it. Be ready to explain it, defend it and fix it.
+
+- **Understand every line.** If you can't explain why a line is there, it isn't ready.
+- **Verify it.** Test a build with your change on a real touchpad, and write tests where they fit.
+- **Think it through.** Touchpads differ, so consider other sizes and reporting modes, Windows' own 3- and 4-finger
+ gestures, and normal pointing, scrolling and clicking, which must never get worse.
+
+Changes made end to end by an agent with no verifiable check, no real testing and no deliberate thought behind them
+are closed.
+
+## Before you start
+
+- **Bugs:** search the issues first. If it's new, open a bug report with your Windows version, your laptop and
+ touchpad model, and the steps to reproduce it.
+- **Features:** open a feature request first, and agree on the idea before you write code. Touch aims to be a small,
+ fast gesture tool. A new gesture has to be told apart from ordinary pointing, scrolling and clicking, so explain how.
+
+## Branches
+
+- Fork the repository and branch from `main`. Everyone works on branches; nobody pushes to `main`.
+- Name the branch after the change: `fix/…`, `feat/…`, `docs/…` or `perf/…`.
+- Keep it short-lived and rebased on `main`. Rebase rather than merging `main` into it.
+
+## Commits
+
+- **Summary line:** imperative, plain language, about 50 to 72 characters, written for users. "Read every finger on
+ touchpads that report several at once", not "fix bug" or "update platform.rs".
+- **Body:** why the change is needed and anything surprising about it. The diff already shows what changed.
+- **One logical change per commit.** Squash fixups such as "fix typo" or "address review" before the pull request is
+ merged.
+- **Honest authorship.** The author is the person who owns the change. Credit an AI that helped with a
+ `Co-Authored-By:` line.
+
+## Testing your change
+
+1. Quit the installed Touch from the tray. Only one copy runs at a time, and a second launch only opens the first
+ one's settings.
+2. Run your build with `cargo run -p touch`, or `cargo run -p touch --release`. Debug builds keep a console for logs.
+ To watch the engine alone, run `cargo run -p gestures_engine --example run`. It uses your saved bindings and **does
+ send keys**.
+3. Try the change on your touchpad, including the edge cases above. Check that pointing, scrolling and clicking still
+ feel the same.
+4. Gesture recognisers in `crates/engine/src/gestures.rs` are pure: frames in, events out. Add tests in
+ `crates/engine/tests/` that feed synthetic frames for new or changed gestures.
+5. Run the checks CI runs:
-1. Fork, create a branch, and keep the change focused.
-2. Make sure these pass (CI runs the same):
```powershell
cargo fmt --check
- cargo clippy --workspace -- -D warnings
- cargo test --workspace
+ cargo clippy --workspace --locked -- -D warnings
+ cargo test --workspace --locked
```
-3. Gesture recognisers in `crates/engine/src/gestures.rs` are pure (frames in, events out). Please add tests in
- `crates/engine/tests/` that feed synthetic frames for new or changed gestures.
-4. Test a build of the change on a real touchpad and say which one in the PR. Fill in the pull request template:
- what changed, why, how you verified it, and what you didn't test.
-5. Add a line under `Unreleased` in [CHANGELOG.md](CHANGELOG.md) for anything users notice.
-6. For UI changes, include a screenshot in light and dark themes.
-Pull requests are merged with rebase, so keep each commit message meaningful. Questions and ideas that aren't ready
-to be an issue go in [Discussions](https://github.com/SumirSeth/touch/discussions).
+## Performance
+
+Touch runs all day on the input path, so a change must not make it slower or heavier. For anything in the engine, the
+tray agent or startup, compare `main` with your branch on the same machine:
+
+- **Idle:** with the settings window closed, `touch.exe` should use no CPU and about 13 MB of memory. Check with Task
+ Manager or `Get-Process touch | Select-Object CPU, WorkingSet64` over a minute.
+- **During gestures:** no allocation or blocking work per touchpad report. Actions run on the worker thread, not the
+ input thread.
+- **Settings window:** it should open quickly, and the agent must stay unaffected while it's open.
+
+A regression needs a reason worth its cost; look for another way first.
+
+## Pull requests
+
+Every change reaches `main` through a pull request. The template asks for the following:
+
+- **One change** per pull request.
+- **A title that reads as a changelog line**, in plain language. Release notes list pull requests by title.
+- **What changed, why, and how you verified it.** Name the build you tested and your setup: laptop and touchpad model,
+ and Windows version. Include before and after numbers for anything that could affect speed or memory.
+- **What you didn't test**, so the reviewer knows where to look.
+- **The issue it fixes**, as `Fixes #123`.
+- **A changelog entry** under `Unreleased` in [CHANGELOG.md](CHANGELOG.md) for anything users notice. End it with the
+ pull request, your username and the issue it fixes, such as `(#34, by @you, fixes #33)`. The pull request number
+ exists only once it's open, so add it in a follow-up commit. Internal changes get the `skip-changelog` label
+ instead.
+- **Screenshots** in light and dark themes for changes to the settings window.
+
+A pull request merges once CI passes and a build with the change has been tested on a real touchpad. See
+[MAINTAINING.md](MAINTAINING.md) for how pull requests are reviewed and released. Design notes are in
+[`docs/app-spec.md`](docs/app-spec.md); keep it in sync when you change the engine API or the config format.
-Design notes are in [`docs/app-spec.md`](docs/app-spec.md). The engine API in that document is what the app depends
-on. Keep the two in sync when you change either.
+## Writing style
-## Releases
+Write code comments, docs, commit messages and UI text in plain, active language. Use short sentences. Name what the
+user sees and does. For example, write "The row lights up when you perform the gesture", not "Trigger events
+propagate a highlight state".
-How pull requests are reviewed and how releases are cut is in [MAINTAINING.md](MAINTAINING.md).
+## License
-By contributing you agree that your work is licensed under the [MIT License](LICENSE).
+By contributing, you agree that your contributions are licensed under the [MIT License](LICENSE).
diff --git a/Cargo.toml b/Cargo.toml
index d750bb1..1968ca0 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -7,6 +7,9 @@ exclude = ["app/vendor/gpui"]
version = "0.1.0"
edition = "2021"
license = "MIT"
+authors = ["Sumir Seth"]
+repository = "https://github.com/SumirSeth/touch"
+homepage = "https://github.com/SumirSeth/touch"
[profile.release]
opt-level = 3
diff --git a/README.md b/README.md
index 7b831e3..5a87dc5 100644
--- a/README.md
+++ b/README.md
@@ -1,68 +1,76 @@
-
-
-
+
+
+
-# Touch
+
Touch
-**Custom touchpad gestures for Windows.**
-Slide along an edge to change the volume, hold a corner to pause music, swipe with three fingers to switch tabs,
-and choose what every gesture does.
+
+ Custom touchpad gestures for Windows.
+
-[](https://github.com/SumirSeth/touch/actions/workflows/ci.yml)
-[](https://github.com/SumirSeth/touch/releases/latest)
-[](https://github.com/SumirSeth/touch/releases)
-[](LICENSE)
-
+
+Slide along an edge to change the volume, hold a corner to pause music, swipe with three fingers to switch tabs, and
+choose what every gesture does.
-## Why
+Windows gives Precision Touchpads a handful of fixed 3- and 4-finger gestures. Touch adds edges, corners, pinches and
+twists, and each of them can do whatever you like. Pointer movement, scrolling and clicks stay exactly as Windows
+does them.
-Windows gives Precision Touchpads a handful of fixed 3- and 4-finger gestures. Touch adds the rest: edges, corners,
-pinches and twists. Each one can do anything you like. It runs quietly in the tray, and pointer movement, scrolling
-and clicks stay exactly as Windows does them.
+Touch is one native Rust executable. It runs headless in the tray at about 13 MB and uses no CPU while idle. It has no
+telemetry and no network access.
## Features
-**Gestures**
+### Gestures
-| Gesture | Out of the box |
-|---|---|
-| Slide one finger along the **right / top / bottom / left edge** | brightness / volume / seek video / — |
-| **Hold** one finger still in a **corner** | top-left: play/pause, top-right: mute |
-| **3- and 4-finger swipes** up, down, left, right | — |
-| **3- and 4-finger taps** | — |
-| **4-finger twist** like a knob | volume |
+| Gesture | Default |
+| --- | --- |
+| Slide one finger along the **right / top / bottom / left edge** | Brightness / volume / seek video / none |
+| **Hold** one finger still in a **corner** | Top-left: play/pause. Top-right: mute |
+| **3- and 4-finger swipes** up, down, left, right | None |
+| **3- and 4-finger taps** | None |
+| **4-finger twist**, like turning a knob | Volume |
| **5-finger pinch** in / out | Task View |
-| **5-finger twist** clockwise / anticlockwise | reopen tab / close tab |
+| **5-finger twist** clockwise / anticlockwise | Reopen tab / close tab |
-**Actions**
+### Actions
- **Presets**: Task View, show desktop, switch or create virtual desktops, snap and minimise windows, Alt+Tab,
close/reopen/next/previous tab, back/forward, copy/paste/undo/redo, search, notifications, quick settings,
- screenshot, lock, File Explorer, media keys.
+ screenshot, lock, File Explorer and media keys.
- **Any keyboard shortcut**: record it by pressing the keys.
- **Launch an app or file**, or **open a URL**.
-- **Continuous controls** for edges and the twist: volume, brightness, seek, horizontal scroll, zoom, tabs, virtual
+- **Continuous controls** for edges and twists: volume, brightness, seek, horizontal scroll, zoom, tabs, virtual
desktops, or your own pair of shortcuts. Sensitivity and direction are adjustable.
-**Also**
+### Also
-- Native settings window rendered on the GPU with [GPUI](https://www.gpui.rs/). It follows your light/dark theme and
- accent colour.
-- A **Test** button for every action. The gesture's row lights up when you perform it, which is handy for learning
- the gestures.
-- Optional **3-finger drag**, pause from the tray, start with Windows.
-- Small and local: one native Rust executable with no telemetry and no network access. Settings are stored in a
- readable JSON file.
+- A native settings window drawn on the GPU with [GPUI](https://www.gpui.rs/). It follows your light or dark theme
+ and accent colour, and opens only when you ask for it.
+- A **Test** button for every action. A gesture's row lights up when you perform it, which helps when you're
+ learning the gestures.
+- Optional **3-finger drag**. From the tray you can pause gestures and turn on start with Windows.
+- Settings are a readable JSON file.
@@ -71,117 +79,128 @@ and clicks stay exactly as Windows does them.
## Install
-1. Download **`touch__x64-setup.exe`** from the [latest release](https://github.com/SumirSeth/touch/releases/latest)
- and run it. It installs for your user only, no administrator needed. An `.msi` is also available for managed
- installs.
-2. Touch opens its settings and puts an icon in the tray. Click the icon any time to come back. Right-click it for
+1. Download **`touch_X.Y.Z_x64-setup.exe`** from the [latest release](https://github.com/SumirSeth/touch/releases/latest)
+ and run it. It installs for your user only and doesn't need administrator rights. An `.msi` is available for
+ managed installs.
+2. Touch opens its settings and puts an icon in the tray. Click the icon to open settings again. Right-click it for
**Pause gestures**, **Start with Windows** and **Quit**.
> [!NOTE]
-> The installers aren't code-signed yet, so Microsoft Defender SmartScreen may show "Windows protected your PC".
-> Choose **More info → Run anyway**. You can check the download against the release's build log on GitHub
-> Actions, or [build it yourself](#build-from-source).
-
-**Requirements:** Windows 10 1809 or later (developed on Windows 11) and a
-Precision Touchpad, which
-most laptops from the last several years have. Check under *Settings → Bluetooth & devices → Touchpad*. If you see
-"Your PC has a precision touchpad", you're set.
+> Touch is not code-signed yet, so SmartScreen may say "Windows protected your PC". Select **More info → Run
+> anyway**. Each release lists `SHA256SUMS.txt`, and every installer is built by GitHub Actions from the tagged
+> commit.
-### Using 3- and 4-finger gestures
+**Requirements:** Windows 10 1809 or later, and a Precision Touchpad. Most laptops from the last several years have
+one. To check, open *Settings → Bluetooth & devices → Touchpad*. If it says "Your PC has a precision touchpad",
+you're set.
-Windows has its own 3- and 4-finger swipes and taps. **If you give one of those to Touch, set the matching Windows
-gesture to "Nothing"** under *Settings → Bluetooth & devices → Touchpad → Three-finger / Four-finger gestures*.
-Otherwise both will run. Touch shows a warning, with a button that opens that page, whenever this applies.
+> [!IMPORTANT]
+> Windows has its own 3- and 4-finger swipes and taps. If you give one of those to Touch, set the matching Windows
+> gesture to **Nothing** under *Settings → Bluetooth & devices → Touchpad → Three-finger / Four-finger gestures*.
+> Otherwise both run. Touch warns you when this applies, and the warning has a button that opens that page.
## FAQ
-Does Touch replace Windows' touchpad driver or hook into Explorer?
+Does Touch replace the touchpad driver or hook into Explorer?
-No. Touch only *listens* to the touchpad through the standard Raw Input API, alongside Windows. It performs actions
-by sending ordinary keystrokes (`SendInput`), opening things with `ShellExecute`, and setting brightness through
-WMI. It installs no drivers, hooks or DLL injection, and needs no admin rights.
+No. Touch only *listens* to the touchpad through the standard Raw Input API, alongside Windows. It acts by sending
+ordinary keystrokes (`SendInput`), opening things with `ShellExecute`, and setting brightness through WMI. It installs
+no drivers, hooks or injected DLLs, and needs no administrator rights.
A gesture does two things at once.
-Windows is also handling it. Set the Windows gesture for that finger count to "Nothing" (see above).
+Windows is handling it too. Set the Windows gesture for that finger count to **Nothing** (see above).
Edge slides don't trigger.
-Start the slide with the finger *landing* inside the edge strip (6 mm by default, adjustable under General), then
-move along the edge. Landing in the middle and moving to the edge is treated as normal pointer movement on purpose.
+Land your finger inside the edge strip, then slide along the edge. The strip is 6 mm wide by default; you can change
+it under General. Landing in the middle and moving to the edge counts as normal pointer movement on purpose.
+
+
+
+3-, 4- or 5-finger gestures don't fire, but edges and corners do.
+
+Some touchpads send every finger in one report, and 0.1.0 reads only the first finger. A fix is on its way. Until it
+ships, please [open an issue](https://github.com/SumirSeth/touch/issues/new/choose) with your laptop and touchpad
+model.
Brightness doesn't change.
-Brightness control works on built-in laptop panels that support WMI brightness. External monitors usually don't.
+Brightness works on built-in laptop screens that support WMI brightness. External monitors usually don't.
Seek doesn't work in my video player.
-Seek presses the Left/Right arrow keys, so the player window must have focus. YouTube, Netflix, VLC and most
-players use them to skip back and forward. For a player with different keys, use **Custom keys** instead.
+Seek presses the Left and Right arrow keys, so the player must have focus. YouTube, Netflix, VLC and most other
+players skip with those keys. For a player that uses other keys, choose **Custom keys**.
Where are my settings? How do I uninstall?
-Settings live in `%APPDATA%\Touch\config.json`. Uninstall from *Settings → Apps → Installed apps*. Delete that
+Settings live in `%APPDATA%\Touch\config.json`. Uninstall from *Settings → Apps → Installed apps*, then delete that
folder too if you want a clean slate.
## Build from source
-You need Windows 10/11 x64, [Rust](https://rustup.rs) (stable, MSVC toolchain) and the
+You need Windows 10 or 11 x64, [Rust](https://rustup.rs) (stable, MSVC) and the
[Visual Studio Build Tools](https://visualstudio.microsoft.com/visual-cpp-build-tools/) with the *Desktop development
-with C++* workload (including a Windows SDK).
+with C++* workload, including a Windows SDK.
```powershell
git clone https://github.com/SumirSeth/touch
cd touch
-cargo run -p touch # build and run (debug builds keep a console for logs)
-cargo test --workspace # gesture recognisers are tested on synthetic touch frames; no hardware needed
+cargo run -p touch # debug builds keep a console for logs
+cargo test --workspace # recognisers are tested on synthetic frames; no touchpad needed
```
+Quit an installed Touch from the tray first. Only one copy runs at a time, and a second launch only opens the first
+one's settings.
+
To build the installers (NSIS `.exe` and `.msi`, written to `target/installers/`):
```powershell
powershell -ExecutionPolicy Bypass -File app/scripts/package.ps1
```
-### Project layout
+### How it works
+
+`touch.exe` is a headless agent that holds the gesture engine and the tray icon. The settings window is the same
+executable started with `--settings`, and it exits when you close it. The engine registers for Precision Touchpad
+reports with `RIDEV_INPUTSINK` on its own thread. It turns each scan of the pad into a frame of contacts in
+millimetres and feeds it to pure recognisers. Their events go to an action worker, which carries them out.
```
-crates/engine/ gestures_engine: reads the touchpad (Raw Input + HID), recognises gestures, runs actions, config
-app/ touch.exe: the headless tray agent, and the GPUI settings window (--settings)
-app/vendor/gpui/ GPUI 0.2.2 with two small Windows patches (see PATCH.md there)
-docs/ design notes and screenshots
+crates/engine/ gestures_engine: touchpad input, gesture recognisers, actions, config
+app/ touch.exe: the tray agent, and the GPUI settings window (--settings)
+app/vendor/gpui/ GPUI 0.2.2 with small Windows patches (see PATCH.md)
+docs/ design notes and screenshots
```
-How it works: `touch.exe` runs as a small headless agent (the engine and the tray icon, about 13 MB, no CPU while
-idle). The settings window is the same executable started with `--settings`, and it exits when you close it. The engine registers for Precision Touchpad reports with `RIDEV_INPUTSINK` on its own thread. It
-rebuilds each scan of the pad into a frame of contacts in millimetres and feeds it to pure recognisers. Those emit
-events that an action worker carries out. See [`docs/app-spec.md`](docs/app-spec.md) for the full design.
+The full design is in [`docs/app-spec.md`](docs/app-spec.md).
## Roadmap
-Ideas, not promises. Open an issue if you want one of them:
+Ideas, not promises. Upvote or comment on an issue if you want one:
- Per-app gesture profiles
- Code-signed installers and a winget package
-- More gestures (2-finger edge swipes, double-taps on corners)
-- Lower idle memory when the settings window is closed
+- More gestures, such as 2-finger edge swipes and double taps in corners
## Contributing
-Bug reports, gesture ideas and pull requests are welcome. Please read [CONTRIBUTING.md](CONTRIBUTING.md) first. When
-reporting a bug, include your Windows version and laptop/touchpad model, because touchpads differ.
+Bug reports, gesture ideas and pull requests are welcome. Read [CONTRIBUTING.md](CONTRIBUTING.md) first. Questions go
+in [Discussions](https://github.com/SumirSeth/touch/discussions). Touchpads differ, so bug reports need your laptop and
+touchpad model.
## License
diff --git a/app/Cargo.toml b/app/Cargo.toml
index 702ba40..3a649e5 100644
--- a/app/Cargo.toml
+++ b/app/Cargo.toml
@@ -2,6 +2,10 @@
name = "touch"
version.workspace = true
edition = "2024"
+license.workspace = true
+authors.workspace = true
+repository.workspace = true
+description = "Custom touchpad gestures for Windows"
build = "build.rs"
[dependencies]
async-channel = "2"
diff --git a/app/vendor/gpui/PATCH.md b/app/vendor/gpui/PATCH.md
index 4298093..9f8478f 100644
--- a/app/vendor/gpui/PATCH.md
+++ b/app/vendor/gpui/PATCH.md
@@ -1,7 +1,7 @@
# GPUI provenance and local patch
This directory is the unmodified source distribution of crates.io gpui 0.2.2,
-except for the two changes below.
+except for the changes below.
`src/platform/windows/platform.rs`, `close_one_window`, has the final
expression `false` instead of `lock.is_empty()`.
diff --git a/assets/icon.svg b/assets/icon.svg
deleted file mode 100644
index 7d51520..0000000
--- a/assets/icon.svg
+++ /dev/null
@@ -1,4 +0,0 @@
-
diff --git a/crates/engine/Cargo.toml b/crates/engine/Cargo.toml
index 6f907b8..3de66ab 100644
--- a/crates/engine/Cargo.toml
+++ b/crates/engine/Cargo.toml
@@ -3,6 +3,9 @@ name = "gestures_engine"
version.workspace = true
edition.workspace = true
license.workspace = true
+authors.workspace = true
+repository.workspace = true
+description = "Precision Touchpad input, gesture recognition and actions for Touch"
[dependencies]
serde = { version = "1", features = ["derive"] }
diff --git a/crates/engine/README.md b/crates/engine/README.md
index fd2347a..405e12a 100644
--- a/crates/engine/README.md
+++ b/crates/engine/README.md
@@ -1,33 +1,35 @@
# gestures_engine
-Spec deviations: none in the Engine API or config JSON. `Action::None` is allowed
-on either trigger kind as an explicit unbinding. Invalid configurations (including
-semantic validation failures) are backed up and replaced with defaults just like
-malformed JSON. `AdjustTarget` is serialized within `Action` using the flat shape
-specified by the contract. The recognizers share a pure arbitration state machine
-rather than exposing one public type per prototype recognizer.
-
-`gestures::Recognizer` accepts complete `Frame`s with monotonic millisecond times
-and returns `GestureEvent`s. It never calls Windows. Coordinates and edge steps
-are millimetres; knob steps are degrees. Bindings are captured for each touch.
-A claimed touch stays claimed until every finger lifts. Three-finger drag disables
-three-finger taps and swipes. Pause, disabled config, device changes, window exit,
-and engine destruction release cursor clipping and the injected drag button.
-
-Raw input is received on an invisible top-level window using RIDEV_INPUTSINK.
-HID descriptor physical dimensions and units scale coordinates, and each device
-has independent hybrid-report assembly. Synthetic Microsoft HID RID devices are
-ignored. Raw input never suppresses Windows gestures; configure Windows' matching
-three/four finger gestures to Nothing. Registry conflict detection only reads.
-Actions run on a worker; queued brightness deltas are coalesced and WMI brightness
-is read again before writing to respect external changes. WMI is for built-in
-panels supporting WmiMonitorBrightness; failures are EngineEvent::Error.
-
-Run `cargo run -p gestures_engine --example run` for manual hardware testing.
-This uses saved bindings and **can inject keys**. Do not run while working.
-The automated tests use only synthetic frames and never inject input.
-
-Hardware verification still required: the ASUS hybrid descriptor/report stream,
-physical-unit scaling, lift reports, real button usages, ClipCursor interaction,
-SendInput behavior in target applications, brightness and registry conflicts.
-Windows owns normal pointer movement and scrolling throughout.
+The gesture engine behind Touch. It reads the touchpad, recognises gestures and carries out the actions bound to
+them. The `touch` app (`app/`) runs it in its tray agent. The contract between the two is in
+[`docs/app-spec.md`](../../docs/app-spec.md).
+
+## Layout
+
+| File | What it does |
+| --- | --- |
+| `src/platform.rs` | Windows input and actions. Registers for Precision Touchpad Raw Input with `RIDEV_INPUTSINK` on its own thread, parses HID reports into frames, and runs actions on a worker thread |
+| `src/gestures.rs` | Pure recognisers. Frames in, `GestureEvent`s out; it never calls Windows |
+| `src/actions.rs` | Parses keyboard shortcuts such as `Ctrl+Shift+T` |
+| `src/config.rs` | The config file, the triggers and action presets, defaults and validation |
+
+## How it behaves
+
+- Coordinates are millimetres, scaled from the HID descriptor's physical units. Edge steps are millimetres and knob
+ steps are degrees.
+- A touch picks its gesture once. It stays claimed until every finger lifts.
+- Three-finger drag turns off three-finger taps and swipes.
+- Raw input never blocks Windows' own gestures. Set Windows' matching 3- and 4-finger gestures to Nothing;
+ `windows_conflicts` reports which ones clash. Touch only reads the registry to find them.
+- Brightness uses WMI on built-in screens that support `WmiMonitorBrightness`. Queued steps are combined, and the
+ level is read again before each write so changes made elsewhere are respected. Failures arrive as
+ `EngineEvent::Error`.
+- An invalid config file is backed up and replaced with the defaults.
+- Pausing, disabling, device changes and shutdown release the cursor clip and the drag button.
+
+## Testing
+
+`cargo test -p gestures_engine` feeds synthetic frames to the recognisers. It never touches a device or sends input.
+
+`cargo run -p gestures_engine --example run` runs the engine on your touchpad with your saved bindings and prints its
+events. It **sends real keys**, so don't run it while you work.
diff --git a/docs/app-spec.md b/docs/app-spec.md
index ce70497..26311e6 100644
--- a/docs/app-spec.md
+++ b/docs/app-spec.md
@@ -1,14 +1,12 @@
# Touch: release app spec (v1)
-A small Windows 11 tray app that adds custom Precision Touchpad gestures and lets the user choose what each gesture
-does. It works alongside Windows' own touchpad handling (pointer, scrolling and clicks stay Windows'). No animation or
-overlay work: `trackpad/overlay`, `VirtualTouchpad.cs`, `OverlayLink.cs` and the 3-finger replay are not part of the
-release.
+A small Windows tray app that adds custom Precision Touchpad gestures and lets the user choose what each gesture does.
+It works alongside Windows' own touchpad handling: pointer movement, scrolling and clicks stay Windows'. It has no
+animations or overlays.
-The C# prototype (removed from the tree; see commit 0e3af09 in history, under `trackpad/gestures/`) was the reference implementation: raw-input decoding (`Touchpad.cs`),
-recognisers (`Gestures.cs`), brightness through WMI (`Brightness.cs`), key injection (`Native.cs`), tests
-(`test.ps1`). Background on why things are the way they are: `trackpad/research/`. Rule from the user: no third-party
-mods or hooks (no Windhawk etc.). Ordinary crates are fine.
+Touch started as a C# prototype (in history at commit 0e3af09, under `trackpad/gestures/`), which was the reference for
+raw-input decoding, the recognisers, WMI brightness and key injection. Touch uses no third-party shell mods, hooks or
+injected DLLs. Ordinary crates are fine.
Product name: **Touch** (repo `SumirSeth/touch`, versions x.y.z starting at 0.1.0; keep it in one place per file type:
the `PRODUCT_NAME` const in the app, the packager config, and the `APP_NAME` const in the engine).
@@ -134,7 +132,7 @@ fields are ignored; a file that fails to parse is renamed to `config.json.bad` a
}
```
-The above is exactly `default_config()` (today's prototype behaviour). Triggers missing from `bindings` are unbound.
+The above is exactly `default_config()` (the defaults a new install gets). Triggers missing from `bindings` are unbound.
Start-with-Windows is not in this file: it's the `HKCU\...\Run` value, owned by the app.
## Engine API (crate `gestures_engine`)