# nuxil/alttabmod architecture

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

- Interactive diagram: https://gitdiagram.com/nuxil/alttabmod
- Repository: https://github.com/nuxil/alttabmod
- Video tour (about a minute): https://gitdiagram.com/nuxil/alttabmod/video

## Overview

AltTabMod is a small Windows utility that relocates the Alt+Tab switcher and selected application to the monitor under the mouse. The README documents Explorer event hooks and the movement rules; the sampled C excerpts show monitor detection, event callbacks, and window positioning. The excerpts are partial, so startup and callback wiring beyond those documented behaviors is summarized rather than expanded into unsupported details.

Main entry points: [`main.c`](https://github.com/nuxil/alttabmod/blob/main/main.c) (Window event handling)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_lifecycle["Startup and hooks"]
  node_startup["Program startup<br/>[main.c]"]
  node_event_hooks["Event hooks<br/>[main.c]"]
  node_event_handler["Window event handling<br/>[main.c]"]
end

subgraph group_monitoring["Monitor targeting"]
  node_monitor_detection["Monitor detection<br/>[main.c]"]
  node_mouse_target["Mouse monitor selection<br/>[main.c]"]
end

subgraph group_movement["Window relocation"]
  node_switcher_move["Switcher positioning<br/>[main.c]"]
  node_app_move["Selected app positioning<br/>[main.c]"]
end

node_user(("User"))
node_windows["Windows APIs"]
node_explorer["Explorer shell"]

node_user -->|"presses Alt+Tab"| node_explorer
node_startup -->|"enumerates monitors"| node_windows
node_startup -->|"initializes hooks"| node_event_hooks
node_event_hooks -->|"hooks events"| node_explorer
node_explorer -->|"dispatches events"| node_event_handler
node_event_handler -->|"queries displays"| node_monitor_detection
node_monitor_detection -->|"reads cursor and displays"| node_windows
node_event_handler -->|"selects target"| node_mouse_target
node_event_handler -->|"handles switcher events"| node_switcher_move
node_event_handler -->|"handles switch events"| node_app_move
node_switcher_move -->|"positions window"| node_windows
node_app_move -->|"moves selected window"| node_windows

click node_startup "https://github.com/nuxil/alttabmod/blob/main/main.c"
click node_event_hooks "https://github.com/nuxil/alttabmod/blob/main/main.c"
click node_event_handler "https://github.com/nuxil/alttabmod/blob/main/main.c"
click node_monitor_detection "https://github.com/nuxil/alttabmod/blob/main/main.c"
click node_mouse_target "https://github.com/nuxil/alttabmod/blob/main/main.c"
click node_switcher_move "https://github.com/nuxil/alttabmod/blob/main/main.c"
click node_app_move "https://github.com/nuxil/alttabmod/blob/main/main.c"

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_startup,node_event_hooks,node_event_handler,node_user toneBlue
class node_monitor_detection,node_mouse_target toneAmber
class node_switcher_move,node_app_move,node_windows toneMint
class node_explorer toneIndigo
```

## Components

### Startup and hooks

- [Program startup](https://github.com/nuxil/alttabmod/blob/main/main.c): `main.c`
- [Event hooks](https://github.com/nuxil/alttabmod/blob/main/main.c): `main.c`
- [Window event handling](https://github.com/nuxil/alttabmod/blob/main/main.c): `main.c`

### Monitor targeting

- [Monitor detection](https://github.com/nuxil/alttabmod/blob/main/main.c): `main.c`
- [Mouse monitor selection](https://github.com/nuxil/alttabmod/blob/main/main.c): `main.c`

### Window relocation

- [Switcher positioning](https://github.com/nuxil/alttabmod/blob/main/main.c): `main.c`
- [Selected app positioning](https://github.com/nuxil/alttabmod/blob/main/main.c): `main.c`

### Other components

- **User**
- **Windows APIs**
- **Explorer shell**

## Connections

- User → Explorer shell: presses Alt+Tab
- Program startup → Windows APIs: enumerates monitors
- Program startup → Event hooks: initializes hooks
- Event hooks → Explorer shell: hooks events
- Explorer shell → Window event handling: dispatches events
- Window event handling → Monitor detection: queries displays
- Monitor detection → Windows APIs: reads cursor and displays
- Window event handling → Mouse monitor selection: selects target
- Window event handling → Switcher positioning: handles switcher events
- Window event handling → Selected app positioning: handles switch events
- Switcher positioning → Windows APIs: positions window
- Selected app positioning → Windows APIs: moves selected window
