docs: document session switching, scaling, GTK theming, XDG launcher, status telemetry, and power policy

This commit is contained in:
Luxferre committed 2026-11-26 14:46:03 +02:00
1 parent 07d9134d2d
commit d351265623
5 files changed
+56 -33

No files matched your search

+11 -11
View File
@@ -5,12 +5,12 @@ ANODE is a lightweight, keyboard-first, cross-Unix X11 desktop environment for *
## Key features ## Key features
- **Patched window & core X11 stack**: - **Patched window & core X11 stack**:
- **DWM (`6.5-anode`)**: Pango/HarfBuzz status & title bar (`Fira Code` + `DejaVuSansM Nerd Font`), first-class 32-bit ARGB XEmbed systray (`_NET_SYSTEM_TRAY_S<screen>`, `XEMBED_INFO` state, empty-tray unmap, `ReparentNotify` undocking, multi-monitor relocation), EWMH dock struts (`_NET_WM_WINDOW_TYPE_DOCK`, `_NET_WM_STRUT_PARTIAL`, `_NET_WORKAREA`), per-tag/grid layouts (`[]=`, `[M]`, `><>`, `###`), clickable bar regions, `Super_L` quick-tap support, `ANODE WM` EWMH identity, ICCCM `WM_S<screen>` `--replace` handoff, `SIGHUP` live restart, and `SIGUSR1`/`XA_RESOURCE_MANAGER` live theme & DPI reload. - **DWM (`6.5-anode`)**: Pango/HarfBuzz status & title bar (`Fira Code` + `DejaVuSansM Nerd Font`) with a vector 3-bar launcher button (no Nerd Font icon dependency), first-class 32-bit ARGB XEmbed systray (`_NET_SYSTEM_TRAY_S<screen>`, `XEMBED_INFO` state, empty-tray unmap, `ReparentNotify` undocking, multi-monitor relocation), EWMH dock struts (`_NET_WM_WINDOW_TYPE_DOCK`, `_NET_WM_STRUT_PARTIAL`, `_NET_WORKAREA`), per-tag/grid layouts (`[]=`, `[M]`, `><>`, `###`), clickable bar regions, `Super_L` quick-tap support, `ANODE WM` EWMH identity, ICCCM `WM_S<screen>` `--replace` handoff, `SIGHUP` live restart, and `SIGUSR1`/`XA_RESOURCE_MANAGER` live theme & DPI reload with environment/cursor propagation.
- **dmenu (`5.3-anode`)**: Pango/HarfBuzz rendering, fuzzy matching, touch/pointer navigation, XFixes/XI2 pointer auto-hiding, dynamic `.Xresources` & fractional scale sizing. - **dmenu (`5.3-anode`)**: Pango/HarfBuzz rendering, fuzzy matching, touch/pointer navigation, XFixes/XI2 pointer auto-hiding, dynamic `.Xresources` & fractional scale sizing (`-l 0` full-height row fill and exact `-l N` row height), and `anode-launcher` XDG + Flatpak desktop entry integration (`--list`, symlinks, `[Desktop Action ...]` sub-entries, localization, `TryExec`, `Path=`, `Terminal=`, and `DBusActivatable=`).
- **st (`0.9.2-anode`)**: HarfBuzz programming ligatures (`Fira Code`), dirty-cell rendering cache, focus-gated cursor blink, `.Xresources` + `SIGUSR1` live reload, portable Linux/BSD PTY handling. - **st (`0.9.2-anode`)**: HarfBuzz programming ligatures (`Fira Code`), dirty-cell rendering cache, focus-gated cursor blink, explicit `St.font` override precedence with `~/.config/anode/Xresources.local`, live `Xft.dpi` Fontconfig resolution + `SIGUSR1` reload, and portable Linux/BSD PTY handling.
- **Unified `.xth` theme & fractional DPI scaling engine**: - **Unified `.xth` theme & fractional DPI scaling engine**:
- 22 normalized 96-DPI `.xth` themes (`data/themes/*.xth`) centered on `Fira Code` with ligatures. - 22 normalized 96-DPI `.xth` themes (`data/themes/*.xth`) centered on `Fira Code` with ligatures.
- `anode-apply-scale` & `anode-apply-theme` synchronize `.Xresources`, `xrdb`, `dwm`, `dmenu`, `st`, `libgemui`, `anode-vkbd`, `dunst`, GTK-2, GTK-3, GTK-4 / `libadwaita`, `xsettingsd`, Qt5 (`qt5ct`), Qt6 (`qt6ct`), Kvantum, and Tk (`gtkTtk`) without double-scaling. - `anode-apply-scale` & `anode-apply-theme` treat `scale.conf` as authoritative over stale session environment variables and synchronize `.Xresources`, `xrdb`, `dwm`, `dmenu`, `st`, `libgemui`, `anode-vkbd`, `dunst` (`scale = 1` + pixel font sizing), GTK-2, GTK-3, GTK-4 / `libadwaita` (built-in Adwaita/Default `resource:///...` inheritance with color-only overrides and dark/light auto-detection), `xsettingsd` (with discrete Xcursor size tiers), Qt5 (`qt5ct`), Qt6 (`qt6ct`), Kvantum, and Tk (`gtkTtk`) without double-scaling.
- **GemUI toolkit (`libgemui`) & desktop utilities**: - **GemUI toolkit (`libgemui`) & desktop utilities**:
- `anode-net`: Wi-Fi (`nmcli` / `wpa_cli` / BSD `ifconfig`), POSIX `getifaddrs` interfaces, Bluetooth (`bluetoothctl`), and DNS presets/custom nameservers (`anode-dnsctl`). - `anode-net`: Wi-Fi (`nmcli` / `wpa_cli` / BSD `ifconfig`), POSIX `getifaddrs` interfaces, Bluetooth (`bluetoothctl`), and DNS presets/custom nameservers (`anode-dnsctl`).
- `anode-audio`: PipeWire (`wpctl`), PulseAudio (`pactl`), ALSA (`amixer`), OpenBSD `sndioctl`, and OSS audio mixer & profile/stream control. - `anode-audio`: PipeWire (`wpctl`), PulseAudio (`pactl`), ALSA (`amixer`), OpenBSD `sndioctl`, and OSS audio mixer & profile/stream control.
@@ -18,17 +18,17 @@ ANODE is a lightweight, keyboard-first, cross-Unix X11 desktop environment for *
- `anode-datetime`: Live clock, NTP status (`chronyc`/`timedatectl`), IANA timezone search & setter (`anode-tzctl`). - `anode-datetime`: Live clock, NTP status (`chronyc`/`timedatectl`), IANA timezone search & setter (`anode-tzctl`).
- `anode-power`: Battery/AC telemetry (Linux sysfs, FreeBSD `sysctl`, OpenBSD `apm`), brightness & volume sliders, power profiles, utility launcher grid, and lock / suspend / hibernate / reboot / power off actions (`anode-power-ctl`). - `anode-power`: Battery/AC telemetry (Linux sysfs, FreeBSD `sysctl`, OpenBSD `apm`), brightness & volume sliders, power profiles, utility launcher grid, and lock / suspend / hibernate / reboot / power off actions (`anode-power-ctl`).
- `anode-themes`: Interactive `.xth` theme switcher with live color swatches and `Fira Code` ligature preview. - `anode-themes`: Interactive `.xth` theme switcher with live color swatches and `Fira Code` ligature preview.
- `anode-lock`: Fullscreen X11 screen locker with `anode-checkpw` (`shadow.h` / BSD `getpwnam`). - `anode-lock`: Fullscreen X11 screen locker with `anode-checkpw` (`shadow.h` / BSD `getpwnam`, `/sbin/unix_chkpwd` non-root fallback, and root-only `chmod 4755` installation in `Makefile`).
- `anode-media-key`: Multimedia key dispatcher for volume, mic mute, brightness, MPRIS/MPD/mpv media playback, screenshots, airplane toggle, suspend, and virtual keyboard toggling. - `anode-media-key`: Multimedia key dispatcher for volume, mic mute, brightness, MPRIS/MPD/mpv media playback, screenshots, airplane toggle, suspend, and virtual keyboard toggling.
- `anode-vkbd`: Optional EWMH dock multi-layer touch virtual keyboard (`QWERTY`, `Shift`, `Sym`, `Nav`) injecting XTest keystrokes without stealing focus. - `anode-vkbd`: Optional EWMH dock multi-layer touch virtual keyboard (`QWERTY`, `Shift`, `Sym`, `Nav`) injecting XTest keystrokes without stealing focus.
- **Zero-poll event daemons**: - **Event-driven status & policy daemons**:
- `anode-statusd`: `poll()` + self-pipe + XKB group/keymap events (text-only lowercase layout indicator left of datetime) + Linux `NETLINK_ROUTE` / BSD `PF_ROUTE` link watcher + minute-aligned timer. - `anode-statusd`: `poll()` + self-pipe + XKB group/keymap events (text-only lowercase layout indicator left of datetime) + CPU/RAM usage telemetry + minute-aligned timer.
- `anode-touchd`: XI2 multitouch edge-swipe gesture recognizer. - `anode-touchd`: XI2 multitouch edge-swipe gesture recognizer.
- `anode-powerd`: Idle dim / lock / suspend policy daemon (`XScreenSaverQueryInfo` when available). - `anode-powerd`: Idle dim / lock / suspend policy daemon (`XScreenSaverQueryInfo` when available; defaults `5 m` dim with `max(0.35, 45%)` floor, `10 m` lock, `30 m` battery suspend, `~/.config/anode/power.conf` overrides, and brightness restore on wake/exit).
- **gtkTtk 0.9 port**: - **gtkTtk 0.9 port**:
- Native GTK2-backed Ttk/Tkinter widget theme with full `[0.5, 4.0]` fractional DPI scaling and BSD library paths. - Native GTK2-backed Ttk/Tkinter widget theme with full `[0.5, 4.0]` fractional DPI scaling and BSD library paths.
- **Session-specific autostart**: - **Session-specific autostart**:
- `anode-autostart`: i3-style `exec`, `exec_once`, `exec_always`, `--no-startup-id`, and `include` directives, per-profile `autostart.<profile>` files, `autostart.d/` drop-ins, and `ANODE`-filtered XDG `.desktop` entries wired into `anode-session` and DWM reload/restart. - `anode-autostart`: i3-style `exec`, UID- and `XDG_SESSION_ID`/D-Bus-session-aware `exec_once`, `exec_always`, `--no-startup-id`, and `include` directives, per-profile `autostart.<profile>` files, `autostart.d/` drop-ins, and `ANODE`-filtered XDG `.desktop` entries wired into `anode-session` and DWM reload/restart.
## Dependencies ## Dependencies
@@ -46,11 +46,11 @@ make PREFIX=/opt/anode CC=clang WITH_GTKTTK=1
make DESTDIR=/tmp/stage PREFIX=/usr/local install make DESTDIR=/tmp/stage PREFIX=/usr/local install
``` ```
Start ANODE from `.xinitrc` (`exec /usr/local/bin/anode-session`) or via a display manager selecting the installed `ANODE` XSession (`PREFIX/share/xsessions/anode.desktop`). Passing `--profile NAME` (or setting `ANODE_SESSION_PROFILE`) selects a session profile for autostart. Start ANODE from `.xinitrc` (`exec /usr/local/bin/anode-session`) or via a display manager selecting the installed `ANODE` XSession (`XSESSIONSDIR/anode.desktop`, default `PREFIX/share/xsessions/anode.desktop`; pass `XSESSIONSDIR=/usr/share/xsessions` when installing into system display managers such as LightDM). Passing `--profile NAME` (or setting `ANODE_SESSION_PROFILE`) selects a session profile for autostart.
## Live session replacement & desktop identity ## Live session replacement & desktop identity
Run `anode-replace` inside any active X11 session to replace the running window manager or desktop environment live without logging out or closing open windows (pass `--keep-panels` to retain third-party panels and daemons). `anode-replace` and `anode-session` scrub conflicting DE variables, export `XDG_CURRENT_DESKTOP=ANODE`, and `dwm` advertises `_NET_WM_NAME = "ANODE WM"` so system tools such as `fastfetch` report `Desktop Environment: ANODE` and `Window Manager: ANODE WM (X11)` instead of `dwm`. See [docs/SESSION.md](docs/SESSION.md) for full replacement, identity, and XKB status indicator details. Run `anode-replace` inside a running session to switch to ANODE cleanly. When the active window manager (such as `i3`) is the direct session child of a display manager (for instance LightDM), `anode-replace` detects the session leader so it does not tear down the X server and trigger a logout/re-login; use `sudo make XSESSIONSDIR=/usr/share/xsessions install` followed by `anode-replace --switch-session` (or pass `--keep-panels` / `--force` where appropriate). Inside ANODE itself or session-managed DEs, `anode-replace` performs a live ICCCM `WM_S<screen>` handoff (falling back to `_NET_WM_PID`), scrubs conflicting DE variables, exports `XDG_CURRENT_DESKTOP=ANODE`, and `dwm` advertises `_NET_WM_NAME = "ANODE WM"` so system tools such as `fastfetch` report `Desktop Environment: ANODE` and `Window Manager: ANODE WM (X11)` instead of `dwm`. See [docs/SESSION.md](docs/SESSION.md) for full replacement, identity, and XKB status indicator details.
## Session autostart ## Session autostart
+14 -12
View File
@@ -3,22 +3,24 @@
## Component map ## 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`. - `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`), XKB layout parser (`anode_xkb_parse.h`), CLI output parsers (`anode_audio_parse.h`, `anode_wifi_list.h`, `anode_bt_list.h`), and power policy (`anode_power_policy.h`). - `src/common/`: Cross-Unix platform layer (`anode_plat.c`, `anode_plat.h`), `.Xresources` / EDID fractional scale helpers (`anode_scale.h`), CPU/memory parsers (`anode_sys_parse.h`), input validators (`anode_dns_valid.h`, `anode_tz_valid.h`), XKB layout parser (`anode_xkb_parse.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, `anode_scale.h`, ICCCM `WM_S<screen>` `--replace` selection handoff, and `ANODE WM` EWMH identity. - `src/dwm/`, `src/dmenu/`, `src/st/`: Patched suckless X11 core using Pango/HarfBuzz (`Fira Code` ligatures), vector 3-bar hamburger launcher button in `dwm`, full-height `-l 0` mode in `dmenu`, `St.font` + live `Xft.dpi` Fontconfig resolution in `st`, `.Xresources` + `SIGUSR1` live reload, `anode_scale.h`, ICCCM `WM_S<screen>` `--replace` handoff (`exit 75` when yielded so `anode-session` holds the session), and `ANODE WM` EWMH identity.
- `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/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/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/daemons/`: Event-driven `poll()` + signal self-pipe daemons (`anode-statusd`, `anode-touchd`, `anode-powerd` with `power.conf` idle overrides) and narrowly-scoped privilege helpers (`anode-power-ctl`, `anode-dnsctl`, `anode-tzctl`, `anode-checkpw` with `/sbin/unix_chkpwd` fallback).
- `src/gtkTtk/`: Tk/Ttk native GTK-2 bridge (`libgtkTtk0.9.so` + `gtkTtk.tcl`) supporting full `[0.5, 4.0]` fractional scaling. - `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, strict POSIX `/bin/sh` synchronization scripts, live session replacement (`anode-replace`), and i3-style session autostart management (`anode-autostart` + `data/autostart` template). - `data/` & `scripts/`: 22 96-DPI `.xth` themes, `data/env.sh` XDG/Flatpak `XDG_DATA_DIRS` normalization, full-XDG `anode-launcher`, strict POSIX `/bin/sh` synchronization scripts, live session replacement (`anode-replace`), and i3-style session autostart management (`anode-autostart` + `data/autostart` template).
## Fractional DPI multi-toolkit contract ## Fractional DPI multi-toolkit contract
For a user or EDID-detected scale `S` clamped to `[0.50, 4.00]`: For a user or EDID-detected scale `S` clamped to `[0.50, 4.00]`:
- `Xft.dpi = round(96 * S)` - `Xft.dpi = round(96 * S)` (`anode-apply-scale auto` honors explicit `xdpyinfo` server DPI outside `[94, 98]` before falling back to physical XRandR EDID dimensions)
- `ANODE_SCALE = S`, `theme.baseFontSize = round(15 * S)` - `ANODE_SCALE = S`, `theme.baseFontSize = round(15 * S)`, and discrete standard Xcursor sizes (`16`, `24`, `32`, `48`, `64` mapped from `24 * S`); `~/.config/anode/scale.conf` takes precedence over stale session environment variables during live updates, while `anode-apply-scale` and `dwm` propagate updated scaling environment variables across `X11`, `D-Bus`, and newly spawned child processes.
- **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). - **GTK-2 / GTK-3 / GTK-4 / xsettingsd**: `GDK_SCALE = (S < 1.75) ? 1 : round(S)`, `GDK_DPI_SCALE = 1 / GDK_SCALE`, `ADW_DISABLE_PORTAL=1`, unscaled logical UI point sizes (`round((baseFontSize / S) * 0.65)`, e.g. `10pt`) because `Xft.dpi` is active (`Xft/DPI` remains omitted from `xsettingsd.conf` to avoid double-scaling), generated `~/.themes/ANODE-<name>/gtk-{3.0,4.0}/gtk.css` themes inherit GTK's built-in Adwaita/Default stylesheets via `resource:///...` `@import` (auto-detecting dark vs light from `theme.isDark` or `theme.bgMain` luminance) with color-only overrides so native widget/menu spacing and borders stay intact, color-only `@define-color` overrides in `~/.config/gtk-{3.0,4.0}/gtk.css`, `gtk-cursor-theme-size = Xcursor.size` for GTK-2, and `Gtk/CursorThemeSize` / `gtk-cursor-theme-size = round(Xcursor.size / GDK_SCALE)` for `xsettingsd` and GTK-3/4.
- **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/`. - **Dunst notifications**: `anode-sync-dunst-theme` pins `scale = 1`, pre-scales geometry by `S`, and uses pixel font sizing (`Fira Code <baseFontSize>px`) so `Xft.dpi` never double-scales notifications.
- **User `.Xresources` & terminal overrides**: `anode-apply-theme` preserves explicit `St.*` resource lines across theme switches and appends `$XDG_CONFIG_HOME/anode/Xresources.local`, while `st` honors explicit `St.font` overrides over theme-managed `st.font` and resolves `size=` fonts against live `Xft.dpi`.
- **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 logical point sizes (`10pt`) and 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`. - **Tk / Tkinter (`gtkTtk`)**: `*TkTheme: gtkTtk`, Tk scaling normalized against `ANODE_SCALE` / `Xft.dpi`, using `Fira Code`.
## First-class systray & EWMH workarea struts ## First-class systray & EWMH workarea struts
@@ -31,11 +33,11 @@ In `src/dwm/dwm.c`:
## Session autostart pipeline ## Session autostart pipeline
1. `anode-session` exports `XDG_CURRENT_DESKTOP=ANODE`, `XDG_SESSION_DESKTOP=anode`, `DESKTOP_SESSION=anode`, and optional `ANODE_SESSION_PROFILE`, seeds `~/.config/anode/autostart` and `~/.config/anode/autostart.d/`, and starts a background waiter polling `_NET_SUPPORTING_WM_CHECK` before invoking `anode-autostart start`. 1. `anode-session` exports `XDG_CURRENT_DESKTOP=ANODE`, `XDG_SESSION_DESKTOP=anode`, `DESKTOP_SESSION=anode`, and optional `ANODE_SESSION_PROFILE`, seeds `~/.config/anode/autostart` and `~/.config/anode/autostart.d/`, and starts a background waiter polling `_NET_SUPPORTING_WM_CHECK` before invoking `anode-autostart start`.
2. `anode-autostart` evaluates declarative files (`autostart` + optional `autostart.<profile>` + `include` graph via POSIX `awk`), then on `start` evaluates `autostart.d/` drop-ins and `ANODE`-filtered XDG `.desktop` entries with user-over-system basename masking. 2. `anode-autostart` evaluates declarative files (`autostart` + optional `autostart.<profile>` + `include` graph via POSIX `awk`), enforcing UID- and `XDG_SESSION_ID`/D-Bus-session-aware `exec_once` filtering, then on `start` evaluates `autostart.d/` drop-ins and `ANODE`-filtered XDG `.desktop` entries with user-over-system basename masking.
3. `src/dwm/dwm.c` triggers `anode-autostart reload` (running only `exec_always`) from interactive `reloadxres` (`Mod4 + Shift + r`, `arg->i = 1`) and post-`SIGHUP` `execvp` restart (`ANODE_DWM_RESTARTED=1`), while `SIGUSR1` and `XA_RESOURCE_MANAGER` pass `NULL` so live theme/DPI reloads never cause autostart loops. 3. `src/dwm/dwm.c` triggers `anode-autostart reload` (running only `exec_always`) from interactive `reloadxres` (`Mod4 + Shift + r`, `arg->i = 1`) and post-`SIGHUP` `execvp` restart (`ANODE_DWM_RESTARTED=1`), while `SIGUSR1` and `XA_RESOURCE_MANAGER` pass `NULL` so live theme/DPI reloads never cause autostart loops.
## Live replacement, desktop identity & XKB status ## Live replacement, desktop identity & status telemetry
1. **ICCCM `WM_S<screen>` takeover & fallback**: `src/dwm/dwm.c` (`acquirewm`, `--replace`) claims `WM_S<screen>` on `wmcheckwin`, broadcasts `MANAGER`, exits cleanly on `SelectionClear`, and waits up to 5 s for `prev_owner` destruction and `SubstructureRedirectMask`. `scripts/anode-replace` pairs this with a 1.5 s UID-checked `_NET_WM_PID` `SIGTERM` fallback for non-ICCCM WMs. 1. **ICCCM `WM_S<screen>` takeover & fallback**: `src/dwm/dwm.c` (`acquirewm`, `--replace`) claims `WM_S<screen>` on `wmcheckwin`, broadcasts `MANAGER`, exits cleanly with status `75` on `SelectionClear` (so `anode-session` keeps the session alive while monitoring the new WM), and waits up to 5 s for `prev_owner` destruction and `SubstructureRedirectMask`. `scripts/anode-replace` pairs this with a 1.5 s UID-checked `_NET_WM_PID` (or UID-filtered `_NET_WM_NAME`) `SIGTERM` fallback for non-ICCCM WMs, `--switch-session` one-shot `~/.xprofile` handoff for active LightDM sessions, and DM session-leader safety checks.
2. **EWMH/XDG desktop identity**: `dwm` publishes `_NET_WM_NAME = "ANODE WM"`, `XA_WM_NAME = "ANODE WM"`, and `_NET_WM_PID`, while `anode-session` and `anode-replace` clear stale foreign DE variables, export `XDG_CURRENT_DESKTOP=ANODE`, and update DBus/systemd user activation environments so system tools such as `fastfetch` report `Desktop Environment: ANODE` and `Window Manager: ANODE WM (X11)`. 2. **EWMH/XDG desktop identity**: `dwm` publishes `_NET_WM_NAME = "ANODE WM"`, `XA_WM_NAME = "ANODE WM"`, and `_NET_WM_PID`, while `anode-session` and `anode-replace` clear stale foreign DE variables, export `XDG_CURRENT_DESKTOP=ANODE`, and update DBus/systemd user activation environments so system tools such as `fastfetch` report `Desktop Environment: ANODE` and `Window Manager: ANODE WM (X11)`.
3. **Zero-poll XKB layout indicator**: `src/daemons/anode-statusd.c` selects `XkbNewKeyboardNotifyMask | XkbMapNotifyMask | XkbNamesNotifyMask` and `XkbGroupStateMask`-filtered `XkbStateNotify` events on the X11 fd, resolving lowercase layout codes via `src/common/anode_xkb_parse.h` (live XKB symbols -> `_XKB_RULES_NAMES` -> group names) to place `<xkb>` directly left of the datetime. 3. **Event-driven status & XKB layout indicator**: `src/daemons/anode-statusd.c` selects `XkbNewKeyboardNotifyMask | XkbMapNotifyMask | XkbNamesNotifyMask` and `XkbGroupStateMask`-filtered `XkbStateNotify` events on the X11 fd, resolving lowercase layout codes via `src/common/anode_xkb_parse.h` (live XKB symbols -> `_XKB_RULES_NAMES` -> group names) and reading cross-Unix CPU/RAM telemetry (`src/common/anode_sys_parse.h` / `src/common/anode_plat.c`) on a `<= 2000 ms` `poll()` refresh cadence (without busy-polling) to publish `VOL | CPU | RAM | BAT/AC | <xkb> | YYYY-MM-DD HH:MM`.
+4 -1
View File
@@ -16,10 +16,13 @@ Declarative rules live in `~/.config/anode/autostart` (or the file passed via `-
| Directive | Behavior | | Directive | Behavior |
|---|---| |---|---|
| `exec [--no-startup-id] <command>` | Run `<command>` once during `anode-autostart start` | | `exec [--no-startup-id] <command>` | Run `<command>` once during `anode-autostart start` |
| `exec_once [--no-startup-id] <command>` | Run `<command>` during `start` only when no process matching its executable basename is already running (checked via POSIX `ps`) | | `exec_once [--no-startup-id] <command>` | Run `<command>` during `start` only when no matching UID-owned process is already running in the current `XDG_SESSION_ID` / D-Bus session (checked via POSIX `ps` and `/proc/<pid>/environ` when available) |
| `exec_always [--no-startup-id] <command>` | Run `<command>` during `start` and re-run on `anode-autostart reload` (`Mod4 + Shift + r` or `SIGHUP` restart) | | `exec_always [--no-startup-id] <command>` | Run `<command>` during `start` and re-run on `anode-autostart reload` (`Mod4 + Shift + r` or `SIGHUP` restart) |
| `include <path>` | Load directives from another file (absolute path, `~/...`, or relative to the current file; duplicate/cyclic includes are skipped, and nesting deeper than 8 levels fails `check`) | | `include <path>` | Load directives from another file (absolute path, `~/...`, or relative to the current file; duplicate/cyclic includes are skipped, and nesting deeper than 8 levels fails `check`) |
> [!NOTE]
> On Linux (`/proc/<pid>/environ`), `exec_once` compares `XDG_SESSION_ID` and `DBUS_SESSION_BUS_ADDRESS` against the running session so orphaned background processes left behind by dead or separate login sessions (such as `pipewire` or `redshift` across `elogind` or LightDM logins) do not suppress startup in a fresh ANODE session.
## Session profiles ## Session profiles
Passing `--profile NAME` or `--profile=NAME` to `anode-session` or `anode-autostart` (or exporting `ANODE_SESSION_PROFILE=NAME`) loads `~/.config/anode/autostart.<profile>` (or `PREFIX/share/anode/autostart.<profile>` if no user file exists) immediately after the base `autostart` file: Passing `--profile NAME` or `--profile=NAME` to `anode-session` or `anode-autostart` (or exporting `ANODE_SESSION_PROFILE=NAME`) loads `~/.config/anode/autostart.<profile>` (or `PREFIX/share/anode/autostart.<profile>` if no user file exists) immediately after the base `autostart` file:
+1 -1
View File
@@ -7,7 +7,7 @@ Default `MODKEY` is `Mod4` (`Super` / `Win`).
| Binding | Action | | Binding | Action |
|---|---| |---|---|
| `Mod4 + Return` | Launch `st` terminal (with `Fira Code` HarfBuzz ligatures) | | `Mod4 + Return` | Launch `st` terminal (with `Fira Code` HarfBuzz ligatures) |
| `Mod4 + p` / `Mod4 + Space` / `Menu` | Open `anode-launcher` (desktop + app menu) | | `Mod4 + p` / `Mod4 + Space` / `Menu` | Open `anode-launcher` (XDG + Flatpak desktop entries, actions & app menu; `--list` prints resolved entries) |
| `Mod4 + Shift + p` | Open `dmenu_run` | | `Mod4 + Shift + p` | Open `dmenu_run` |
| `Mod4 + j` / `Mod4 + Down` | Focus next window | | `Mod4 + j` / `Mod4 + Down` | Focus next window |
| `Mod4 + k` / `Mod4 + Up` | Focus previous window | | `Mod4 + k` / `Mod4 + Up` | Focus previous window |
+26 -8
View File
@@ -2,12 +2,13 @@
## Starting or live-replacing an X11 session ## Starting or live-replacing an X11 session
- **Fresh X11 startup**: Launch ANODE from `~/.xinitrc` (`exec /usr/local/bin/anode-session [--profile NAME]`) or select the installed `ANODE` session (`PREFIX/share/xsessions/anode.desktop`) in a display manager. `anode-session` also accepts `--replace` and `--no-autostart` and forwards `--replace` to `dwm --replace`. - **Fresh X11 startup**: Launch ANODE from `~/.xinitrc` (`exec /usr/local/bin/anode-session [--profile NAME]`) or select the installed `ANODE` session in a display manager. Pass `XSESSIONSDIR=/usr/share/xsessions` to `make install` (e.g. `sudo make XSESSIONSDIR=/usr/share/xsessions install`) when installing into `/usr/local` so LightDM, SDDM, and GDM discover `anode.desktop`. `anode-session` also accepts `--replace` and `--no-autostart` and forwards `--replace` to `dwm --replace`.
- **Live replacement (`anode-replace`)**: Replace an active X11 window manager or desktop session without logging out or closing open X11 windows: - **Live replacement (`anode-replace`)**: Replace an active X11 window manager or desktop session without logging out or closing open X11 windows, or switch to a clean ANODE display-manager session on a new VT:
```sh ```sh
anode-replace --dry-run anode-replace --dry-run
anode-replace anode-replace
anode-replace --switch-session
anode-replace --profile work --keep-panels anode-replace --profile work --keep-panels
``` ```
@@ -17,13 +18,17 @@ anode-replace --profile work --keep-panels
| `--keep-panels` | Keep existing third-party panels, notification daemons, and settings daemons running | | `--keep-panels` | Keep existing third-party panels, notification daemons, and settings daemons running |
| `--foreground` | Exec `anode-session --replace` in the foreground instead of detaching | | `--foreground` | Exec `anode-session --replace` in the foreground instead of detaching |
| `--no-autostart` | Skip `anode-autostart start` during replacement | | `--no-autostart` | Skip `anode-autostart start` during replacement |
| `--dry-run` | Print the detected WM (`_NET_SUPPORTING_WM_CHECK` window and PID), cleanup mode, and command without replacing | | `--force` | Proceed with in-place replacement even when the active WM is a direct session child of a display manager or `xinit` |
| `--switch-session` | Switch via LightDM (`dm-tool switch-to-user`) to an `anode` XSession when no user session is active yet; if a LightDM session for the current user is already active (where `dm-tool` merely refocuses the current VT), schedule a one-shot `~/.xprofile` handoff (`$XDG_CACHE_HOME/anode/switch-once`) and exit the current WM so LightDM starts ANODE cleanly and returns to the previous default session on logout |
| `--dry-run` | Print the detected WM (`_NET_SUPPORTING_WM_CHECK` window, PID, parent process, and DM session-leader warning) without replacing |
| `-h`, `--help` | Print command usage and exit | | `-h`, `--help` | Print command usage and exit |
- **Display manager session-leader safety guard**: When a standalone window manager (such as `i3`) was launched directly as the session child of a display manager (`lightdm`, `sddm`, `gdm`, `xdm`, `lxdm`, `slim`, `ly`, `greetd`, `emptty`) or `xinit`/`startx`, causing it to exit via ICCCM replacement makes the display manager terminate the X server and restart/log out the session. `anode-replace` resolves the active WM PID (via `_NET_WM_PID` or falling back to a UID-filtered `ps` lookup by `_NET_WM_NAME` when `_NET_WM_PID` is omitted), checks its parent process, and refuses destructive in-place replacement unless `--force` is given — recommending `anode-replace --switch-session` (after `sudo make XSESSIONSDIR=/usr/share/xsessions install`) or selecting `ANODE` at login instead.
- **ANODE session holder (`exit 75`)**: When `dwm` yields ownership to another WM via ICCCM `SelectionClear`, `dwm` exits with status `75`. `anode-session` stops its old background daemons and remains alive monitoring `_NET_SUPPORTING_WM_CHECK` until the replacement WM exits cleanly (tolerating brief transient reloads across 2 s) so a display manager does not kill the X server during in-place handoff.
- **Two-stage WM handoff**: - **Two-stage WM handoff**:
1. **ICCCM 2.0 `WM_S<screen>` takeover**: `dwm` claims `WM_S<screen>` on its check window and handles `SelectionClear` by cleanly unwinding (`restart_dwm = 0; running = 0;`). When invoked with `--replace`, `dwm` acquires `WM_S<screen>`, broadcasts a root `MANAGER` `ClientMessage`, and polls `ConnectionNumber(dpy)` for up to 5 s until the previous owner destroys its selection window and releases `SubstructureRedirectMask`. 1. **ICCCM 2.0 `WM_S<screen>` takeover**: `dwm` claims `WM_S<screen>` on its check window and handles `SelectionClear` by cleanly unwinding (`replaced_by_other = 1; restart_dwm = 0; running = 0;`). When invoked with `--replace`, `dwm` acquires `WM_S<screen>`, broadcasts a root `MANAGER` `ClientMessage`, and polls `ConnectionNumber(dpy)` for up to 5 s until the previous owner destroys its selection window and releases `SubstructureRedirectMask`.
2. **Non-ICCCM fallback**: Before launching `anode-session --replace`, `anode-replace` records `_NET_WM_PID` from `_NET_SUPPORTING_WM_CHECK`. If the previous window manager still holds `_NET_SUPPORTING_WM_CHECK` after 1.5 s and its PID belongs to the current UID (checked via POSIX `ps`), `anode-replace` sends `SIGTERM` so `dwm --replace` can take over `SubstructureRedirectMask`. 2. **Non-ICCCM fallback**: Before launching `anode-session --replace`, `anode-replace` records `_NET_WM_PID` (or UID-matched WM PID fallback) from `_NET_SUPPORTING_WM_CHECK`. If the previous window manager still holds `_NET_SUPPORTING_WM_CHECK` after 1.5 s and its PID belongs to the current UID (checked via POSIX `ps`), `anode-replace` sends `SIGTERM` so `dwm --replace` can take over `SubstructureRedirectMask`.
- **Process cleanup & detached readiness**: `anode-replace` terminates duplicate UID-owned ANODE daemons (`anode-statusd`, `anode-powerd`, `anode-touchd`, `anode-vkbd`) and, unless `--keep-panels` is given, stops conflicting third-party panels, notification daemons, and settings daemons (`xfce4-panel`, `mate-panel`, `lxpanel`, `tint2`, `polybar`, `lemonbar`, `fbpanel`, `plank`, `wingpanel`, `dunst`, `xfce4-notifyd`, `xsettingsd`, `xfsettingsd`). By default it launches `anode-session --replace` immune to `SIGHUP` and waits up to 5 s for `ANODE WM` to advertise itself on `_NET_SUPPORTING_WM_CHECK`. - **Process cleanup & detached readiness**: `anode-replace` terminates duplicate UID-owned ANODE daemons (`anode-statusd`, `anode-powerd`, `anode-touchd`, `anode-vkbd`) and, unless `--keep-panels` is given, stops conflicting third-party panels, notification daemons, and settings daemons (`xfce4-panel`, `mate-panel`, `lxpanel`, `i3bar`, `tint2`, `polybar`, `lemonbar`, `fbpanel`, `plank`, `wingpanel`, `dunst`, `xfce4-notifyd`, `xsettingsd`, `xfsettingsd`). By default it launches `anode-session --replace` immune to `SIGHUP` and waits up to 5 s for `ANODE WM` to advertise itself on `_NET_SUPPORTING_WM_CHECK`.
## Desktop environment & window manager identity ## Desktop environment & window manager identity
@@ -33,10 +38,23 @@ anode-replace --profile work --keep-panels
## Status bar & XKB layout indicator ## Status bar & XKB layout indicator
- **Format**: `anode-statusd` publishes `VOL <n%> | <net> | <bat/AC> | <xkb> | YYYY-MM-DD HH:MM` (plus `VOL MUTE` when muted) to the X11 root `WM_NAME`. The `VOL` segment is omitted when no audio backend is detected, and `<xkb>` is omitted cleanly if XKB is unavailable. - **Format**: `anode-statusd` publishes `VOL <n%> | CPU <c%> | RAM <r%> | <bat/AC> | <xkb> | YYYY-MM-DD HH:MM` (plus `VOL MUTE` when muted) to the X11 root `WM_NAME`. The `VOL` segment is omitted when no audio backend is detected, `CPU`/`RAM` use cross-Unix kernel telemetry (`/proc/stat` + `/proc/meminfo` on Linux, `sysctl` on FreeBSD/OpenBSD/NetBSD), and `<xkb>` is omitted cleanly if XKB is unavailable.
- **Text-only layout indicator**: `<xkb>` is a plain lowercase ASCII layout code (for example `us`, `de`, `ru`, `ua`, `latam`, `jp`) positioned immediately to the left of the datetime with no prefix labels, icons, or graphics. - **Text-only layout indicator**: `<xkb>` is a plain lowercase ASCII layout code (for example `us`, `de`, `ru`, `ua`, `latam`, `jp`) positioned immediately to the left of the datetime with no prefix labels, icons, or graphics.
- **Zero-poll event model**: After `XkbQueryExtension()`, `anode-statusd` subscribes to `XkbNewKeyboardNotifyMask | XkbMapNotifyMask | XkbNamesNotifyMask` (`XkbSelectEvents`) and `XkbStateNotify` filtered solely to `XkbGroupStateMask` (`XkbSelectEventDetails`) so regular keystrokes and modifier presses never wake the `poll()` loop. - **Event-driven status loop**: After `XkbQueryExtension()`, `anode-statusd` subscribes to `XkbNewKeyboardNotifyMask | XkbMapNotifyMask | XkbNamesNotifyMask` (`XkbSelectEvents`) and `XkbStateNotify` filtered solely to `XkbGroupStateMask` (`XkbSelectEventDetails`) so regular keystrokes and modifier presses never wake the loop, pairing XKB/signal events with a `<= 2000 ms` `poll()` refresh cadence for CPU/RAM telemetry and minute-aligned clock ticks without busy-polling.
- **Layout code resolution (`src/common/anode_xkb_parse.h`)**: - **Layout code resolution (`src/common/anode_xkb_parse.h`)**:
1. Parse the live XKB symbols name (`XkbSymbolsNameMask`), handling `setxkbmap` and `xkbcomp` keymaps while stripping `:N` group selectors, `(variant)` suffixes, vendor prefixes (such as `nec_vndr/jp` -> `jp`), and non-layout components (`pc`, `evdev`, `inet`, `group`, `level3`, etc.). 1. Parse the live XKB symbols name (`XkbSymbolsNameMask`), handling `setxkbmap` and `xkbcomp` keymaps while stripping `:N` group selectors, `(variant)` suffixes, vendor prefixes (such as `nec_vndr/jp` -> `jp`), and non-layout components (`pc`, `evdev`, `inet`, `group`, `level3`, etc.).
2. Fall back to the root `_XKB_RULES_NAMES` layouts CSV when the symbols string cannot be matched. 2. Fall back to the root `_XKB_RULES_NAMES` layouts CSV when the symbols string cannot be matched.
3. Fall back to the first two lowercase ASCII letters of the active XKB group name (`XkbGroupNamesMask`). 3. Fall back to the first two lowercase ASCII letters of the active XKB group name (`XkbGroupNamesMask`).
## Application launcher & XDG integration
- **Normalized XDG & Flatpak search path (`data/env.sh`)**: `anode-session` sources `data/env.sh`, which normalizes and exports `XDG_DATA_DIRS` without duplicates while appending `$XDG_DATA_HOME/flatpak/exports/share`, `/var/lib/flatpak/exports/share`, and `/var/lib/snapd/desktop` when present.
- **Desktop entry discovery (`scripts/anode-launcher`)**: Recursively scans `applications/` directories (regular `.desktop` files and symlinks), builds standard XDG Desktop File IDs (translating subdirectories to `-`) so earlier user entries and `Hidden=true` / `NoDisplay=true` entries mask lower-priority system entries cleanly, and accepts `--list` to inspect resolved entries (`label<TAB>workdir<TAB>term<TAB>cmd`).
- **Execution semantics**: Enforces `Type=Application`, case-insensitive `OnlyShowIn` / `NotShowIn` matching against `XDG_CURRENT_DESKTOP`, `TryExec` executability/`PATH` checks, locale priority (`LC_ALL`/`LC_MESSAGES`/`LANG`) for `Name` and `GenericName`, Flatpak `@@u %U @@` wrapper and `%i`/`%c`/`%k`/`%%` field-code handling, `[Desktop Action ...]` sub-entries, `Path=` working directory changes, `Terminal=true` execution via `st -e`, `DBusActivatable=true` activation via `gdbus`, and `setsid` background detachment.
- **Full-height `dmenu` layout**: `anode-launcher` invokes `dmenu -i -l 0`; in `src/dmenu/dmenu.c`, passing `-l 0` (or omitting `-l`) fills the active monitor height (`mh = sh`) with all fitting `(sh - bh) / bh` rows, whereas explicit `-l N` sizes the menu tightly to `(N + 1) * bh`.
## Idle power policy & screen locking
- **Idle policy (`src/daemons/anode-powerd.c` & `src/common/anode_power_policy.h`)**: Defaults to `5 min` dim (`DIM_SEC=300`, dimming to `max(0.35, 45%)` of current brightness and polling every `500 ms` while dimmed for responsive wake), `10 min` lock (`LOCK_SEC=600`), `30 min` battery-only suspend (`SUSPEND_SEC=1800`, `SUSPEND_ON_AC=0`), and `5%` critical-battery warning/suspend (`CRIT_BATT_PCT=5`), configurable in `$XDG_CONFIG_HOME/anode/power.conf`.
- **Brightness restoration & backlight access**: Automatically restores saved brightness when waking from `ANODE_PWR_DIMMED` / `ANODE_PWR_LOCKED` / `ANODE_PWR_SUSPENDED` or on daemon exit. On Linux, `anode_backlight_get()` (`src/common/anode_plat.c`) verifies writable `/sys/class/backlight/*/brightness` (`access(..., W_OK) == 0`) before using sysfs, falling back to `brightnessctl` / `xrandr` when unprivileged.
- **Screen-lock authentication (`src/daemons/anode-checkpw.c`)**: Verifies against `/etc/shadow` / BSD `getpwnam` directly when permitted and falls back to the setuid PAM helper (`/sbin/unix_chkpwd` / `/usr/sbin/unix_chkpwd` / `/usr/libexec/unix_chkpwd`) when running non-root; `make install` applies `chmod 4755` to `anode-checkpw` when invoked as `root` with an empty `DESTDIR`.