Files
anode/docs/ARCHITECTURE.md
T

29 lines
3.3 KiB
Markdown
Raw Normal View History

# ANODE Architecture
## Component Map
- `Makefile` & `scripts/detect-env.sh`: Strict `.POSIX:` single build orchestration probing OS headers, `-lcrypt` vs `<crypt.h>`, `-lrt`, `-lutil`, `XScrnSaver`, and optional `gtk+-2.0`/`tcl`/`tk` headers cleanly into `build/flags.sh`.
- `src/common/`: Cross-Unix platform layer (`anode_plat.c`, `anode_plat.h`), `.Xresources` / EDID fractional scale helpers (`anode_scale.h`), input validators (`anode_dns_valid.h`, `anode_tz_valid.h`), CLI output parsers (`anode_audio_parse.h`, `anode_wifi_list.h`, `anode_bt_list.h`), and power policy (`anode_power_policy.h`).
- `src/dwm/`, `src/dmenu/`, `src/st/`: Patched suckless X11 core using Pango/HarfBuzz (`Fira Code` ligatures), `.Xresources` + `SIGUSR1` live reload, and `anode_scale.h`.
- `src/libgemui/`: Shared library `libgemui.so` + `gemui.pc` providing double-buffered Cairo + Pango rendering, workarea-clamped responsive window sizing, hit tracking, touch-mode sizing (`gemui_touch_row_px`), self-pipe `SIGUSR1` + root `XA_RESOURCE_MANAGER` live reload, and non-blocking `poll()` loops.
- `src/apps/`: Desktop control panels and optional dock virtual keyboard (`anode-vkbd`) + multimedia dispatcher (`anode-media-key`).
- `src/daemons/`: Zero-poll `poll()` + signal self-pipe daemons (`anode-statusd`, `anode-touchd`, `anode-powerd`) and narrowly-scoped privilege helpers (`anode-power-ctl`, `anode-dnsctl`, `anode-tzctl`, `anode-checkpw`).
- `src/gtkTtk/`: Tk/Ttk native GTK-2 bridge (`libgtkTtk0.9.so` + `gtkTtk.tcl`) supporting full `[0.5, 4.0]` fractional scaling.
- `data/` & `scripts/`: 22 96-DPI `.xth` themes and strict POSIX `/bin/sh` synchronization scripts.
## Fractional DPI Multi-Toolkit Contract
For a user or EDID-detected scale `S` clamped to `[0.50, 4.00]`:
- `Xft.dpi = round(96 * S)`
- `ANODE_SCALE = S`, `theme.baseFontSize = round(15 * S)`
- **GTK-3 / GTK-4 / xsettingsd**: `GDK_SCALE = (S < 1.75) ? 1 : round(S)`, `GDK_DPI_SCALE=1.0`, `ADW_DISABLE_PORTAL=1`, and `Gdk/WindowScalingFactor = GDK_SCALE` in `xsettingsd.conf` (**`Xft/DPI` is intentionally omitted** so GTK3 never double-scales).
- **Qt5 / Qt6**: `QT_AUTO_SCREEN_SCALE_FACTOR=0`, `QT_ENABLE_HIGHDPI_SCALING=1`, `QT_SCALE_FACTOR_ROUNDING_POLICY=PassThrough`, `QT_SCALE_FACTOR=S`, `QT_FONT_DPI=96`, with synced palettes in both `~/.config/qt5ct/` and `~/.config/qt6ct/`.
- **Tk / Tkinter (`gtkTtk`)**: `*TkTheme: gtkTtk`, Tk scaling normalized against `ANODE_SCALE` / `Xft.dpi`, using `Fira Code`.
## First-Class Systray & EWMH Workarea Struts
In `src/dwm/dwm.c`:
1. Acquires screen-specific `_NET_SYSTEM_TRAY_S<screen>` using a 32-bit ARGB `TrueColor` visual (when available, falling back cleanly to screen default visual) and publishes `_NET_SYSTEM_TRAY_VISUAL` and `_NET_SYSTEM_TRAY_ORIENTATION = 0`.
2. Tracks XEmbed `_XEMBED_INFO` flags bit `data[1]` (`XEMBED_MAPPED`), preserves `SubstructureNotifyMask`, emits `XEMBED_WINDOW_ACTIVATE` / `XEMBED_WINDOW_DEACTIVATE (2)`, unmaps the tray window when empty (`0` mapped icons), undocks cleanly on `ReparentNotify`/`UnmapNotify`/`DestroyNotify`, centers & re-scales icons on `SIGUSR1` / `XA_RESOURCE_MANAGER`, and relocates cleanly across monitors.
3. Monitors `_NET_WM_WINDOW_TYPE_DOCK` windows (`_NET_WM_STRUT_PARTIAL` / `_NET_WM_STRUT`), including `override_redirect` docks such as `anode-vkbd`, adjusting monitor workarea bounds (`wx, wy, ww, wh`) and publishing root `_NET_WORKAREA`.