# uint23/sxwm architecture

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

- Interactive diagram: https://gitdiagram.com/uint23/sxwm
- Repository: https://github.com/uint23/sxwm

## Overview

sxwm is a configurable X11 tiling window manager. A user starts it as an X session; it loads configuration, manages client windows, and provides window/workspace controls. The implementation concentrates most runtime behavior in sxwm.c, with parsing and shared state split into parser.c and common.h. The README points to default_sxwmrc for the complete feature and option list, but its contents were not provided, so those capabilities are represented only at the configuration level. Some subsystem boundaries and event-loop details are therefore necessarily broad.

Main entry points: [`sxwm.c`](https://github.com/uint23/sxwm/blob/master/sxwm.c) (Window manager runtime), [`parser.c`](https://github.com/uint23/sxwm/blob/master/parser.c) (Config parser), [`common.h`](https://github.com/uint23/sxwm/blob/master/common.h) (Config and WM state), [`utils.c`](https://github.com/uint23/sxwm/blob/master/utils.c) (Logging and errors)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_configuration["Configuration"]
  node_configfile["Default configuration"]
  node_parser["Config parser<br/>[parser.c]"]
  node_configstate["Config and WM state<br/>[common.h]"]
  node_parser_api["Parser declarations<br/>[parser.h]"]
end

subgraph group_runtime["Window management"]
  node_sxwm["Window manager runtime<br/>[sxwm.c]"]
  node_windowcontrol["Window controls<br/>[sxwm.c]"]
  node_workspaces["Workspaces and clients<br/>[sxwm.c]"]
  node_layout["Tiling and placement<br/>[sxwm.c]"]
  node_xprotocol["X11 and EWMH<br/>[sxwm.c]"]
end

subgraph group_support["Runtime support"]
  node_logging["Logging and errors<br/>[utils.c]"]
  node_utility_api["Runtime declarations<br/>[utils.h]"]
end

node_user(("User"))
node_xserver["X server"]
node_clients["X applications"]

node_user -->|"starts session"| node_sxwm
node_configfile -.->|"provides settings"| node_parser
node_sxwm -->|"loads configuration"| node_parser
node_parser -->|"fills settings"| node_configstate
node_sxwm -->|"uses shared state"| node_configstate
node_parser -->|"reports parse issues"| node_logging
node_sxwm -->|"reports runtime issues"| node_logging
node_sxwm -->|"opens display"| node_xserver
node_clients -.->|"create windows"| node_xserver
node_xserver -.->|"delivers window events"| node_sxwm
node_sxwm -->|"manages windows"| node_xserver
node_sxwm -->|"manages clients"| node_workspaces
node_sxwm -->|"arranges clients"| node_layout
node_sxwm -->|"handles controls"| node_windowcontrol
node_windowcontrol -->|"changes workspace state"| node_workspaces
node_windowcontrol -->|"updates placement"| node_layout
node_xprotocol -->|"reads window properties"| node_xserver
node_sxwm -->|"uses error and log API"| node_utility_api
node_parser -.->|"implements parser API"| node_parser_api

click node_sxwm "https://github.com/uint23/sxwm/blob/master/sxwm.c"
click node_configfile "https://github.com/uint23/sxwm/blob/master/default_sxwmrc"
click node_parser "https://github.com/uint23/sxwm/blob/master/parser.c"
click node_configstate "https://github.com/uint23/sxwm/blob/master/common.h"
click node_windowcontrol "https://github.com/uint23/sxwm/blob/master/sxwm.c"
click node_workspaces "https://github.com/uint23/sxwm/blob/master/sxwm.c"
click node_layout "https://github.com/uint23/sxwm/blob/master/sxwm.c"
click node_xprotocol "https://github.com/uint23/sxwm/blob/master/sxwm.c"
click node_logging "https://github.com/uint23/sxwm/blob/master/utils.c"
click node_utility_api "https://github.com/uint23/sxwm/blob/master/utils.h"
click node_parser_api "https://github.com/uint23/sxwm/blob/master/parser.h"

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_configfile,node_parser,node_configstate,node_parser_api,node_user toneBlue
class node_sxwm,node_windowcontrol,node_workspaces,node_layout,node_xprotocol toneAmber
class node_logging,node_utility_api,node_xserver toneMint
class node_clients toneIndigo
```

## Components

### Configuration

- [Default configuration](https://github.com/uint23/sxwm/blob/master/default_sxwmrc): `default_sxwmrc`
- [Config parser](https://github.com/uint23/sxwm/blob/master/parser.c): `parser.c`
- [Config and WM state](https://github.com/uint23/sxwm/blob/master/common.h): `common.h`
- [Parser declarations](https://github.com/uint23/sxwm/blob/master/parser.h): `parser.h`

### Window management

- [Window manager runtime](https://github.com/uint23/sxwm/blob/master/sxwm.c): `sxwm.c`
- [Window controls](https://github.com/uint23/sxwm/blob/master/sxwm.c): `sxwm.c`
- [Workspaces and clients](https://github.com/uint23/sxwm/blob/master/sxwm.c): `sxwm.c`
- [Tiling and placement](https://github.com/uint23/sxwm/blob/master/sxwm.c): `sxwm.c`
- [X11 and EWMH](https://github.com/uint23/sxwm/blob/master/sxwm.c): `sxwm.c`

### Runtime support

- [Logging and errors](https://github.com/uint23/sxwm/blob/master/utils.c): `utils.c`
- [Runtime declarations](https://github.com/uint23/sxwm/blob/master/utils.h): `utils.h`

### Other components

- **User**
- **X server**
- **X applications**

## Connections

- User → Window manager runtime: starts session (evidence: `README.md`)
- Default configuration → Config parser: provides settings
- Window manager runtime → Config parser: loads configuration (evidence: `sxwm.c`)
- Config parser → Config and WM state: fills settings (evidence: `parser.c`)
- Window manager runtime → Config and WM state: uses shared state (evidence: `sxwm.c`)
- Config parser → Logging and errors: reports parse issues (evidence: `parser.c`)
- Window manager runtime → Logging and errors: reports runtime issues (evidence: `sxwm.c`)
- Window manager runtime → X server: opens display (evidence: `sxwm.c`)
- X applications → X server: create windows
- X server → Window manager runtime: delivers window events
- Window manager runtime → X server: manages windows (evidence: `sxwm.c`)
- Window manager runtime → Workspaces and clients: manages clients (evidence: `sxwm.c`)
- Window manager runtime → Tiling and placement: arranges clients (evidence: `sxwm.c`)
- Window manager runtime → Window controls: handles controls (evidence: `sxwm.c`)
- Window controls → Workspaces and clients: changes workspace state (evidence: `sxwm.c`)
- Window controls → Tiling and placement: updates placement (evidence: `sxwm.c`)
- X11 and EWMH → X server: reads window properties (evidence: `sxwm.c`)
- Window manager runtime → Runtime declarations: uses error and log API (evidence: `sxwm.c`)
- Config parser → Parser declarations: implements parser API (evidence: `parser.c`)
