docs: refresh and polish documentation for latest Geminux features

This commit is contained in:
Luxferre committed 2026-11-27 17:27:51 +02:00
1 parent 09c1e2ad36
commit 3825e73bf8
5 files changed
+398 -177

No files matched your search

+95 -40
View File
@@ -1,62 +1,117 @@
# Architecture
Geminux combines a custom-patched Linux `7.3.5` kernel, pure-Linux MTK flasher, XLibre graphics server, patched suckless X11 stack, and custom C11 applications and daemons, packaged cleanly into signed Alpine APK packages so standard userspace updates continue working indefinitely.
Geminux combines a custom-patched Linux `7.3.5` kernel, pure-Linux MTK flasher, XLibre graphics server, patched suckless desktop, unified `.Xresources` + wallpaper engine, and zero-poll C11 daemons packaged as signed Alpine APKs so standard Alpine Edge updates continue working cleanly.
## Kernel and MediaTek MT6797X support
- **Kernel tree**: Vanilla Linux `7.3.5` patched via [patches/kernel/](file:///home/lux/proj/geminux/patches/kernel) (`0001-ixoo-gemini-pda-mainline-7.3.5.patch`, `0002-mt6797-ccci-cldma-and-md1-domain.patch`, `0003-arm64-dts-mediatek-geminux-gemini-pda.patch`, `0004-gemini-ssd2092-display-and-touch.patch`, `0005-mt6797-consys-wifi-factory-firmware.patch`, `0006-mt6797-boot-cleanups.patch`, `0007-mt6797-wlan-peer-deauth-and-rekey.patch`, `0008-gemini-resume-wake-and-spm-standby.patch`, `0009-mt6797-wlan-drop-free-stability.patch`, `0010-mt6797-ccci-md1-boot-hs-v2-and-rpc.patch`, `0011-gemini-lid-sync-filter-and-debounce.patch` adding synchronous Hall GPIO66 lid-close keyboard/touch filtering, `1 ms` Hall EINT debounce, `10 ms` matrix keypad debounce, and touchscreen inhibit, and `0012-gemini-lid-wake-and-fg-taper-fix.patch` adding `gemini-lid` `PM_POST_SUSPEND`/raw-GPIO recheck reconciliation to prevent stuck `BL_CORE_SUSPENDED` / input inhibition alongside `mt6351-fuel-gauge` + `bq25890` boot zero-current OCV calibration (`POWER_SUPPLY_PROP_CALIBRATE` / `MT6351_RGS_CHRDET`), consecutive `win_ua`+`reg_ua` CV-taper validation, `+1%` conservative step caps, and `180 mV` boot-sag `ADC21` tolerance), with `CONFIG_XFRM_USER=y` and `esp4`, `esp6`, `af_key`, and `xfrm_interface` modules enabled for 3GPP IMS IPsec.
- **Graphics & display**: MediaTek DRM (`mediatek-drm`), Solomon Systech `SSD2092` DSI FHD+ panel & touchscreen, early-boot `simpledrm` (`DRM_SIMPLEDRM=y` + rotated `TER16x32` console), Mali-T880 `panfrost` GPU driver, and `sii902x` Slimport/HDMI bridge.
- **Wi-Fi / Bluetooth CONSYS**: Staged `mt6797_wlan_core` and `btmt6797` drivers backed by NVRAM/factory firmware provisioning (`geminux-wifi-nvram` and `firmware-cache/mt6797/`), hardened by `0007` and `0009` for peer deauth, GTK rekey, and drop-free RX/TX buffer handling.
- **Modem / Telephony / eSIM / IMS**: Staged `mt6797-ccci-cldma` driver exposing `/dev/ccci_md_ctl`, `/dev/ccci_fs`, `/dev/ccci_rpc`, `/dev/ttyC0..3`, and `ccmni*` network interfaces with the 16-byte `struct mt6797_ccci_header` UAPI ([mt6797_ccci.h](file:///home/lux/proj/geminux/prebuilt/kernel/include/linux/mt6797_ccci.h)). `geminux-ccci-daemon` ([geminux-ccci-fs.c](file:///home/lux/proj/geminux/src/geminux-daemons/geminux-ccci-fs.c)) serves MD1 boot handshake v2, NVRAM/CCCI_FS file I/O, and RPC queries (`MD_STATE=READY`); `geminux-cellctl` ([geminux-cellctl.c](file:///home/lux/proj/geminux/src/geminux-daemons/geminux-cellctl.c)) handles physical SIM vs. ST33 eUICC `AT+ESIMS` slot switching, `lpac` AT-`CSIM`/`CGLA` APDU bridging for eSIM provisioning, and `ccmni*` LTE PDN bring-up; `geminux-imsd` ([geminux-imsd.c](file:///home/lux/proj/geminux/src/geminux-daemons/geminux-imsd.c)) provides 3GPP VoLTE over `ccmni*` and VoWiFi `SWu` IKEv2/IPsec via `strongswan`, ISIM/USIM MILENAGE AKA, kernel XFRM `ipsec-3gpp` with RFC 4303 userspace ESP fallback, SIP `REGISTER`/`INVITE`/`BYE`/`MESSAGE`, 3GPP `RP-DATA` SMS, and 20 ms `timerfd` AMR-NB/AMR-WB/G.711/DTMF RTP bridged to PipeWire/ALSA `VoiceCall` UCM2.
- **Boot, LUKS2 FDE & recovery**: Packed LK-compatible Android boot images (`images/boot-geminux.img`, `images/recovery-geminux.img`) built with `mkbootimg-osm0sis` (`16 MiB` boot slot ceiling, `512 KiB` DTB ceiling). The kernel includes built-in `BLK_DEV_DM=y`, `DM_CRYPT=y`, and ARMv8 AES-CE (`CRYPTO_AES_ARM64_CE_BLK=y`), and the initramfs bundles `cryptsetup` plus a standalone binary Gemini US keymap (`/etc/gemini-us.kmap`). With `DM_DISABLE_UDEV=1`, [src/initramfs/init](file:///home/lux/proj/geminux/src/initramfs/init) runs the off-mode charger guard, optionally unlocks LUKS2 `PARTLABEL=linux` into `/dev/mapper/geminux_root` (whole-device dynamic segment), checks ext4 non-interactively (`e2fsck -p </dev/null`), and expands the root filesystem via `resize2fs -f </dev/null` on first boot. [src/initramfs/init-recovery](file:///home/lux/proj/geminux/src/initramfs/init-recovery) exposes a USB NCM/RNDIS gadget shell (`172.16.42.1/24`) with LUKS2-aware `unlock-root`, `check-fs`, and `mount-root`.
Vanilla Linux `7.3.5` is built from [patches/kernel/](patches/kernel/) with built-in IPsec (`CONFIG_XFRM_USER=y`, `esp4`, `esp6`, `af_key`, `xfrm_interface`) for 3GPP IMS alongside Gemini PDA hardware support:
## Graphics, window management, and theming
| Patch | Purpose |
| --- | --- |
| `0001-ixoo-gemini-pda-mainline-7.3.5.patch` | Core MT6797X / Gemini PDA mainline `7.3.5` platform, DRM, keypad, PMIC, and fuel-gauge base |
| `0002-mt6797-ccci-cldma-and-md1-domain.patch` | Staged `mt6797-ccci-cldma` baseband transport and MD1 power-domain support |
| `0003-arm64-dts-mediatek-geminux-gemini-pda.patch` | Geminux Device Tree bindings, pinmux, regulators, and peripheral wiring |
| `0004-gemini-ssd2092-display-and-touch.patch` | Solomon Systech `SSD2092` DSI FHD+ panel and multi-touch controller fixes |
| `0005-mt6797-consys-wifi-factory-firmware.patch` | MT6797 CONSYS Wi-Fi/BT driver and factory firmware/NVRAM loading |
| `0006-mt6797-boot-cleanups.patch` | Early boot and console noise cleanups |
| `0007-mt6797-wlan-peer-deauth-and-rekey.patch` | WLAN station deauth recovery and GTK rekey stability |
| `0008-gemini-resume-wake-and-spm-standby.patch` | S3 resume wake handling, `mt6797-spm-sleep` standby, `mtk-eint` debounce clear, and `mtk-pmic-keys` wakeups |
| `0009-mt6797-wlan-drop-free-stability.patch` | CONSYS WLAN RX/TX buffer drop-free stability under load |
| `0010-mt6797-ccci-md1-boot-hs-v2-and-rpc.patch` | MD1 boot handshake v2 and CCCI RPC stabilization |
| `0011-gemini-lid-sync-filter-and-debounce.patch` | Synchronous Hall `GPIO66` lid-close keystroke/touch filtering, `1 ms` Hall EINT & `10 ms` keypad debounce, and touch inhibit |
| `0012-gemini-lid-wake-and-fg-taper-fix.patch` | `gemini-lid` `PM_POST_SUSPEND` + raw-GPIO reconciliation (`BL_CORE_SUSPENDED`/input lockout fix) and `mt6351` + `bq25890` zero-current OCV calibration, CV-taper checks, `+1%` cap, and `180 mV` `ADC21` sag tolerance |
| `0013-gemini-pmic-wake-and-spm-safety.patch` | Moves `mt6397_irq_suspend`/`mt6397_irq_resume` from `PM_SUSPEND_PREPARE` into `LATE_SYSTEM_SLEEP_PM_OPS` so child `enable_irq_wake()` settings arm cleanly before deep sleep; hardens `mt6797-spm-sleep` `s.sleep` with `WAKE_PCM_WDT`, `pcm_wdt`, `im_wait` (`1000 us`), and a `5000 ms` `cntp` physical timer backstop (`100 ms` on `s.sodi`) |
- **XLibre (`25.x`)**: Cross-compiled against pure Alpine Edge `aarch64` sysroots with `modesetting_drv.so`, `fbdev_drv.so`, `libinput_drv.so`, and Panfrost Glamor EGL (`libglamoregl.so`) ([scripts/build-xlibre.sh](file:///home/lux/proj/geminux/scripts/build-xlibre.sh)). [10-geminux-gpu.conf](file:///home/lux/proj/geminux/overlay/rootfs/etc/X11/xorg.conf.d/10-geminux-gpu.conf) configures `modesetting` with `AccelMethod "none"`, `ShadowFB "true"`, `TearFree "true"`, `PageFlip "false"`, `SWcursor "true"`, and `Rotate "left"` to eliminate rotated DSI tearing and Glamor fence spin-wait CPU overhead while keeping Panfrost EGL/OpenGL 3D acceleration active for clients. Zero Wayland compositors (`sway`, `weston`, `phosh`, `xwayland`, etc.) are installed.
- **Patched suckless desktop**:
- `st` with HarfBuzz font shaping (`hb.c`) supporting Fira Code programming ligatures, Nerd Font fallback, mouse/two-finger wheel scrollback, immediate cursor redraw on `FocusIn`/`FocusOut` + unfocused cursor-blink timeout gating (paired with `dwm` `FocusChangeMask`/`NotifyWhileGrabbed` guards and `libgemui` focus restore across grabs), and `SIGUSR1` live `.Xresources` reload.
- `dwm` with Pango/HarfBuzz multi-font bar (`drw.c`), EWMH/XEmbed system tray, touch-friendly `>= 68px` status bar, `Mod4 = Fn+Alt` + one-shot `Super_L` tap-latch, `Fn+F` (`XF86XK_UWB`/`XF86XK_RFKill`) hardware Airplane Mode binding, `SIGHUP` self-reexec, and `SIGUSR1` `.Xresources` reload.
- `dmenu` with Pango/HarfBuzz, dynamic full-screen-height item rows (`68px` touch rows), and mouse/touch click selection, paired with `geminux-launcher` pinning the 11 GUI apps alongside `Webarchy Browser`, `Bantam AI agent`, and `Lynx Web Browser` in `st` (and wrapping `Terminal=true` `.desktop` entries in `st -e`).
- **Zero-Rust notifications**: `dunst v1.12.2` compiled with `WAYLAND=0 DUNSTIFY=0` and custom pure-C PNG (`libpng` + Cairo) / JPEG (`libjpeg-turbo`) icon loader replacing `gdk-pixbuf` ([src/dunst-notify/](file:///home/lux/proj/geminux/src/dunst-notify/)), paired with a lightweight GDBus `notify-send` / `dunstify`.
- **Unified desktop, GTK2/3/4, Qt5/6 & Tk (`gtkTtk`) theming**: Switching `.xth` palettes via `geminux-themes` or `geminux-apply-theme` updates `~/.Xresources`, `dunstrc` (`geminux-sync-dunst-theme`), and via `geminux-sync-gtk-theme` generates a light- or dark-based `Geminux-<Theme>` theme across GTK2 (`gtk-2.0/gtkrc`, `~/.gtkrc-2.0`), GTK3 (`gtk-3.0/gtk.css`, `~/.config/gtk-3.0/{settings.ini,gtk.css}`), GTK4/`libadwaita` (`gtk-4.0/gtk.css`, `~/.config/gtk-4.0/{settings.ini,gtk.css}` with `@define-color` and `:root` custom variables plus `dconf`-backed `gsettings` `color-scheme`), `xsettingsd` (`~/.config/xsettingsd/xsettingsd.conf`), Qt6 (`~/.config/qt6ct/{qt6ct.conf,colors/Geminux-<Theme>.conf}` 21-role `QPalette`), and Kvantum (`~/.config/Kvantum/Geminux/Geminux.kvconfig`) before merging `~/.Xresources` via `xrdb`. [10-geminux-env.sh](file:///home/lux/proj/geminux/overlay/rootfs/etc/profile.d/10-geminux-env.sh) sets `ADW_DISABLE_PORTAL=1` (so `libadwaita` binds directly to `dconf`/`gsettings` `color-scheme` on portal-free X11 with live updates) and `QT_QPA_PLATFORMTHEME=qt6ct:gtk3` (routing Qt6 to `qt6ct-style` and Qt5 dialogs to `libqgtk3.so`, with Kvantum configs ready for `QT_STYLE_OVERRIDE=kvantum`), GTK2 writes DPI-scaled `xthickness`/`ythickness` and style metrics (`192 DPI` / `2x`) alongside `*TkTheme: gtkTtk` to auto-load preinstalled `gtkTtk 0.9` in Tk/Ttk/Tkinter apps against `~/.gtkrc-2.0` (with DPI-scaled widget geometry, negative-pixel font heights matched to `theme.baseFontSize`, zero-poll X11 `RESOURCE_MANAGER` `PropertyNotify` live reloading across [src/gtkTtk/](file:///home/lux/proj/geminux/src/gtkTtk/), and pure-X11 XImage blitting avoiding `gdk-pixbuf-xlib`), alongside `SIGUSR1` for live `dwm`, `st`, `webarchy`, and `libgemui` clients. Preinstalled `tcl` (`tcl-lib` + `tcl-tls`) and `tk` run cleanly on the same stack.
- **Webarchy & pure-C `gdk-pixbuf`**: [src/webarchy/webarchy.cpp](file:///home/lux/proj/geminux/src/webarchy/webarchy.cpp) provides a standalone C++20 `GTK3` + `WebKit2GTK-4.1` multi-tab browser adapted for the `2160x1080` ultrawide display (`1080x506` logical @ `GDK_SCALE=2`) with a collapsible flush-right vertical tab bar, DPI-scaled `pt` CSS reloaded live from `~/.Xresources` via `SIGUSR1` (selecting the generated `Geminux-<Theme>` GTK3 theme and dark/light preference dynamically), persistent SQLite cookies/bookmarks under `~/.local/share/geminux/webarchy` and `~/.config/geminux/webarchy`, single-instance FIFO URL forwarding, and automatic CPU renderer fallback on WebProcess crash. [scripts/build-webarchy.sh](file:///home/lux/proj/geminux/scripts/build-webarchy.sh) also cross-compiles pure-C GNOME `gdk-pixbuf 2.42.12` (`-Dbuiltin_loaders=all`, zero `libglycin`/`librsvg`) so `gtk+3.0` and `gst-plugins-good` install cleanly without Rust, and [scripts/compile-gsettings-schemas.sh](file:///home/lux/proj/geminux/scripts/compile-gsettings-schemas.sh) compiles `/usr/share/glib-2.0/schemas/gschemas.compiled` for `WebKitNetworkProcess`.
- **Native media & `yt-dlp` stack**: Native Alpine Edge `mpv` (configured via [overlay/rootfs/etc/mpv/mpv.conf](file:///home/lux/proj/geminux/overlay/rootfs/etc/mpv/mpv.conf) for Panfrost X11 EGL, PipeWire/Pulse/ALSA, and `/tmp/geminux-mpv.sock` media-key IPC), `ffmpeg`/`ffprobe`, and `gst-libav` (for WebKit HTML5 media), paired with `mpg123`, `openmpt123`, `python3`/`py3-pip`, and `yt-dlp-core` + `yt-dlp-ejs-rt-quickjs` (`quickjs`, avoiding `deno`/`py3-cryptography`).
### Hardware subsystems
- **Graphics & display**: MediaTek DRM (`mediatek-drm`), `SSD2092` DSI FHD+ panel/touch, early-boot `simpledrm` (`DRM_SIMPLEDRM=y` + rotated `TER16x32` console), Mali-T880 `panfrost` GPU, and `sii902x` Slimport/HDMI bridge.
- **Wi-Fi / Bluetooth CONSYS**: Staged `mt6797_wlan_core` and `btmt6797` drivers backed by NVRAM/factory firmware provisioning (`geminux-wifi-nvram` and `firmware-cache/mt6797/`), hardened by `0007` and `0009`.
- **Modem / Telephony / eSIM / IMS**: `mt6797-ccci-cldma` exposes `/dev/ccci_md_ctl`, `/dev/ccci_fs`, `/dev/ccci_rpc`, `/dev/ttyC0..3`, and `ccmni*` via the 16-byte `struct mt6797_ccci_header` UAPI ([prebuilt/kernel/include/linux/mt6797_ccci.h](prebuilt/kernel/include/linux/mt6797_ccci.h)):
- [geminux-ccci-fs.c](src/geminux-daemons/geminux-ccci-fs.c) (`geminux-ccci-daemon`): MD1 boot HS v2, NVRAM/CCCI_FS I/O, and RPC (`MD_STATE=READY`).
- [geminux-cellctl.c](src/geminux-daemons/geminux-cellctl.c) (`geminux-cellctl`): physical SIM vs. ST33 eUICC `AT+ESIMS` switching, `lpac` AT-`CSIM`/`CGLA` APDU bridging, and `ccmni*` LTE PDN bring-up.
- [geminux-imsd.c](src/geminux-daemons/geminux-imsd.c) (`geminux-imsd`): 3GPP VoLTE (`ccmni*`) & VoWiFi (`SWu` IKEv2/IPsec via `strongswan`), MILENAGE AKA, kernel XFRM `ipsec-3gpp` (with RFC 4303 userspace ESP fallback), SIP signaling, `RP-DATA` SMS, and 20 ms `timerfd` AMR-NB/AMR-WB/G.711/DTMF RTP bridged to PipeWire/ALSA `VoiceCall`.
- **Boot, LUKS2 FDE & recovery**: LK-compatible images (`images/boot-geminux.img`, `images/recovery-geminux.img`) built with `mkbootimg-osm0sis` (`16 MiB` boot ceiling, `512 KiB` DTB ceiling). Built-in `BLK_DEV_DM=y`, `DM_CRYPT=y`, and ARMv8 AES-CE (`CRYPTO_AES_ARM64_CE_BLK=y`) power initramfs unlock (`cryptsetup` + `/etc/gemini-us.kmap`, `DM_DISABLE_UDEV=1`). [src/initramfs/init](src/initramfs/init) runs the off-mode charger guard, optionally unlocks `PARTLABEL=linux` -> `/dev/mapper/geminux_root`, checks ext4 (`e2fsck -p </dev/null`), and expands the filesystem on first boot (`resize2fs -f </dev/null`). [src/initramfs/init-recovery](src/initramfs/init-recovery) provides a USB NCM/RNDIS shell (`172.16.42.1/24`) with LUKS2-aware `unlock-root`, `check-fs`, and `mount-root`.
## Graphics, window management, and stability
### XLibre (`25.x`)
Cross-compiled against pure Alpine Edge `aarch64` sysroots with `modesetting_drv.so`, `fbdev_drv.so`, `libinput_drv.so`, and Panfrost Glamor EGL (`libglamoregl.so`) via [scripts/build-xlibre.sh](scripts/build-xlibre.sh). [10-geminux-gpu.conf](overlay/rootfs/etc/X11/xorg.conf.d/10-geminux-gpu.conf) sets `AccelMethod "none"`, `ShadowFB "true"`, `TearFree "true"`, `PageFlip "false"`, `SWcursor "true"`, and `Rotate "left"` to prevent rotated DSI tearing and Glamor fence spin-wait overhead while keeping Panfrost EGL/OpenGL 3D active for applications. Zero Wayland compositors are installed.
### Patched suckless desktop
- **`dwm`**:
- **Systray & stacking**: 32-bit ARGB XEmbed systray (`_NET_SYSTEM_TRAY_S0`), XEmbed reparent/input race protection, and automatic restacking below fullscreen lockscreen windows.
- **EWMH / ICCCM / NETWM**: `_NET_WORKAREA` dock struts, `_NET_WM_STATE_{FOCUSED,STICKY,ABOVE,HIDDEN}`, desktop/PID atoms, `WM_CHANGE_STATE`, `nofocuswin` fallback, and Wine/DXVK focus recovery.
- **X11 / Pango hardening**: `in_xerror` recursion guard with rate-limited non-fatal `RENDER` error ignoring, bounded `200 ms` `getservertime()` polling, async grab safety (`AsyncBoth` / `GrabModeAsync`), and Pango `PANGO_ELLIPSIZE_END` + `FC_COLOR=FcFalse` + UTF-8 sanitization in `drw.c` (avoiding XRender `BadLength` faults on color emoji glyphs).
- **Gemini UX**: `>= 78 px` touch top bar, `Mod4 = Fn+Alt` + one-shot `Super_L` tap-latch, `Fn+F` Airplane Mode binding, `Mod4 + Shift + r` & `SIGUSR1` `.Xresources` reload, and `SIGHUP` self-reexec.
- **`dmenu`**: Pango/HarfBuzz rendering with `82 px` touch rows, `dmenu_xerror` recursion & non-fatal `RENDER` guards, `FC_COLOR=FcFalse` + UTF-8 sanitization, and direct mouse/touch selection. Pairs with `geminux-launcher` pinning the 11 GUI apps alongside `Wallpaper`, `Webarchy Browser`, `Bantam AI agent`, and `Lynx Web Browser` in `st` (wrapping `Terminal=true` `.desktop` entries in `st -e`).
- **`st`**: HarfBuzz Fira Code ligatures (`hb.c`), Nerd Font fallback, mouse/two-finger wheel scrollback, immediate cursor redraw on `FocusIn`/`FocusOut` + unfocused blink gating, and live theme reloading via both direct `XA_RESOURCE_MANAGER` `PropertyNotify` and `SIGUSR1`.
- **Notifications**: Pure-X11 zero-`gdk-pixbuf` `dunst v1.12.2` (`WAYLAND=0 DUNSTIFY=0`) with custom pure-C PNG/JPEG icon loader ([src/dunst-notify/](src/dunst-notify/)) and lightweight GDBus `notify-send` / `dunstify`.
## Unified theming and native X11 wallpaper engine
Geminux defaults to the **Anodized** theme (`192 DPI`, `baseFontSize: 32`, `Xcursor.size: 64`) across `/etc/skel/.Xresources` and all compiled-in and script fallbacks. On login, `geminux-session` non-destructively copies newly added `/etc/skel/.xthemes/*.xth` themes into `~/.xthemes/` and loads `~/.Xresources` cleanly via `xrdb -nocpp -load`.
### Theme editor, importer & toolkit synchronization
- **Editor & Importer**: [geminux-xth.h](src/geminux-apps/geminux-xth.h) provides shared `.xth` parsing/serialization for `geminux-themes` (`Edit`, `Duplicate`, `New`, `Reset`/`Delete`, live WCAG contrast ratio against `bgMain`, and `Import .xth` stored under `~/.config/geminux/themes/`).
- **Synced targets**: `geminux-apply-theme` (`.xth` -> `~/.Xresources` + `xrdb -nocpp -load`) synchronizes:
- **Dunst**: `~/.config/dunst/dunstrc` via `geminux-sync-dunst-theme`
- **GTK2 / GTK3 / `xsettingsd`**: `Geminux-<Theme>` light/dark styling in `~/.gtkrc-2.0`, `~/.config/gtk-3.0/{settings.ini,gtk.css}`, and `~/.config/xsettingsd/xsettingsd.conf` (`SIGHUP` reload)
- **GTK4 & `libadwaita`**: `~/.config/gtk-4.0/{settings.ini,gtk.css}` + `dconf` `color-scheme` (`ADW_DISABLE_PORTAL=1` in [10-geminux-env.sh](overlay/rootfs/etc/profile.d/10-geminux-env.sh))
- **Qt5 / Qt6**: `qt6ct` 21-role `QPalette` (`QT_QPA_PLATFORMTHEME=qt6ct:gtk3`) and Kvantum (`QT_STYLE_OVERRIDE=kvantum`)
- **Tcl/Tk (`gtkTtk 0.9`)**: `*TkTheme: gtkTtk` + DPI-scaled widget geometry against `~/.gtkrc-2.0` with pure-X11 XImage blitting and zero-poll `XA_RESOURCE_MANAGER` live reload ([src/gtkTtk/](src/gtkTtk/))
- **X11 clients**: Instant redraw via `XA_RESOURCE_MANAGER` `PropertyNotify` and `SIGUSR1` (`dwm`, `st`, `webarchy`, `libgemui`)
### Native X11 + Cairo wallpaper engine
- **Core engine**: [geminux-wallpaper.h](src/geminux-apps/geminux-wallpaper.h) (pure-C11 config & placement geometry) + [geminux-wallpaper-x11.h](src/geminux-apps/geminux-wallpaper-x11.h) (X11/Cairo renderer) integrated into `geminux-themes` and exposed to CLI via `geminux-apply-wallpaper`.
- **Image decoders**: Decodes via runtime `dlopen("libgdk_pixbuf-2.0.so.0")` (EXIF auto-orientation + PNG/JPEG/GIF/BMP/ICO/XPM/XBM/TGA/PNM powered by `geminux-gdk-pixbuf`), Cairo PNG, `libjpeg-turbo`, `libwebp`, and optional `magick`/`convert` fallback.
- **Root Pixmap protocol**: Renders onto an X11 root `Pixmap` using a dedicated `Display` connection with `XSetCloseDownMode(..., RetainPermanent)`, publishing `_XROOTPMAP_ID` and `ESETROOT_PMAP_ID` and cleaning up previous clients via `XKillClient`. Supports multi-monitor geometry via XRandR and Xinerama.
- **Persistence & hooks**: Saves state to `~/.config/geminux/wallpaper.conf` and restores automatically on login (`geminux-session`), on theme changes when `USE_THEME_BG=1` (`geminux-apply-theme`), and after external HDMI `xrandr` layout switches (`geminux-net`).
### Webarchy, pure-C `gdk-pixbuf` & media stack
- **Webarchy**: [src/webarchy/webarchy.cpp](src/webarchy/webarchy.cpp) is a C++20 `GTK3` + `WebKit2GTK-4.1` browser tuned for `2160x1080` (`1080x506` logical @ `GDK_SCALE=2`) with a collapsible right-side vertical tab bar, `SIGUSR1` `.Xresources` reloading, SQLite cookies/bookmarks, single-instance FIFO forwarding, and WebProcess crash software fallback.
- **Pure-C `gdk-pixbuf` & schemas**: [scripts/build-webarchy.sh](scripts/build-webarchy.sh) cross-compiles pure-C GNOME `gdk-pixbuf 2.42.12` (`-Dbuiltin_loaders=all`, zero `libglycin`/`librsvg`), and [scripts/compile-gsettings-schemas.sh](scripts/compile-gsettings-schemas.sh) builds `/usr/share/glib-2.0/schemas/gschemas.compiled`.
- **Media & `yt-dlp`**: Native Alpine Edge `mpv` ([overlay/rootfs/etc/mpv/mpv.conf](overlay/rootfs/etc/mpv/mpv.conf) — Panfrost X11 EGL, PipeWire/Pulse/ALSA, `/tmp/geminux-mpv.sock` IPC), `ffmpeg`/`ffprobe`, `gst-libav`, `mpg123`, `openmpt123`, `python3`/`py3-pip`, and `yt-dlp` (`quickjs`, avoiding `deno`/`py3-cryptography`).
## Custom UI toolkit and zero-poll C11 daemons
- **`libgemui.so`** ([src/libgemui/](file:///home/lux/proj/geminux/src/libgemui)): Double-buffered Cairo + Pango/HarfBuzz Xlib toolkit polling X11 events, `SIGUSR1` self-pipe for instant `.Xresources` reloads, dynamic timers, `MSG_NOSIGNAL`/drained Unix socket IPC (`gemui_unix_cmd`), and non-blocking extra FDs (such as V4L2 or `inotify`).
- **11 landscape HiDPI applications** ([src/geminux-apps/](file:///home/lux/proj/geminux/src/geminux-apps)): `geminux-control` (including hardware Airplane Mode toggle), `geminux-audio`, `geminux-datetime`, `geminux-net` (5 tabs including Wi-Fi, Cellular/ST33 eSIM management, Airplane Mode banner, and `DNS` configuration), `geminux-dialer`, `geminux-callscreen`, `geminux-sms`, `geminux-contacts`, `geminux-camera` (MT6797 Media Controller pipeline + 10-bit Bayer demosaic/AWB software ISP), `geminux-themes`, and `geminux-lock`.
- **Zero-poll C11 daemons** ([src/geminux-daemons/](file:///home/lux/proj/geminux/src/geminux-daemons)):
- `geminux-powerd` — `epoll` over `/dev/input/event*` (`SW_LID`, `KEY_POWER`, `mtk-pmic-keys` `KEY_ESC` wakeup, keyboard/touch/pointer activity), filtered `KOBJECT_UEVENT` (`input` rescan lid-state reconciliation, `power_supply`, `drm`), `/run/geminux/powerd.sock`, and `timerfd`; enforces `inhibit_ac_lid` (blanks/locks without unloading CONSYS or invoking `/sys/power/state` while on USB/AC), tears down/reloads `mt6797_consys` and offlines non-boot CPUs across battery `mem` sleep or zero-thrash `low_power_standby` when `MD1` is powered (no `freeze`/`s2idle` fallback), manages persisted hardware Airplane Mode (`/var/lib/geminux/airplane-mode`, `/run/geminux/airplane-mode`) by unloading CONSYS Wi-Fi/BT kernel modules and placing MD1 in `AT+CFUN=4` while leaving `usb0` up, drives two-stage screensaver idle dim/lock/suspend timed from the last active user input, and resolves the active desktop user dynamically from UID `10000`.
- `geminux-statusd` — `epoll` over `signalfd` (`SIGUSR1`), `RTMGRP_LINK`/`RTMGRP_IPV4_IFADDR`, filtered `KOBJECT_UEVENT` (`power_supply`, `net`), `inotify`, and minute-aligned `timerfd`; displays `AIRPLANE` when hardware Airplane Mode is active and deduplicates root `WM_NAME` updates with zero child shell forks.
- `geminux-touchd` — XInput 2.2 multi-touch gesture daemon (2-finger tap/hold right-click, 3-finger middle-click, 2-finger scroll).
- `geminux-leds` — AW9120 back cover RGB controller driving `rgb:indicator-1..5` (default off when idle/full; `rgb:indicator-6` amber while charging; persistent manual override; `SIGPIPE`-safe socket server at `/run/geminux/leds.sock`).
- `geminux-ccci-daemon` — `epoll` over `/dev/ccci_*`, uevents, and `/run/geminux/ccci.sock`, serving MD1 boot HS v2, `CCCI_FS` NVRAM I/O, and RPC cleanly (idles if MD firmware is absent).
- `geminux-cellctl` & `geminux-imsd` — cellular/eSIM controller (`AT+ESIMS`, `lpac`, `ccmni*`) and event-driven IMS daemon (`/run/geminux/imsd.sock`).
- `geminux-modem-ctl`, `geminux-bt-obex` (GLib `GMainLoop`/GDBus), `geminux-dnsctl`, `geminux-power-ctl`, `geminux-power-audit`, `geminux-tzctl`, `geminux-wifi-nvram`, and `geminux-checkpw`.
- **`libgemui.so`** ([src/libgemui/](src/libgemui/)): Double-buffered Cairo + Pango/HarfBuzz Xlib toolkit with direct `XA_RESOURCE_MANAGER` `PropertyNotify` and `SIGUSR1` `.Xresources` live reloads, fullscreen lockscreen visibility restacking, button contrast guards, X11 clipboard paste, dynamic timers, `MSG_NOSIGNAL` socket IPC (`gemui_unix_cmd`), and non-blocking extra FDs.
- **11 landscape HiDPI apps** ([src/geminux-apps/](src/geminux-apps/)): `geminux-control`, `geminux-audio`, `geminux-datetime`, `geminux-net` (Wi-Fi, Cellular/ST33 eSIM, Bluetooth, HDMI, `DNS` tab, Airplane Mode), `geminux-dialer`, `geminux-callscreen`, `geminux-sms`, `geminux-contacts`, `geminux-camera`, `geminux-themes` (Themes, Theme Editor, `.xth` Importer & Wallpaper), and `geminux-lock`.
- **Zero-poll C11 daemons** ([src/geminux-daemons/](src/geminux-daemons/)):
- **`geminux-powerd`**: `epoll` over `/dev/input/event*` (`SW_LID`, `KEY_POWER`, `mtk-pmic-keys` `KEY_ESC`), filtered `KOBJECT_UEVENT` (`input`, `power_supply`, `drm`), `/run/geminux/powerd.sock`, and `timerfd`:
- Enforces `inhibit_ac_lid` (locks/blanks without unloading CONSYS or calling `/sys/power/state` while on USB/AC).
- Tears down `mt6797_consys` and parks `cpu1..9` offline before battery `mem` suspend or zero-thrash `low_power_standby` when `MD1` is active (never `freeze`/`s2idle`).
- Polls post-resume input/lid events (`90 ms`) even when the lid is open so only a `closed -> open` lid transition, real `EV_KEY`/`EV_REL`/`EV_ABS` activity, or USB/AC attach counts as a wake; internal timer wakes during open-lid idle lock re-suspend cleanly (`quiet_timer_resleep`) without reloading CONSYS or waking the backlight.
- Persists hardware Airplane Mode (`/var/lib/geminux/airplane-mode`) and resolves UID `10000` dynamically.
- **`geminux-statusd`**: `epoll` over `signalfd` (`SIGUSR1`), `RTMGRP_LINK`/`RTMGRP_IPV4_IFADDR`, filtered `KOBJECT_UEVENT` (`power_supply`, `net`), `inotify`, and minute-aligned `timerfd`; shows `AIRPLANE` status and deduplicates `WM_NAME` updates with zero shell forks.
- **`geminux-touchd`**: XInput 2.2 multi-touch gesture recognizer.
- **`geminux-leds`**: AW9120 back cover RGB controller (`/run/geminux/leds.sock`, off when idle/100%, amber `rgb:indicator-6` while charging, persistent manual override).
- **`geminux-ccci-daemon`, `geminux-cellctl`, `geminux-imsd`, `geminux-modem-ctl`, `geminux-bt-obex`, `geminux-dnsctl`, `geminux-power-ctl`, `geminux-power-audit`, `geminux-tzctl`, `geminux-wifi-nvram`, `geminux-checkpw`**: Event-driven platform daemons and control helpers.
## APK package pinning and package policy
To keep Alpine Edge `aarch64` userspace freely updatable while locking all hardware-tuned components:
1. Build-time host Docker containers use `postmarketos/v26.06` solely for `gcc-aarch64`, `binutils-aarch64`, and `mkbootimg-osm0sis`. All `$SYSROOT` trees and the target `$ROOTFS` use only pure **Alpine Edge** (`main`, `community`, `testing`) plus the RSA-4096 signed local `@geminux` repository (`/var/lib/geminux/apk-repo`).
2. [scripts/package-local-apks.sh](file:///home/lux/proj/geminux/scripts/package-local-apks.sh) builds eleven `.apk` packages via `apk mkpkg` and indexes them into `APKINDEX.tar.gz` via `apk mkndx`:
1. **Pure Edge rootfs**: Host Docker containers use `postmarketos/v26.06` only for `gcc-aarch64`, `binutils-aarch64`, and `mkbootimg-osm0sis`. Both `$SYSROOT` and target `$ROOTFS` come strictly from **Alpine Edge** (`main`, `community`, `testing`) plus the RSA-4096 signed local `@geminux` repo (`/var/lib/geminux/apk-repo`).
2. **Eleven signed local packages**: [scripts/package-local-apks.sh](scripts/package-local-apks.sh) builds and indexes:
- `geminux-kernel-modules`
- `geminux-xlibre`
- `geminux-suckless`
- `geminux-dunst`
- `geminux-ui`
- `geminux-bantam` (`bantam` minimalist C++20 CLI AI agent with `kilo-auto/free` default model, built via [scripts/build-bantam.sh](file:///home/lux/proj/geminux/scripts/build-bantam.sh))
- `geminux-gsocket` (`gs-netcat` / `gsocket` NAT traversal toolkit built via [scripts/build-gsocket.sh](file:///home/lux/proj/geminux/scripts/build-gsocket.sh))
- `geminux-gdk-pixbuf` (pure-C zero-glycin `gdk-pixbuf 2.42.12` built via [scripts/build-webarchy.sh](file:///home/lux/proj/geminux/scripts/build-webarchy.sh))
- `geminux-webarchy` (`webarchy` / `xwebarchy` browser built via [scripts/build-webarchy.sh](file:///home/lux/proj/geminux/scripts/build-webarchy.sh))
- `geminux-gtkttk` (`gtkTtk 0.9` dynamic GTK2 theme engine for Tk/Ttk/Tkinter built via [scripts/build-gtkttk.sh](file:///home/lux/proj/geminux/scripts/build-gtkttk.sh))
- `geminux-config` (includes `/etc/mpv/mpv.conf`, `/etc/htoprc`, `/etc/skel/.config/htop/htoprc`, `/etc/skel/.lynx.cfg`, `/etc/skel/.apexrc`, `/etc/skel/.bashrc` with `GPG_TTY`, `/etc/profile.d/10-geminux-env.sh` adding `sbin` paths for `dosfstools`, and `/etc/init.d/geminux-sdcard` + `/etc/udev/rules.d/95-geminux-sdcard.rules` + `/usr/sbin/geminux-sdcard-mount` for boot/`eudev` hotplug automounting of `/dev/mmcblk1p1` or superfloppy `/dev/mmcblk1` into `/media/sdcard` with `UID 10000` + `plugdev` `0660`/`0775` permissions across `vfat`, `exfat`, and POSIX `ext4`/`ext3`/`ext2`)
3. `/etc/apk/world` pins all eleven with `name@geminux=version` and locks out Rust/Wayland/upstream overrides (with `librsvg`, `rav1e`/`rav1e-libs`, and `libdovi` whitelisted) via `!` constraints from [scripts/rootfs-prune-packages.txt](file:///home/lux/proj/geminux/scripts/rootfs-prune-packages.txt). Verified automatically by an ELF binary Rust scan, `apk upgrade --simulate`, and 9 host Python unit suites in [scripts/check-rebuild.sh](file:///home/lux/proj/geminux/scripts/check-rebuild.sh).
4. `/etc/apk/protected_paths.d/geminux.list` shields Geminux configuration directories across upgrades.
- `geminux-bantam` ([scripts/build-bantam.sh](scripts/build-bantam.sh))
- `geminux-gsocket` ([scripts/build-gsocket.sh](scripts/build-gsocket.sh))
- `geminux-gdk-pixbuf` ([scripts/build-webarchy.sh](scripts/build-webarchy.sh))
- `geminux-webarchy` ([scripts/build-webarchy.sh](scripts/build-webarchy.sh))
- `geminux-gtkttk` ([scripts/build-gtkttk.sh](scripts/build-gtkttk.sh))
- `geminux-config` (`/etc/mpv/mpv.conf`, `/etc/htoprc`, `~/.lynx.cfg`, `~/.apexrc`, `~/.bashrc` with `GPG_TTY`, `/etc/profile.d/10-geminux-env.sh`, `/etc/init.d/geminux-sdcard` + `95-geminux-sdcard.rules` + `/usr/sbin/geminux-sdcard-mount`)
3. **World pins & exclusions**: `/etc/apk/world` exact-pins all 11 with `name@geminux=version` and blocks Rust/Wayland/override packages via `!` constraints from [scripts/rootfs-prune-packages.txt](scripts/rootfs-prune-packages.txt) (`librsvg`, `rav1e`/`rav1e-libs`, `libdovi` whitelisted). Enforced by ELF Rust scans, `apk upgrade --simulate`, and 9 host Python test suites in [scripts/check-rebuild.sh](scripts/check-rebuild.sh).
4. **Config protection**: `/etc/apk/protected_paths.d/geminux.list` shields Geminux config directories across `apk upgrade`.
## Pure-Linux flasher and eMMC layout
[flash-mtk.py](file:///home/lux/proj/geminux/flash-mtk.py) uses vendored GPLv3 `mtkclient` + single-chip `MTK_DA_V5_MT6797.bin` to communicate directly over USB BROM/DA without MediaTek's proprietary GUI. Protected partitions in `LBA 0..0x6FFFF` (`preloader`, `nvram`, `proinfo`, `lk`, `tee1`, `md1img`, etc.) are backed up and write-blocked by default (`0x0E000000` protected boundary verified in [scripts/test-flash-mtk-gpt.py](file:///home/lux/proj/geminux/scripts/test-flash-mtk-gpt.py)).
[flash-mtk.py](flash-mtk.py) embeds vendored GPLv3 `mtkclient` + `MTK_DA_V5_MT6797.bin` to communicate directly over USB BROM/DA. Protected partitions in `LBA 0..0x6FFFF` (`preloader`, `nvram`, `proinfo`, `lk`, `tee1`, `md1img`, etc.) are backed up and write-blocked by default (`0x0E000000` boundary verified in [scripts/test-flash-mtk-gpt.py](scripts/test-flash-mtk-gpt.py)).
On staged copies of `geminux-rootfs.img` (without mutating the build output), [scripts/geminux_accounts.py](file:///home/lux/proj/geminux/scripts/geminux_accounts.py) performs pure-Python `$6$` SHA-512 password hashing and offline `debugfs`/`e2fsck` `/etc/{passwd,group,shadow}` + `/home/<username>` provisioning, and [scripts/geminux_luks.py](file:///home/lux/proj/geminux/scripts/geminux_luks.py) optionally wraps the staged ext4 image in an encrypted LUKS2 container via unprivileged host `cryptsetup reencrypt --encrypt --disable-locks`.
On staged copies of `geminux-rootfs.img` (without modifying `images/geminux-rootfs.img`), [scripts/geminux_accounts.py](scripts/geminux_accounts.py) handles offline `$6$` SHA-512 `/etc/{passwd,group,shadow}` and `/home/<username>` provisioning via `debugfs`/`e2fsck`, and [scripts/geminux_luks.py](scripts/geminux_luks.py) optionally wraps the staged ext4 image in LUKS2 via unprivileged host `cryptsetup reencrypt --encrypt --disable-locks`.