**Bananarchy** is a keypad-first Linux distribution (`armv7` / Alpine `edge` / postmarketOS `v26.06` hardfork) for **Qualcomm MSM8905 (Snapdragon 205)** and **MSM8909 (Snapdragon 210)** smart feature phones with **240x320 QVGA non-touch SPI displays** and **12-key T9 keypads** (`nokia-argon`, `nokia-beatles`, `nokia-tough`, `nokia-sparkler`, `nokia-leo`).
It uses a pure **X11 (`Xlibre` + `sxmo-de-dwm`)** stack (no Wayland) optimized for `< 2 ms` UI wakeup latency and `< 95 MB` idle RAM on 512 MB devices.
## 2. Repository Layout
-`src/sxmo-dwm/`: Patched `dwm` window manager (`240x320` vertical `bstack` layout, 24px Pango status bar, desktop `"Menu"`/`"Names"` softkey bar, C-level `SW_LID` slider and locked-key wake handling, live `.Xresources` reload, and `.so` plugin loader via `dwm_plugin.h`).
-`src/sxmo-dmenu/`: Zero-lag resident DWM menu plugin (`dmenu.so`) and `/tmp/dwm_plugin_dmenu.sock` client (`dmenu` / `xdmenu`), featuring built-in Sxmo menus (`sys`, `applications`, `scripts`, `modem`, `config`, `power`, `st`, `nano`, `sthotkeys`) and `fcitx5-t9` XIM input.
-`src/dwm-plugins/`: Preloaded C++20 `240x320` DWM plugins and shared headers:
-`theme.h`: Unified `.Xresources` / `~/.xthemes/*.xth` parser, proportional font sizing (`theme.baseFontSize`), automatic shade derivation, and live Xft/Pango theme reloading (`PluginTheme`).
-`src/msm8905-cam/` & `src/leds-msm8905-torch/`: Out-of-tree Linux `6.12.1-msm8916` kernel modules for the rear `GC2395` camera (`/dev/video0`) and `SY7807` torch LED (`white:torch`) / WCD codec init / PM8909 `PON` shutdown.
-`overlay/rootfs/`: System configuration overlay applied over the target rootfs (kept in sync with `prebuilt/`).
-`devices/` & `patches/`: Device trees (`.dts`/`.dtb`), MIPI-DBI panel init sequences, and upstream patch sets.
## 3. Build & Image Generation Commands
All cross-compilation scripts run inside rootless Docker (`alpine:3.24``armv7` sysroot) and automatically update both `prebuilt/` and `overlay/rootfs/`:
-`./scripts/build-kernel-audio.sh` — Builds `6.12.1-msm8916` QDSP6 audio, torch LED, camera `.ko` modules, and device `.dtb` files.
-`./scripts/build-xlibre.sh` — Builds Xlibre `Xorg` and `libinput`/`fbdev` DDX drivers.
-`./scripts/build-bantam.sh` — Fetches and cross-compiles the `bantam` AI agent.
-`./scripts/generate-artwork.py` — Regenerates wallpapers, splashes, and icons from `artwork/icon-large.png`.
-`./chroot-shell.sh` — Opens an `armv7` container shell to manage packages in `rootfs/` (`pkg-add`, `pkg-del`, `pkg-search`).
-`./rebuild-image.sh <device> [--mkinitfs]` — Applies `overlay/rootfs/` + `prebuilt/` into `rootfs/` and produces flashable images in `images/`.
-`sudo ./flash-edl.sh [device]` — Flashes `lk2nd` and the system image over Qualcomm USB EDL (`05c6:9008`).
## 4. Coding & Architecture Conventions
- **Indentation**: Always use 2-space indentation in C, C++, Python, and shell scripts (tabs only in Makefiles and TSV files).
- **No Emojis**: Never use emojis in source code, UI strings, logs, or commit messages (use Nerd Font PUA codepoints defined in `phone_data.h` / `dmenu.c` for UI icons).
- **Unified Theming**: Never hardcode UI colors or font sizes in `dwm`, `dmenu`, `st`, or any DWM plugin. Read colors and proportional font sizes from `PluginTheme` (`src/dwm-plugins/theme.h`) / `.Xresources` (`theme.*`), and handle `RELOAD_THEME` on the plugin FIFO.
- **Zero-Lag Plugin Model**: Phone UI apps must run as preloaded resident daemons (`--preload`) guarded by `/tmp/dwm_plugin_<name>.lock`, sleeping at 0% CPU on `poll()` over `ConnectionNumber(dpy)` and `/tmp/dwm_plugin_<name>.fifo`, and rendering into an offscreen `Pixmap` (`240x296` at `X=0, Y=24`) copied with `XCopyArea` to prevent flicker.
- **Documentation**: Keep `README.md` and `MANUAL.md` synchronized with any new user-facing features or keybindings, and do not leave third-party `.md` files inside `src/` or `edl/`.