# anishnimma/tabswipe architecture

> Architecture diagram of the GitHub repository anishnimma/tabswipe, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/anishnimma/tabswipe
- Repository: https://github.com/anishnimma/tabswipe

## Overview

TabSwipe is a Windows utility for switching between adjacent application windows with a three-finger precision-touchpad swipe. Its main workflow monitors touchpad input, resolves current and neighboring windows, presents captured window images in a DirectComposition overlay, then commits the switch or animates back on release. The tray menu also manages startup and exit. The graph includes the documented capture/rendering capabilities; some internal wiring is supported only by declarations or the README because not all implementation excerpts were provided.

Main entry points: [`src/Input/TouchpadGestureMonitor.cpp`](https://github.com/anishnimma/tabswipe/blob/main/src/Input/TouchpadGestureMonitor.cpp) (Gesture monitor), [`src/Core/App.cpp`](https://github.com/anishnimma/tabswipe/blob/main/src/Core/App.cpp) (App and message loop), [`src/Rendering/OverlayRenderer.cpp`](https://github.com/anishnimma/tabswipe/blob/main/src/Rendering/OverlayRenderer.cpp) (Overlay renderer), [`src/Core/WindowManager.cpp`](https://github.com/anishnimma/tabswipe/blob/main/src/Core/WindowManager.cpp) (Window selection and commit)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application lifecycle"]
  node_app["App and message loop<br/>[App.cpp]"]
end

subgraph group_input["Touchpad input"]
  node_hid_monitor["Gesture monitor"]
  node_raw_monitor["Raw touchpad monitor"]
  node_input_manager["Pointer input manager<br/>[InputManager.cpp]"]
  node_gesture_machine["Gesture state machine"]
end

subgraph group_switch["Window switching"]
  node_window_manager["Window selection and commit<br/>[WindowManager.cpp]"]
  node_keyboard["Keyboard emulator"]
end

subgraph group_presentation["Capture and presentation"]
  node_renderer["Overlay renderer"]
  node_capture["Window capture<br/>[WindowCapture.cpp]"]
end

node_user(("Touchpad user"))
node_windows["Windows desktop"]

node_user -->|"swipes"| node_hid_monitor
node_app -->|"initializes"| node_hid_monitor
node_app -->|"initializes"| node_renderer
node_app -->|"routes input"| node_hid_monitor
node_app -->|"ticks animation"| node_renderer
node_hid_monitor -.->|"resolves windows"| node_window_manager
node_hid_monitor -.->|"controls gesture"| node_renderer
node_window_manager -->|"enumerates and activates"| node_windows
node_renderer -->|"owns captures"| node_capture
node_capture -->|"captures frames"| node_windows
node_input_manager -.->|"provides swipe updates"| node_gesture_machine
node_keyboard -.->|"emulates shortcuts"| node_windows

click node_app "https://github.com/anishnimma/tabswipe/blob/main/src/Core/App.cpp"
click node_hid_monitor "https://github.com/anishnimma/tabswipe/blob/main/src/Input/TouchpadGestureMonitor.cpp"
click node_raw_monitor "https://github.com/anishnimma/tabswipe/blob/main/src/Input/TouchpadMonitor.cpp"
click node_input_manager "https://github.com/anishnimma/tabswipe/blob/main/src/Input/InputManager.cpp"
click node_gesture_machine "https://github.com/anishnimma/tabswipe/blob/main/src/Gesture/GestureStateMachine.cpp"
click node_window_manager "https://github.com/anishnimma/tabswipe/blob/main/src/Core/WindowManager.cpp"
click node_keyboard "https://github.com/anishnimma/tabswipe/blob/main/src/Automation/KeyboardEmulator.cpp"
click node_renderer "https://github.com/anishnimma/tabswipe/blob/main/src/Rendering/OverlayRenderer.cpp"
click node_capture "https://github.com/anishnimma/tabswipe/blob/main/src/Capture/WindowCapture.cpp"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_user toneBlue
class node_hid_monitor,node_raw_monitor,node_input_manager,node_gesture_machine toneAmber
class node_window_manager,node_keyboard toneMint
class node_renderer,node_capture toneRose
class node_windows toneIndigo
```

## Components

### Application lifecycle

- [App and message loop](https://github.com/anishnimma/tabswipe/blob/main/src/Core/App.cpp): `src/Core/App.cpp`

### Touchpad input

- [Gesture monitor](https://github.com/anishnimma/tabswipe/blob/main/src/Input/TouchpadGestureMonitor.cpp): `src/Input/TouchpadGestureMonitor.cpp`
- [Raw touchpad monitor](https://github.com/anishnimma/tabswipe/blob/main/src/Input/TouchpadMonitor.cpp): `src/Input/TouchpadMonitor.cpp`
- [Pointer input manager](https://github.com/anishnimma/tabswipe/blob/main/src/Input/InputManager.cpp): `src/Input/InputManager.cpp`
- [Gesture state machine](https://github.com/anishnimma/tabswipe/blob/main/src/Gesture/GestureStateMachine.cpp): `src/Gesture/GestureStateMachine.cpp`

### Window switching

- [Window selection and commit](https://github.com/anishnimma/tabswipe/blob/main/src/Core/WindowManager.cpp): `src/Core/WindowManager.cpp`
- [Keyboard emulator](https://github.com/anishnimma/tabswipe/blob/main/src/Automation/KeyboardEmulator.cpp): `src/Automation/KeyboardEmulator.cpp`

### Capture and presentation

- [Overlay renderer](https://github.com/anishnimma/tabswipe/blob/main/src/Rendering/OverlayRenderer.cpp): `src/Rendering/OverlayRenderer.cpp`
- [Window capture](https://github.com/anishnimma/tabswipe/blob/main/src/Capture/WindowCapture.cpp): `src/Capture/WindowCapture.cpp`

### Other components

- **Touchpad user**
- **Windows desktop**

## Connections

- Touchpad user → Gesture monitor: swipes (evidence: `README.md`)
- App and message loop → Gesture monitor: initializes (evidence: `src/Core/App.cpp`)
- App and message loop → Overlay renderer: initializes (evidence: `src/Core/App.cpp`)
- App and message loop → Gesture monitor: routes input (evidence: `src/Core/App.cpp`)
- App and message loop → Overlay renderer: ticks animation (evidence: `src/Core/App.cpp`)
- Gesture monitor → Window selection and commit: resolves windows
- Gesture monitor → Overlay renderer: controls gesture
- Window selection and commit → Windows desktop: enumerates and activates (evidence: `src/Core/WindowManager.cpp`)
- Overlay renderer → Window capture: owns captures
- Window capture → Windows desktop: captures frames (evidence: `README.md`)
- Pointer input manager → Gesture state machine: provides swipe updates
- Keyboard emulator → Windows desktop: emulates shortcuts
