diff --git a/AGENTS.md b/AGENTS.md index 57ece4a..50f3d43 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,46 +1,47 @@ -# Bananarchy Linux — Agent Guide (`AGENTS.md`) +# Bananarchy Linux — agent guide (`AGENTS.md`) -## 1. Project Overview +## 1. Project overview **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`, `audio`, `notifications`, `wm`, `timezone`, `games`, `st`, `nano`, `sthotkeys`) and `fcitx5-t9` XIM input. +## 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`, `audio`, `notifications`, `wm`, `timezone`, `games`, `st`, `nano`, `sthotkeys`) and `fcitx5-t9` XIM input. - `src/neoui/`: **NeoUI** `240x320` UI SDK (`neoui.h` -> `/usr/include/neoui.h`, `neoui.cpp` -> `/usr/lib/libneoui.so`) providing both a C-compatible FFI (`neoui_*`) and C++20 classes (`ThemeSpec`, `PluginTheme`, `NeoWindow`) for `.Xresources` / `~/.xthemes/*.xth` theme resolution, Xlib/Xft/Pango window and offscreen `Pixmap` double buffering, standardized OS shell widgets, keypad/softkey chord handling, and multi-tap input. -- `src/dwm-plugins/`: Preloaded C++20 `240x320` DWM plugins linked against `libneoui.so` and shared headers: - - `theme.h`: Header forwarding to `../neoui/neoui.h` for unified `.Xresources` / `~/.xthemes/*.xth` parsing, proportional font sizing (`theme.baseFontSize`), automatic shade derivation, and live Xft/Pango theme reloading (`PluginTheme`). - - `phone_data.h`: Shared X11 geometry (`240x296` below the 24px bar), FIFO IPC (`/tmp/dwm_plugin_.fifo`), softkey chord detection, Sxmo TSV contact/call/SMS parsers, and `libjpeg`/`libpng` helpers. +- `src/dwm-plugins/`: preloaded C++20 `240x320` DWM plugins linked against `libneoui.so` and shared headers: + - `theme.h`: header forwarding to `../neoui/neoui.h` for unified `.Xresources` / `~/.xthemes/*.xth` parsing, proportional font sizing (`theme.baseFontSize`), automatic shade derivation, and live Xft/Pango theme reloading (`PluginTheme`). + - `phone_data.h`: shared X11 geometry (`240x296` below the 24px bar), FIFO IPC (`/tmp/dwm_plugin_.fifo`), softkey chord detection, Sxmo TSV contact/call/SMS parsers, and `libjpeg`/`libpng` helpers. - `dialer_plugin.cpp` (`dialer.so` / `xdialer`), `calllog_plugin.cpp` (`calllog.so` / `xcalllog`), `callscreen_plugin.cpp` (`callscreen.so` / `xcallscreen`), `contacts_plugin.cpp` (`contacts.so` / `xcontacts`), `sms_plugin.cpp` (`sms.so` / `xsms`), `files_plugin.cpp` (`files.so` / `xfiles`), `camera_plugin.cpp` (`camera.so` / `xcamera`), `themes_plugin.cpp` (`themes.so` / `xthemes`), `modem_plugin.cpp` (`modem.so` / `xmodem`), `networks_plugin.cpp` (`networks.so` / `xnetworks` / `xbluetooth`), `ringtones_plugin.cpp` (`ringtones.so` / `xringtones`), `wallpapers_plugin.cpp` (`wallpapers.so` / `xwallpapers` / `xbackground`), `music_plugin.cpp` (`music.so` / `xmusic` / `xplayer`). - - `dwm_plugin_runner.c`: Lightweight `/usr/bin/dwm-plugin` launcher symlinked by `xdrawer`, `xdialer`, `xcalllog`, `xcallscreen`, `xcontacts`, `xsms`, `xfiles`, `xcamera`, `xthemes`, `xmodem`, `xnetworks`, `xbluetooth`, `xringtones`, `xwallpapers`, `xbackground`, `xmusic`, `xplayer`, `dmenu`, and `xdmenu`. -- `src/xdrawer/`: Global phone controls overlay (`xdrawer.so` / `xdrawer`), toggled by pressing both softkeys simultaneously. -- `src/sxmo-st/`: Patched `st` terminal with HarfBuzz OpenType ligatures (`Fira Code`), `XIM` (`fcitx5-t9`), and live `SIGUSR1` `.Xresources` reload. + - `dwm_plugin_runner.c`: lightweight `/usr/bin/dwm-plugin` launcher symlinked by `xdrawer`, `xdialer`, `xcalllog`, `xcallscreen`, `xcontacts`, `xsms`, `xfiles`, `xcamera`, `xthemes`, `xmodem`, `xnetworks`, `xbluetooth`, `xringtones`, `xwallpapers`, `xbackground`, `xmusic`, `xplayer`, `dmenu`, and `xdmenu`. +- `src/xdrawer/`: global phone controls overlay (`xdrawer.so` / `xdrawer`), toggled by pressing both softkeys simultaneously. +- `src/sxmo-st/`: patched `st` terminal with HarfBuzz OpenType ligatures (`Fira Code`), `XIM` (`fcitx5-t9`), and live `SIGUSR1` `.Xresources` reload. - `src/fcitx5-t9/`: 6-mode keypad input method (`abc`, `Abc`, `ABC`, `Sym`, `Ctl`, `123` + `*` long-press `Ctrl+` latch) with fixed bottom preedit bar (`Y=290, H=30`). -- `src/games/`: Standalone keypad-driven `240x320` X11 games and emulators (`snake.cpp` -> `/usr/bin/snake`, `tetris.cpp` -> `/usr/bin/tetris`, `gambatte_phone.cpp` + `gambatte/` -> `/usr/bin/gambatte` / `/usr/bin/gbemu`) with built-in 5x7 bitmap fonts, `timerfd`-driven pacing, and offscreen `Pixmap` double buffering. -- `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/`). -- `prebuilt/`: Cross-compiled `armv7` binaries and kernel modules (`sxmo-x11`, `fcitx5-t9`, `xlibre`, `kernel-6.12.1-msm8916`, `bantam`, `games`). -- `devices/` & `patches/`: Device trees (`.dts`/`.dtb`), MIPI-DBI panel init sequences, and upstream patch sets. +- `src/games/`: standalone keypad-driven `240x320` X11 games and emulators (`snake.cpp` -> `/usr/bin/snake`, `tetris.cpp` -> `/usr/bin/tetris`, `gambatte_phone.cpp` + `gambatte/` -> `/usr/bin/gambatte` / `/usr/bin/gbemu`) with built-in 5x7 bitmap fonts, `timerfd`-driven pacing, and offscreen `Pixmap` double buffering. +- `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/`). +- `prebuilt/`: cross-compiled `armv7` binaries and kernel modules (`sxmo-x11`, `fcitx5-t9`, `xlibre`, `kernel-6.12.1-msm8916`, `bantam`, `games`). +- `devices/` & `patches/`: device trees (`.dts`/`.dtb`), MIPI-DBI panel init sequences, and upstream patch sets. -## 3. Build & Image Generation Commands +## 3. Build and 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-sxmo-x11.sh` — Builds `st`, `dmenu.so`, `dwm`, `dwm-plugin`, `sxmo_vibrate`, and all C++ `.so` plugins (`xdrawer`, `dialer`, `calllog`, `callscreen`, `contacts`, `sms`, `files`, `camera`, `themes`, `modem`, `networks`, `ringtones`, `wallpapers`, `music`). -- `./scripts/build-dmenu.sh` — Rebuilds only `dmenu.so`, `stest`, `dmenu_path`, and `dmenu_run`. -- `./scripts/build-games.sh` — Builds standalone X11 games and emulators in `src/games/` (`snake`, `tetris`, `gambatte` / `gbemu`). -- `./scripts/build-fcitx5-t9.sh` — Builds `src/fcitx5-t9` (`libt9.so` / `t9.so`). -- `./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`. -- `./scripts/version.sh [--print | target_rootfs]` — Computes the date-based release version (`
` with `2026 = a`) and substitutes `@BANANARCHY_VERSION@` in `etc/os-release`, `etc/issue`, and `etc/motd` (invoked automatically during overlay application and image builds). -- `./chroot-shell.sh` — Opens an `armv7` container shell to manage packages in `rootfs/` (`pkg-add`, `pkg-del`, `pkg-search`). -- `./rebuild-image.sh [--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`). +- `./scripts/build-sxmo-x11.sh` — builds `libneoui.so`, `st`, `dmenu.so`, `dwm`, `dwm-plugin`, `sxmo_vibrate`, and all C++ `.so` plugins (`xdrawer`, `dialer`, `calllog`, `callscreen`, `contacts`, `sms`, `files`, `camera`, `themes`, `modem`, `networks`, `ringtones`, `wallpapers`, `music`). +- `./scripts/build-dmenu.sh` — rebuilds only `dmenu.so`, `stest`, `dmenu_path`, and `dmenu_run`. +- `./scripts/build-games.sh` — builds standalone X11 games and emulators in `src/games/` (`snake`, `tetris`, `gambatte` / `gbemu`). +- `./scripts/build-fcitx5-t9.sh` — builds `src/fcitx5-t9` (`libt9.so` / `t9.so`). +- `./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`. +- `./scripts/version.sh [--print | target_rootfs]` — computes the date-based release version (`
` with `2026 = a`) and substitutes `@BANANARCHY_VERSION@` in `etc/os-release`, `etc/issue`, and `etc/motd` (invoked automatically during overlay application and image builds). +- `./chroot-shell.sh` — opens an `armv7` container shell to manage packages in `rootfs/` (`pkg-add`, `pkg-del`, `pkg-search`). +- `./rebuild-image.sh [--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_.lock`, sleeping at 0% CPU on `poll()` over `ConnectionNumber(dpy)` and `/tmp/dwm_plugin_.fifo`, and rendering into an offscreen `Pixmap` (`240x296` at `X=0, Y=24`) copied with `XCopyArea` to prevent flicker. -- **Documentation**: Keep `README.md`, `MANUAL.md`, and `SDK.md` synchronized with any new user-facing features, SDK functions, or keybindings, and do not leave third-party `.md` files inside `src/` or `edl/`. +## 4. Coding and architecture conventions +- **Indentation**: always use 2-space indentation in C, C++, Python, Yabasic, 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 `neoui.h` / `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/neoui/neoui.h` / `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_.lock`, sleeping at 0% CPU on `poll()` over `ConnectionNumber(dpy)` and `/tmp/dwm_plugin_.fifo`, and rendering into an offscreen `Pixmap` (`240x296` at `X=0, Y=24`) copied with `XCopyArea` to prevent flicker. +- **Documentation**: keep `README.md`, `MANUAL.md`, `SDK.md`, and `CHANGELOG.md` synchronized with any new user-facing features, SDK functions, or keybindings, and do not leave third-party `.md` files inside `src/` or `edl/`. +- **Sentence case**: always use sentence case in subheadings and list items across all documentation files (`README.md`, `MANUAL.md`, `SDK.md`, `CHANGELOG.md`, `AGENTS.md`). diff --git a/CHANGELOG.md b/CHANGELOG.md index f47090a..65bea3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,21 +11,21 @@ Release versions follow the `
` format (where `2026` is `a`, - **Download the recent images for your device from this link**: https://cloud.disroot.org/s/dB7bM7sRTScetDJ ### New features and improvements -- **Anti-spam blocklist in Call Log (`xcalllog`) and SMS (`xsms`)**: +- **Anti-spam blocklist in call log (`xcalllog`) and SMS (`xsms`)**: - Unified number blocklist (`~/.config/sxmo/block.tsv`) supporting exact numbers, 9-digit suffix matching across local/international formats, and prefix wildcards (`*`). - Automatic rejection of incoming calls from blocked numbers via `sxmo_hook_block_call.sh`, logging blocked attempts into the `Spam` tab (`~/.local/share/sxmo/block/modemlog.tsv`) without ringing or missed-call alerts. - Silent routing of incoming SMS messages from blocked senders into the `Spam` folder (`~/.local/share/sxmo/block`), with one-key thread blocking, unblocking, and restoration between `Inbox` and `Spam` in `xsms`. - **Native Game Boy / Game Boy Color emulator (`gambatte` / `gbemu`)**: - - Full-featured C++ Game Boy / Game Boy Color emulator tailored for `240x320` non-touch displays, integrated into **System menu -> Games** and **File Manager (`xfiles`)** for `.gb` and `.gbc` files. + - Full-featured C++ Game Boy / Game Boy Color emulator tailored for `240x320` non-touch displays, integrated into **System menu -> Games** and **file manager (`xfiles`)** for `.gb` and `.gbc` files. - Readjustable keypad controls persisted in `~/.config/sxmo/gambatte.cfg` with defaults `B = 8`, `Turbo B = 5`, `A = 9`, `Turbo A = 6`, `Directions = D-Pad`, `Start = 2`, `Select = 3`, `Palette = *`, and `Fast Forward = 0`. - 10 built-in DMG color palettes, 4 screen scaling modes (`Fit 240x216` 1.5x area-interpolated, `1:1 160x144`, `Fill 240x246`, `Full 240x296`), 10 save-state slots (`.st0`–`.st9`), automatic battery SRAM/RTC persistence, seamless `Xdrawer` focus handoff, and direct low-latency `libasound` (`hw:0,0`) audio with hardware volume synchronization and analog-stage low-pass filtering. - Preinstalled open-source / public-domain GB and GBC games in `/usr/share/games/gb/` and `~/Games/` (`2048.gb`, `adjustris.gb`, `blastah.gb`, `brickster.gbc`, `geometrix.gbc`, `ucity.gbc`). -- **Preinstalled scripting, calculation tools, and File Manager (`xfiles`) integration**: +- **Preinstalled scripting, calculation tools, and file manager (`xfiles`) integration**: - Added **Lua** (`lua5.5` and `lua5.4` with `/usr/bin/lua` and `/usr/bin/luac`), **GNU `bc` / `dc`**, and **Yabasic (`yabasic`)** to the default system image. - - Selecting any `.yab` file in **File Manager (`xfiles`)** (or choosing **Run in Yabasic (Terminal)** in its Actions menu) runs `yabasic` inside the `st` terminal and pauses on exit so output can be inspected. - - Added an **integrated GUI Text Editor (`Edit in Text Editor`)** inside `xfiles`, available as an action on any file (and automatically opened when creating a **New File** or pressing **Edit** in the text viewer), featuring line numbers, 2D cursor navigation, 5 multi-tap input modes (`[abc]`, `[Abc]`, `[ABC]`, `[123]`, `[Sym]`), a scrolling bottom candidate bar for long symbol tables (`1` key), and an **Editor Menu** (`Save File`, `Save & Close`, `Insert New Line`, `Insert Space`, `Duplicate Line`, `Delete Line`, `Close Without Saving`). + - Selecting any `.yab` file in **file manager (`xfiles`)** (or choosing `Run in Yabasic (Terminal)` in its actions menu) runs `yabasic` inside the `st` terminal and pauses on exit so output can be inspected. + - Added an **integrated GUI text editor (`Edit in Text Editor`)** inside `xfiles`, available as an action on any file (and automatically opened when creating a new file or pressing `Edit` in the text viewer), featuring line numbers, 2D cursor navigation, 5 multi-tap input modes (`[abc]`, `[Abc]`, `[ABC]`, `[123]`, `[Sym]`), a scrolling bottom candidate bar for long symbol tables (`1` key), and an editor menu (`Save File`, `Save & Close`, `Insert New Line`, `Insert Space`, `Duplicate Line`, `Delete Line`, `Close Without Saving`). - **NeoUI `240x320` UI SDK (`libneoui.so` + `/usr/include/neoui.h` + `neoui.yab`)**: - - Standardized all Bananarchy `240x320` X11/Xft/Pango UI components, `.Xresources` / `~/.xthemes/*.xth` live theme resolution, offscreen `Pixmap` double-buffering, FIFO IPC, softkey chord detection (`xdrawer`), and multi-tap input into a shared library (`/usr/lib/libneoui.so`) and header (`/usr/include/neoui.h`) with both C++20 classes and a C-compatible FFI (`neoui_*`). + - Standardized all Bananarchy `240x320` X11/Xft/Pango UI components, `.Xresources` / `~/.xthemes/*.xth` live theme resolution, offscreen `Pixmap` double buffering, FIFO IPC, softkey chord detection (`xdrawer`), and multi-tap input into a shared library (`/usr/lib/libneoui.so`) and header (`/usr/include/neoui.h`) with both C++20 classes and a C-compatible FFI (`neoui_*`). - Migrated all 14 custom GUI plugins (`xdrawer`, `dialer`, `calllog`, `callscreen`, `contacts`, `sms`, `files`, `camera`, `themes`, `modem`, `networks`, `ringtones`, `wallpapers`, `music`) to use `NeoUI`. - Added a complete Yabasic native C FFI wrapper (`~/Projects/neoui.yab`, symlinked at `/usr/lib/neoui.yab`), an interactive 3-tab showcase program (`~/Projects/neoui_demo.yab`), and full SDK documentation in `SDK.md`. - **Camera viewfinder and capture orientation fix (`xcamera` and `bananarchy-photo`)**: diff --git a/MANUAL.md b/MANUAL.md index 68c4702..3ab711e 100644 --- a/MANUAL.md +++ b/MANUAL.md @@ -162,17 +162,17 @@ All fifteen phone applications are compiled as shared-object plugins (`/usr/lib/ 7. **SMS manager, composer, and spam filter (`sms.so` / `xsms`)**: - **Open**: select **Texts** from the System menu, or choose **Send SMS** / **Read Messages** from Contacts. - - **Conversations, Inbox, and Spam Folder**: browse SMS threads and drafts with contact name resolution, unread indicators, and message bubbles (`Recv` and `Sent`). Press `Left`/`Right` in the thread list (or use **Left softkey (`Options`)**) to switch between **`Inbox`** (`~/.local/share/sxmo/modem`) and the **`Spam`** folder (`~/.local/share/sxmo/block`). + - **Conversations, inbox, and spam folder**: browse SMS threads and drafts with contact name resolution, unread indicators, and message bubbles (`Recv` and `Sent`). Press `Left`/`Right` in the thread list (or use **Left softkey (`Options`)**) to switch between **`Inbox`** (`~/.local/share/sxmo/modem`) and the **`Spam`** folder (`~/.local/share/sxmo/block`). - **Anti-spam blocking**: press **Left softkey (`Options`)** on any thread or conversation to **Block Number (Spam)** (which adds the sender to `~/.config/sxmo/block.tsv` and moves their thread into the `Spam` folder), **Unblock & Restore** (which unblocks the sender and restores their thread to `Inbox`), **Manage Blocklist (N)**, or **Block a Number...**. Incoming texts from blocked numbers are silently routed into `~/.local/share/sxmo/block` without ringing or vibrating. - **Multi-tap composer**: pick a recipient from Contacts/Recents or type a number (hold `0` for `+`), compose messages with multi-tap keypad entry (`#` cycles input mode), monitor live character/segment counts (`0/160`), save drafts automatically, and send via **Call (green)**, **Center `OK`**, or **Left softkey**. 8. **File manager (`files.so` / `xfiles`)**: - **Open**: select **Files** from the System menu or press `Mod4+d`. - **Controls and viewers**: navigate directories with `Up`/`Down`/`Left`/`Right`/`Return`, filter with `0`–`9`, toggle dotfiles with `*`, and cycle sort order (**Name** / **Date** / **Size**) with `#`. - - **Integrated GUI Text Editor (`Edit in Text Editor`)**: available as an action in the **Left softkey (`Actions`)** menu for **any non-directory file** (as well as via **Left softkey (`Edit`)** from the built-in text viewer, or automatically after **New File**): + - **Integrated GUI text editor (`Edit in Text Editor`)**: available as an action in the **Left softkey (`Actions`)** menu for **any non-directory file** (as well as via **Left softkey (`Edit`)** from the built-in text viewer, or automatically after **New File**): - **Navigation**: `Up`/`Down`/`Left`/`Right` moves the cursor across lines and UTF-8 characters with automatic vertical and horizontal viewport scrolling and line numbers (`Ln:Col`). - **Multi-tap keypad text entry**: type with `0`–`9` and `*` (with a live bottom candidate bar), press `#` to cycle input modes (`[abc]` -> `[Abc]` -> `[ABC]` -> `[123]` -> `[Sym]`), press **Center `OK` (`Return`)** to split the line / insert a newline, and press **Right softkey (`Del`)** or `BackSpace` to delete the character before the cursor (or join with the previous line at column `0`). - - **Editor Menu (`Left softkey`)**: opens the **Editor Menu** with **Save File** (press **Left softkey** twice to save immediately), **Save & Close**, **Insert New Line**, **Insert Space**, **Duplicate Line**, **Delete Line**, and **Close Without Saving**. + - **Editor menu (`Left softkey`)**: opens the editor menu with **Save File** (press **Left softkey** twice to save immediately), **Save & Close**, **Insert New Line**, **Insert Space**, **Duplicate Line**, **Delete Line**, and **Close Without Saving**. - **Yabasic (`.yab`) script execution**: pressing `Return` on any `.yab` file (or selecting **Run in Yabasic (Terminal)** from the **Left softkey (`Actions`)** menu) launches `yabasic` inside `st` in the file's directory and waits for `Enter` after completion so output can be inspected. - **Game Boy / Game Boy Color ROM launching**: pressing `Return` on any `.gb` or `.gbc` file (or selecting **Play in Game Boy Emulator** from the **Left softkey (`Actions`)** menu) opens it directly in the **Gambatte (`gambatte`)** emulator. - **Image preview and wallpaper installation**: pressing `Return` on any image file (`.jpg`, `.png`, `.bmp`, `.gif`, `.webp`, `.ppm`, `.tif`, `.ico`, `.svg`) opens the built-in image viewer (`*` toggles full-screen preview; **Left softkey (`Set Wall`)** installs the image into `~/Pictures/Wallpapers/`, applies it via `feh`, and refreshes Conky). You can also select **Preview Image** or **Set as Wallpaper** directly from the **Left softkey (`Actions`)** menu. @@ -225,16 +225,16 @@ Two classic X11 games (`/usr/bin/snake` and `/usr/bin/tetris`) and the full-feat - **Game Boy / Game Boy Color emulator (`gambatte` / `gbemu`)**: - **Launch**: open **Game Boy (Gambatte)** from **System menu -> Games**, open any `.gb` or `.gbc` file from **Files (`xfiles`)**, or run `gambatte [rom.gb|rom.gbc]`. When launched without a file argument, opens a built-in ROM browser scanning `/usr/share/games/gb`, `~/Games`, `~/ROMs`, `~/Downloads`, and user directories. - **Default keypad controls** (fully readjustable via **Pause Menu -> Keypad Controls...** or **Left softkey (`Controls`)** in the ROM browser; persisted in `~/.config/sxmo/gambatte.cfg`): - - **B Button**: `8` + - **B button**: `8` - **Turbo B**: `5` - - **A Button**: `9` + - **A button**: `9` - **Turbo A**: `6` - **Directions (`Up`/`Down`/`Left`/`Right`)**: `D-Pad` (`Up`, `Down`, `Left`, `Right`) - **Start**: `2` - **Select**: `3` - - **Palette Selection**: `*` (cycles through 10 built-in color palettes: `DMG Classic`, `Bananarchy Gold`, `GB Pocket Gray`, `GB Light Teal`, `GBC Blue/Red`, `Super Game Boy`, `Amber CRT`, `Mintberry`, `Virtual Boy`, `Inverted Dark`) - - **Fast Forward (2x)**: `0` (while held) - - **Quick Shortcuts (when unbound)**: `1` cycles screen scaling mode (`Fit 240x216` 1.5x area-interpolated, `1:1 160x144`, `Fill 240x246`, `Full 240x296`); `4` saves state to the active slot; `7` loads state from the active slot; `#`, `BackSpace`, `Escape`, or either softkey opens the **Gambatte Pause Menu** (Save/Load State across 10 slots `.st0`..`.st9`, Palette, Screen Scale, Audio toggle, Keypad Controls remapping, Load Another ROM, and Quit). Battery-backed SRAM (`.sav`) and RTC (`.rtc`) are saved automatically in `~/.local/share/sxmo/gambatte/saves/`. + - **Palette selection**: `*` (cycles through 10 built-in color palettes: `DMG Classic`, `Bananarchy Gold`, `GB Pocket Gray`, `GB Light Teal`, `GBC Blue/Red`, `Super Game Boy`, `Amber CRT`, `Mintberry`, `Virtual Boy`, `Inverted Dark`) + - **Fast forward (2x)**: `0` (while held) + - **Quick shortcuts (when unbound)**: `1` cycles screen scaling mode (`Fit 240x216` 1.5x area-interpolated, `1:1 160x144`, `Fill 240x246`, `Full 240x296`); `4` saves state to the active slot; `7` loads state from the active slot; `#`, `BackSpace`, `Escape`, or either softkey opens the **Gambatte Pause Menu** (Save/Load State across 10 slots `.st0`..`.st9`, Palette, Screen Scale, Audio toggle, Keypad Controls remapping, Load Another ROM, and Quit). Battery-backed SRAM (`.sav`) and RTC (`.rtc`) are saved automatically in `~/.local/share/sxmo/gambatte/saves/`. ### 3.2 Multi-mode `fcitx5-t9` keypad reference diff --git a/README.md b/README.md index c45e683..f35ca40 100644 --- a/README.md +++ b/README.md @@ -23,17 +23,17 @@ Instead of spawning slow shell scripts for everyday phone tasks, Bananarchy runs a suite of preloaded C/C++ plugins inside DWM that sleep at 0% CPU and open in `< 2 ms`: - **System and context menus (`dmenu`)**: instant full-screen 10-line vertical menus with live T9 filtering, built-in submenus, and hardware toggles. - **Global controls drawer (`xdrawer`)**: press **both softkeys together** from anywhere to adjust speaker, earpiece, and ringtone volume, ringer mode (`Ring+Vib` / `Vibrate` / `Silent` / `DND`), 3-level vibration intensity (`Light` / `Medium` / `Strong`), flashlight, sound and microphone mute, screen brightness, and keypad backlight. -- **Phone dialer (`xdialer`), call log (`xcalllog`), and call screen (`xcallscreen`)**: press any digit on the home screen to start dialing with live T9 contact matching, run interactive carrier USSD codes (`*100#`, etc.), or type `*#06#` to inspect both IMEIs. Incoming and active calls open a dedicated call screen with earpiece/speaker switching, microphone mute, DTMF keypad, and one-key normalized WAV call recording (`~/Recordings/rec_HHMMSS_.wav`). The Call Log includes a 5-tab view (`All`, `Miss`, `In`, `Out`, `Spam`) with integrated anti-spam number blocking (`~/.config/sxmo/block.tsv`) that automatically hangs up blocked callers and logs them to the `Spam` tab without triggering missed-call notifications. -- **Contacts (`xcontacts`) and SMS manager (`xsms`)**: full phonebook editor with direct Qualcomm QMI SIM card contact import and export across SIM 1 and SIM 2, paired with a threaded SMS conversation view, multi-tap message composer, and built-in anti-spam blocklist / `Spam Folder` (`~/.local/share/sxmo/block`) with one-key thread blocking and restoration. +- **Phone dialer (`xdialer`), call log (`xcalllog`), and call screen (`xcallscreen`)**: press any digit on the home screen to start dialing with live T9 contact matching, run interactive carrier USSD codes (`*100#`, etc.), or type `*#06#` to inspect both IMEIs. Incoming and active calls open a dedicated call screen with earpiece/speaker switching, microphone mute, DTMF keypad, and one-key normalized WAV call recording (`~/Recordings/rec_HHMMSS_.wav`). The call log includes a 5-tab view (`All`, `Miss`, `In`, `Out`, `Spam`) with integrated anti-spam number blocking (`~/.config/sxmo/block.tsv`) that automatically hangs up blocked callers and logs them to the `Spam` tab without triggering missed-call notifications. +- **Contacts (`xcontacts`) and SMS manager (`xsms`)**: full phonebook editor with direct Qualcomm QMI SIM card contact import and export across SIM 1 and SIM 2, paired with a threaded SMS conversation view, multi-tap message composer, and built-in anti-spam blocklist / spam folder (`~/.local/share/sxmo/block`) with one-key thread blocking and restoration. - **Modem and Dual-SIM manager (`xmodem`)**: 4-tab cellular control center (`SIMs`, `Radio`, `AT`, `Log`) supporting physical SIM 1 / SIM 2 active slot switching, SIM PIN unlock and PUK unblock wizards, 2G/3G/4G radio mode selection, interactive USSD sessions, and a live AT command console. - **Networks and Bluetooth manager (`xnetworks`)**: 3-tab connectivity manager for Wi-Fi networks, WPA2 password entry, Wi-Fi hotspot, USB tethering, 4G/LTE mobile data (`wwan0`) and APN editing, and Bluetooth pairing. -- **File manager (`xfiles`), music and tracker player (`xmusic`), and camera (`xcamera`)**: keypad directory browser with built-in text viewer, integrated GUI multi-tap text editor (**Edit in Text Editor**, available as an action on any file), and image viewer (plus one-click actions to launch `.gb`/`.gbc` ROMs in the Game Boy emulator, run `.yab` scripts in Yabasic inside the terminal, play audio, preview images, set any image as wallpaper, or install any audio or tracker file as ringtone), a 3-tab music and chiptune tracker module player (`WAV`, `MP3`, `OGG`, `FLAC`, `Opus`, `MOD`, `XM`, `IT`, `S3M`, and more), and a live V4L2 camera viewfinder with digital zoom, flash/torch control, self-timer, and photo gallery. +- **File manager (`xfiles`), music and tracker player (`xmusic`), and camera (`xcamera`)**: keypad directory browser with built-in text viewer, integrated GUI multi-tap text editor (`Edit in Text Editor`, available as an action on any file), and image viewer (plus one-click actions to launch `.gb`/`.gbc` ROMs in the Game Boy emulator, run `.yab` scripts in Yabasic inside the terminal, play audio, preview images, set any image as wallpaper, or install any audio or tracker file as ringtone), a 3-tab music and chiptune tracker module player (`WAV`, `MP3`, `OGG`, `FLAC`, `Opus`, `MOD`, `XM`, `IT`, `S3M`, and more), and a live V4L2 camera viewfinder with digital zoom, flash/torch control, self-timer, and photo gallery. - **Themes (`xthemes`), wallpapers (`xwallpapers`), and ringtones (`xringtones`)**: installable `.Xresources` color and font themes (`~/.xthemes/*.xth`, 20 preinstalled schemes) with live zero-restart reload across the entire UI and terminal, alongside dedicated managers for desktop wallpapers and call ringtones (supporting both standard audio and tracker modules) with 3-level vibration control. ### Input, terminal, and developer tools - **6-mode `fcitx5-t9` keypad input**: press `#` to cycle between `abc`, `Abc`, `ABC`, `Sym` (all 32 ASCII punctuation symbols), `Ctl` (`Ctrl` sequences, arrows, `PageUp`/`PageDown`, `F1`–`F12`), and `123` numeric modes with a fixed bottom candidate bar. - **First-class Linux terminal (`st`)**: patched with HarfBuzz OpenType ligatures (`Fira Code` as the default system and terminal font), XIM T9 input, and live theme reloading. -- **On-device development, scripting, and gaming**: preinstalled `gcc`/`g++`, `make`, `git`, GNU `coreutils`, GNU `bc`/`dc`, `nano`, `ed`, `sqlite3`, `lua` (`5.5` and `5.4`), `yabasic`, `perl`, `tcl`, the [Janet](https://janet-lang.org/) language and `jpm`, the [Bantam](https://bantam.luxferre.top/) coding agent, `frotz` (interactive fiction), standalone X11 keypad games (`Snake` and `Tetris`), and a full-featured Gambatte-based Game Boy / Game Boy Color emulator (`gambatte` / `gbemu`) with readjustable keypad controls (`B=8`, `Turbo B=5`, `A=9`, `Turbo A=6`, `D-pad`, `Start=2`, `Select=3`, `Palette=*`), 10 color palettes, save states, and File Manager `.gb`/`.gbc` integration. +- **On-device development, scripting, and gaming**: preinstalled `gcc`/`g++`, `make`, `git`, GNU `coreutils`, GNU `bc`/`dc`, `nano`, `ed`, `sqlite3`, `lua` (`5.5` and `5.4`), `yabasic`, `perl`, `tcl`, the [Janet](https://janet-lang.org/) language and `jpm`, the [Bantam](https://bantam.luxferre.top/) coding agent, `frotz` (interactive fiction), standalone X11 keypad games (`Snake` and `Tetris`), and a full-featured Gambatte-based Game Boy / Game Boy Color emulator (`gambatte` / `gbemu`) with readjustable keypad controls (`B=8`, `Turbo B=5`, `A=9`, `Turbo A=6`, `D-pad`, `Start=2`, `Select=3`, `Palette=*`), 10 color palettes, save states, and file manager `.gb`/`.gbc` integration. - **NeoUI 240x320 UI SDK (`libneoui.so` + `/usr/include/neoui.h` + `neoui.yab`)**: unified C-compatible FFI and C++20 UI SDK wrapping Xlib, Xft, Pango, `libjpeg`/`libpng`, `.Xresources` / `~/.xthemes/*.xth` live theme resolution, offscreen `Pixmap` double buffering, standardized OS shell widgets (headers, tabs, softkey bars, list/toggle/slider rows, input boxes, progress bars, scrollbars, modals, popup menus, and toasts), keypad/softkey chord handling, and multi-tap text entry—usable from C, C++, or Yabasic (`~/Projects/neoui.yab` and `~/Projects/neoui_demo.yab`). See [SDK.md](./SDK.md) for full documentation. --- diff --git a/SDK.md b/SDK.md index d2c02d8..9d98bb9 100644 --- a/SDK.md +++ b/SDK.md @@ -1,17 +1,17 @@ -# Bananarchy NeoUI SDK Reference (`SDK.md`) +# Bananarchy NeoUI SDK reference (`SDK.md`) **NeoUI** (`libneoui.so` + `/usr/include/neoui.h`) is the native `240x320` QVGA graphical user interface SDK for **Bananarchy Linux**. -It encapsulates all low-level X11 (`Xlib`), `Xft`, `Pango`, `libjpeg-turbo`, `libpng`, `.Xresources` / `~/.xthemes/*.xth` live theme resolution, offscreen `Pixmap` double-buffering, standardized OS shell widgets, FIFO IPC, softkey chord handling (`Left+Right` softkey -> `xdrawer`), and multi-tap T9 keypad input behind: +It encapsulates all low-level X11 (`Xlib`), `Xft`, `Pango`, `libjpeg-turbo`, `libpng`, `.Xresources` / `~/.xthemes/*.xth` live theme resolution, offscreen `Pixmap` double buffering, standardized OS shell widgets, FIFO IPC, softkey chord handling (`Left+Right` softkey -> `xdrawer`), and multi-tap T9 keypad input behind: 1. A **C-compatible FFI (`neoui_*`)** designed for both C programs and foreign-function interfaces (such as **Yabasic** `frnfn_call` / `frnfn_call$`, LuaJIT FFI, Janet, Python `ctypes`, etc.). 2. A **C++20 SDK (`namespace bananarchy`)** providing `ThemeSpec`, `PluginTheme`, `NeoWindow`, and direct Pango/Xft/image helpers used across all 14 built-in Bananarchy DWM plugins. 3. A **Yabasic wrapper library (`neoui.yab`)** preinstalled in `/home/user/Projects/neoui.yab` (and symlinked at `/usr/lib/neoui.yab`), paired with a full showcase application (`/home/user/Projects/neoui_demo.yab`). --- -## 1. Architecture & Files +## 1. Architecture and files -| Path on Target Device | Source in Repository | Description | +| Path on target device | Source in repository | Description | | :--- | :--- | :--- | | `/usr/lib/libneoui.so` | `src/neoui/neoui.cpp` | Shared library (`armv7` hard-float) implementing the C FFI and C++20 SDK | | `/usr/include/neoui.h` | `src/neoui/neoui.h` | Unified C99 and C++20 header file | @@ -19,17 +19,17 @@ It encapsulates all low-level X11 (`Xlib`), `Xft`, `Pango`, `libjpeg-turbo`, `li | `/usr/lib/neoui.yab` | `overlay/rootfs/usr/lib/neoui.yab` | Symlink to `/home/user/Projects/neoui.yab` so `import neoui` works from any working directory | | `/home/user/Projects/neoui_demo.yab` | `overlay/rootfs/home/user/Projects/neoui_demo.yab` | Interactive 3-tab Yabasic showcase demonstrating all NeoUI widgets, multi-tap input, custom drawing, modals, and live theme reload | -### Key Design Principles -- **Zero-Flicker Offscreen Double Buffering**: Every NeoUI window (`240x296` at `X=0, Y=24`, directly below the 24px `dwm` top status bar) renders into an offscreen X11 `Pixmap` during `neoui_begin_frame()` .. `neoui_end_frame()` and copies the completed frame to the visible window in a single `XCopyArea` call. -- **Automatic `.Xresources` / `.xth` Theme Resolution**: NeoUI automatically parses the active theme from X11 `RESOURCE_MANAGER` and `~/.Xresources`, derives 29 semantic color tokens and 4 proportional Pango font sizes (`Small`, `Main`, `Icon`, `Large` scaled from `theme.baseFontSize`), and hot-reloads on the fly whenever `RELOAD_THEME` arrives on `/tmp/dwm_plugin_.fifo` or `.Xresources` changes on disk. -- **FFI-Safe Return Types**: Every `extern "C"` function in `neoui.h` returns `int` (`int32`), `uint32_t` (`uint32`), or `const char*` (`string`)—never `void`—so FFI callers like Yabasic's `frnfn_call` work without `void`-return restrictions. +### Key design principles +- **Zero-flicker offscreen double buffering**: every NeoUI window (`240x296` at `X=0, Y=24`, directly below the 24px `dwm` top status bar) renders into an offscreen X11 `Pixmap` during `neoui_begin_frame()` .. `neoui_end_frame()` and copies the completed frame to the visible window in a single `XCopyArea` call. +- **Automatic `.Xresources` / `.xth` theme resolution**: NeoUI automatically parses the active theme from X11 `RESOURCE_MANAGER` and `~/.Xresources`, derives 29 semantic color tokens and 4 proportional Pango font sizes (`Small`, `Main`, `Icon`, `Large` scaled from `theme.baseFontSize`), and hot-reloads on the fly whenever `RELOAD_THEME` arrives on `/tmp/dwm_plugin_.fifo` or `.Xresources` changes on disk. +- **FFI-safe return types**: every `extern "C"` function in `neoui.h` returns `int` (`int32`), `uint32_t` (`uint32`), or `const char*` (`string`)—never `void`—so FFI callers like Yabasic's `frnfn_call` work without `void`-return restrictions. --- -## 2. Constants & Enumerations +## 2. Constants and enumerations -### 2.1 Screen Geometry (`NeoGeometry`) -| C Constant | Yabasic Constant | Value | Meaning | +### 2.1 Screen geometry (`NeoGeometry`) +| C constant | Yabasic constant | Value | Meaning | | :--- | :--- | :--- | :--- | | `NEO_SCREEN_W` | `neoui.SCREEN_W` | `240` | Full physical display width in pixels | | `NEO_SCREEN_H` | `neoui.SCREEN_H` | `320` | Full physical display height in pixels | @@ -41,8 +41,8 @@ It encapsulates all low-level X11 (`Xlib`), `Xft`, `Pango`, `libjpeg-turbo`, `li | `NEO_HEADER_H` | `neoui.HEADER_H` | `34` | Standard NeoUI header height | | `NEO_SOFTBAR_H` | `neoui.SOFTBAR_H` | `26` | Standard bottom softkey bar height | -### 2.2 Theme Color Token IDs (`NeoColorId` for `neoui_color(color_id)`) -| ID | C Constant | Yabasic Constant | Description | +### 2.2 Theme color token IDs (`NeoColorId` for `neoui_color(color_id)`) +| ID | C constant | Yabasic constant | Description | | :--- | :--- | :--- | :--- | | `0` | `NEO_COLOR_BG_MAIN` | `neoui.COLOR_BG_MAIN` | Primary window background | | `1` | `NEO_COLOR_BG_BAR` | `neoui.COLOR_BG_BAR` | Top status bar background | @@ -74,15 +74,15 @@ It encapsulates all low-level X11 (`Xlib`), `Xft`, `Pango`, `libjpeg-turbo`, `li | `27` | `NEO_COLOR_DANGER` | `neoui.COLOR_DANGER` | Semantic red (danger / error / reject) | | `28` | `NEO_COLOR_DANGER_BG` | `neoui.COLOR_DANGER_BG` | Selected danger button background | -### 2.3 Font Roles (`NeoFontRole`) & Text Color Roles (`NeoTextColor`) -| ID | Font Role (`NeoFontRole`) | Yabasic | Description | +### 2.3 Font roles (`NeoFontRole`) and text color roles (`NeoTextColor`) +| ID | Font role (`NeoFontRole`) | Yabasic | Description | | :--- | :--- | :--- | :--- | | `0` | `NEO_FONT_SMALL` | `neoui.FONT_SMALL` | Small UI font (`baseFontSize - 2`, min `10px`) | -| `1` | `NEO_FONT_MAIN` | `neoui.FONT_MAIN` | Main UI Bold font (`baseFontSize`, default `13px`) | +| `1` | `NEO_FONT_MAIN` | `neoui.FONT_MAIN` | Main UI bold font (`baseFontSize`, default `13px`) | | `2` | `NEO_FONT_ICON` | `neoui.FONT_ICON` | Nerd Font icon glyph layout (`baseFontSize + 2`, default `15px`) | -| `3` | `NEO_FONT_LARGE` | `neoui.FONT_LARGE` | Large Bold title/number font (`baseFontSize + 3`, default `16px`) | +| `3` | `NEO_FONT_LARGE` | `neoui.FONT_LARGE` | Large bold title/number font (`baseFontSize + 3`, default `16px`) | -| ID | Text Color Role (`NeoTextColor`) | Yabasic | Mapped Theme Token | +| ID | Text color role (`NeoTextColor`) | Yabasic | Mapped theme token | | :--- | :--- | :--- | :--- | | `0` | `NEO_TEXT_WHITE` | `neoui.TEXT_WHITE` | `theme.fgBright` | | `1` | `NEO_TEXT_LIGHT` | `neoui.TEXT_LIGHT` | `theme.fgMain` | @@ -93,8 +93,8 @@ It encapsulates all low-level X11 (`Xlib`), `Xft`, `Pango`, `libjpeg-turbo`, `li | `6` | `NEO_TEXT_ORANGE` | `neoui.TEXT_ORANGE` | `theme.warning` | | `7` | `NEO_TEXT_RED` | `neoui.TEXT_RED` | `theme.danger` | -### 2.4 Event Types (`NeoEventType`) & Logical Keypad Keys (`NeoKey`) -| Event ID | C Constant | Yabasic Constant | Description | +### 2.4 Event types (`NeoEventType`) and logical keypad keys (`NeoKey`) +| Event ID | C constant | Yabasic constant | Description | | :--- | :--- | :--- | :--- | | `0` | `NEO_EV_NONE` | `neoui.EV_NONE` | Timeout elapsed with no event | | `1` | `NEO_EV_EXPOSE` | `neoui.EV_EXPOSE` | Window exposed or multi-tap candidate auto-committed; redraw frame | @@ -107,7 +107,7 @@ It encapsulates all low-level X11 (`Xlib`), `Xft`, `Pango`, `libjpeg-turbo`, `li | `8` | `NEO_EV_THEME_RELOAD` | `neoui.EV_THEME_RELOAD` | Theme reloaded (`RELOAD_THEME`); redraw frame | | `9` | `NEO_EV_CLOSE_REQ` | `neoui.EV_CLOSE_REQ` | `CLOSE` received on FIFO | -| Key ID | C Constant | Yabasic Constant | Physical Key | +| Key ID | C constant | Yabasic constant | Physical key | | :--- | :--- | :--- | :--- | | `0` | `NEO_KEY_NONE` | `neoui.KEY_NONE` | Unmapped key | | `1`..`4` | `NEO_KEY_UP`, `DOWN`, `LEFT`, `RIGHT` | `neoui.KEY_UP`, `KEY_DOWN`, `KEY_LEFT`, `KEY_RIGHT` | D-Pad directions | @@ -115,32 +115,32 @@ It encapsulates all low-level X11 (`Xlib`), `Xft`, `Pango`, `libjpeg-turbo`, `li | `6` | `NEO_KEY_BACK` | `neoui.KEY_BACK` | `BackSpace` / `Delete` / `Escape` | | `7` | `NEO_KEY_CALL` | `neoui.KEY_CALL` | Green Call / Send key (`XF86PickupPhone` / `F3`) | | `8` | `NEO_KEY_END` | `neoui.KEY_END` | Red End / Power key (`XF86HangupPhone` / `F4`) | -| `9` | `NEO_KEY_SOFT_LEFT` | `neoui.KEY_SOFT_LEFT` | Left Softkey (`XF86KbdLcdMenu1` / `F1`) | -| `10` | `NEO_KEY_SOFT_RIGHT` | `neoui.KEY_SOFT_RIGHT` | Right Softkey (`XF86KbdLcdMenu2` / `F2`) | +| `9` | `NEO_KEY_SOFT_LEFT` | `neoui.KEY_SOFT_LEFT` | Left softkey (`XF86KbdLcdMenu1` / `F1`) | +| `10` | `NEO_KEY_SOFT_RIGHT` | `neoui.KEY_SOFT_RIGHT` | Right softkey (`XF86KbdLcdMenu2` / `F2`) | | `32` | `NEO_KEY_SPACE` | `neoui.KEY_SPACE` | Space | | `35` | `NEO_KEY_HASH` | `neoui.KEY_HASH` | `#` key (`numbersign`) | | `42` | `NEO_KEY_STAR` | `neoui.KEY_STAR` | `*` key (`asterisk`) | | `43` | `NEO_KEY_PLUS` | `neoui.KEY_PLUS` | `+` key (`plus`) | | `48`..`57` | `NEO_KEY_0` .. `NEO_KEY_9` | `neoui.KEY_0` .. `neoui.KEY_9` | Keypad digits `0`–`9` | -### 2.5 Built-in Nerd Font Icon Names (`neoui_icon(name)`) +### 2.5 Built-in Nerd Font icon names (`neoui_icon(name)`) Any widget parameter accepting `icon_str` (or `neoui_icon(name)`) resolves the following symbolic names to their Nerd Font UTF-8 codepoints (or passes raw UTF-8 strings through unchanged): -- **Telephony & Messaging**: `"phone"`, `"hangup"`, `"contacts"`, `"user"`, `"sms"`, `"reply"`, `"in_call"`, `"out_call"`, `"missed_call"`, `"sim"`, `"signal"`, `"ussd"`, `"voicemail"` -- **Connectivity & Hardware**: `"wifi"`, `"bluetooth"`, `"globe"`, `"hotspot"`, `"usb"`, `"torch"`, `"sun"`, `"speaker"`, `"earpiece"`, `"mute"`, `"mic"`, `"mic_off"`, `"bell"`, `"vibrate"`, `"silent"`, `"dnd"`, `"camera"`, `"battery"`, `"lock"` -- **Files, Media & UI Actions**: `"folder"`, `"file"`, `"image"`, `"music"`, `"Gamepad"`, `"term"`, `"theme"`, `"settings"`, `"search"`, `"plus"`, `"edit"`, `"trash"`, `"check"`, `"close"`, `"info"`, `"warning"`, `"star"`, `"refresh"`, `"copy"`, `"sort"`, `"eye"`, `"backspace"`, `"up"`, `"down"`, `"left"`, `"right"` +- **Telephony and messaging**: `"phone"`, `"hangup"`, `"contacts"`, `"user"`, `"sms"`, `"reply"`, `"in_call"`, `"out_call"`, `"missed_call"`, `"sim"`, `"signal"`, `"ussd"`, `"voicemail"` +- **Connectivity and hardware**: `"wifi"`, `"bluetooth"`, `"globe"`, `"hotspot"`, `"usb"`, `"torch"`, `"sun"`, `"speaker"`, `"earpiece"`, `"mute"`, `"mic"`, `"mic_off"`, `"bell"`, `"vibrate"`, `"silent"`, `"dnd"`, `"camera"`, `"battery"`, `"lock"` +- **Files, media, and UI actions**: `"folder"`, `"file"`, `"image"`, `"music"`, `"Gamepad"`, `"term"`, `"theme"`, `"settings"`, `"search"`, `"plus"`, `"edit"`, `"trash"`, `"check"`, `"close"`, `"info"`, `"warning"`, `"star"`, `"refresh"`, `"copy"`, `"sort"`, `"eye"`, `"backspace"`, `"up"`, `"down"`, `"left"`, `"right"` --- -## 3. C SDK Reference (`/usr/include/neoui.h`) +## 3. C SDK reference (`/usr/include/neoui.h`) -### 3.1 Compiling C Applications on the Device +### 3.1 Compiling C applications on the device ```bash gcc -O2 myapp.c -lneoui -o myapp ``` -### 3.2 C Function Summary +### 3.2 C function summary -#### Window & Daemon Lifecycle +#### Window and daemon lifecycle ```c int neoui_init(const char* app_name, int preload_mode); int neoui_init_ex(const char* app_name, const char* res_name, @@ -163,7 +163,7 @@ int neoui_end_frame(void); int neoui_flush(void); ``` -#### Unified `.Xresources` / `.xth` Theme & Icon Resolution +#### Unified `.Xresources` / `.xth` theme and icon resolution ```c int neoui_reload_theme(void); int neoui_check_reload_theme(void); @@ -184,7 +184,7 @@ const char* neoui_format_hex_rgb(uint32_t rgb); const char* neoui_icon(const char* icon_name); ``` -#### Drawing Primitives, Text & Image Rendering +#### Drawing primitives, text, and image rendering ```c int neoui_clear(uint32_t rgb); int neoui_fill_rect(int x, int y, int w, int h, uint32_t rgb); @@ -208,7 +208,7 @@ int neoui_draw_image_file(const char* path, int x, int y, int w, int h, int scale_mode); ``` -#### Standardized OS Shell Widgets +#### Standardized OS shell widgets ```c int neoui_draw_header(const char* icon_str, int icon_color_role, const char* title, const char* right_badge); @@ -265,7 +265,7 @@ int neoui_show_toast(const char* message, int duration_ms); int neoui_clear_toast(void); ``` -#### Event Loop, Keypad & Multi-Tap Input +#### Event loop, keypad, and multi-tap input ```c int neoui_poll_event(int timeout_ms); int neoui_event_key(void); @@ -289,14 +289,14 @@ const char* neoui_input_candidate_bar(const char* idle_hint); int neoui_draw_multitap_bar(int x, int y, int w, int h, const char* idle_hint); ``` -#### System & IPC Utilities +#### System and IPC utilities ```c int neoui_send_plugin_cmd(const char* plugin_name, const char* cmd); int neoui_vibrate(int duration_ms); int neoui_now_ms(void); ``` -### 3.3 Minimal C Example +### 3.3 Minimal C example ```c #include #include @@ -348,18 +348,18 @@ int main(void) { --- -## 4. C++20 SDK Reference (`namespace bananarchy`) +## 4. C++20 SDK reference (`namespace bananarchy`) When `#include ` is compiled under C++, it also exposes the `bananarchy` namespace used by Bananarchy's native DWM plugins (`src/dwm-plugins/*.cpp` and `src/xdrawer/xdrawer.cpp`). -### 4.1 Compiling C++ Applications or Plugins +### 4.1 Compiling C++ applications or plugins ```bash g++ -O2 -std=c++17 myapp.cpp \ $(pkgconf --cflags --libs x11 xft fontconfig freetype2 pango pangoxft) \ -lneoui -o myapp ``` -### 4.2 Core C++ Classes & Helpers +### 4.2 Core C++ classes and helpers - **`bananarchy::ThemeSpec`**: - Holds all 29 RGB color tokens (`bgMain`, `bgHeader`, `bgFooter`, `selBg`, `selFg`, `accent`, `fgMain`, `fgBright`, `fgMuted`, `border`, `divider`, `success`, `info`, `warning`, `danger`, etc.), `fontFace`, `iconFontFace`, and `baseFontSize`. - Methods: `loadActive(dpy, screen)`, `loadFromFile(path)`, `saveToFile(path)`, `serializeXresources()`, `recomputeDerivedFromCore()`, `colorById(id)`, `sizeSmall()`, `sizeMain()`, `sizeIcon()`, `sizeLarge()`. @@ -377,7 +377,7 @@ g++ -O2 -std=c++17 myapp.cpp \ - `void drawToast(msg, softbarH = 26)` - `void clearBg()` / `void present()` - `bool checkReloadTheme()` / `void reloadTheme()` -- **Shared Text, Multi-Tap & Image Helpers in `libneoui.so`**: +- **Shared text, multi-tap, and image helpers in `libneoui.so`**: - `std::string formatMultiTapBar(prefix, table, activeIdx, makeUpper, maxItems = 7, maxChars = 21)`: formats a scrolling candidate bar window centered around `activeIdx` so long symbol sequences (such as the 33-character `1` key table) never overflow the `240px` viewport. - `std::string tailFitPangoText(layout, text, maxWidthPx)`: returns the UTF-8 suffix of `text` that fits within `maxWidthPx`. - `bool loadImageRgb24(path, &outRgb, &outW, &outH)`: decodes JPEG (`libjpeg-turbo`), PNG (`libpng`), or other formats (`ffmpeg` fallback) into 24-bit RGB. @@ -388,12 +388,12 @@ g++ -O2 -std=c++17 myapp.cpp \ --- -## 5. Yabasic SDK Reference (`neoui.yab`) +## 5. Yabasic SDK reference (`neoui.yab`) Bananarchy includes `/home/user/Projects/neoui.yab` (symlinked to `/usr/lib/neoui.yab`), which wraps every C FFI function in `/usr/lib/libneoui.so` using Yabasic's native `libffi` foreign function interface (`frnfn_call` and `frnfn_call$`). -### 5.1 Running Yabasic NeoUI Programs -- **From the File Manager (`xfiles`)**: navigate to `/home/user/Projects/`, highlight `neoui_demo.yab` (or your own `.yab` file), and press **Center `OK` (`Return`)**. +### 5.1 Running Yabasic NeoUI programs +- **From the file manager (`xfiles`)**: navigate to `/home/user/Projects/`, highlight `neoui_demo.yab` (or your own `.yab` file), and press **Center `OK` (`Return`)**. - **From a terminal or SSH**: ```bash DISPLAY=:0 yabasic ~/Projects/neoui_demo.yab @@ -407,9 +407,9 @@ import neoui - All exported subroutines can be called directly (e.g. `neoui_init("myapp", 0)`, `neoui_draw_header(...)`) or qualified with `neoui.` (`neoui.neoui_init(...)`). - All module constants are accessed with the `neoui.` prefix (e.g. `neoui.TEXT_YELLOW`, `neoui.FONT_MAIN`, `neoui.COLOR_ACCENT`, `neoui.EV_KEY_PRESS`, `neoui.KEY_OK`). -### 5.3 Exported Yabasic Functions in `neoui.yab` +### 5.3 Exported Yabasic functions in `neoui.yab` -#### 1. Window & Frame Lifecycle +#### 1. Window and frame lifecycle - `neoui_init(app_name$, preload_mode)` -> `1` on success, `0` on error - `neoui_init_ex(app_name$, res_name$, res_class$, win_title$, x, y, w, h, override_redirect, preload_mode)` - `neoui_shutdown()` @@ -418,7 +418,7 @@ import neoui - `neoui_width()` / `neoui_height()` - `neoui_begin_frame()` / `neoui_end_frame()` / `neoui_flush()` -#### 2. Theme, Color & Icon Resolution +#### 2. Theme, color, and icon resolution - `neoui_reload_theme()` / `neoui_check_reload_theme()` - `neoui_apply_theme_file(xth_path$)` / `neoui_broadcast_theme_reload(skip_plugin$)` - `neoui_theme_name$()` / `neoui_font_face$()` / `neoui_icon_font_face$()` @@ -428,7 +428,7 @@ import neoui - `neoui_parse_hex_rgb(hex_str$, fallback_rgb)` / `neoui_format_hex_rgb$(rgb)` - `neoui_icon$(icon_name$)` -#### 3. Drawing Primitives, Text & Images +#### 3. Drawing primitives, text, and images - `neoui_clear(rgb)` - `neoui_fill_rect(x, y, w, h, rgb)` / `neoui_draw_rect(x, y, w, h, rgb)` - `neoui_draw_line(x1, y1, x2, y2, rgb)` @@ -440,7 +440,7 @@ import neoui - `neoui_text_width(font_role, text$)` / `neoui_tail_fit_text$(font_role, text$, max_w)` - `neoui_draw_image_file(path$, x, y, w, h, scale_mode)` -#### 4. Standardized OS Shell Widgets +#### 4. Standardized OS shell widgets - `neoui_draw_header(icon_str$, icon_color_role, title$, right_badge$)` - `neoui_draw_header_ex(h, icon_str$, icon_color_role, title$, title_color_role, right_badge$, right_color_role)` - `neoui_draw_tabs(pipe_labels$, active_idx, y, h)` @@ -458,7 +458,7 @@ import neoui - `neoui_draw_menu_popup(pipe_items$, pipe_icons$, selected_idx, max_visible_rows)` - `neoui_draw_toast(message$)` / `neoui_show_toast(message$, duration_ms)` / `neoui_clear_toast()` -#### 5. Event Loop, Keypad & Multi-Tap Input +#### 5. Event loop, keypad, and multi-tap input - `neoui_poll_event(timeout_ms)` - `neoui_event_key()` / `neoui_event_keycode()` / `neoui_event_keysym()` / `neoui_event_command$()` - `neoui_set_chord_xdrawer(enabled)` @@ -467,12 +467,12 @@ import neoui - `neoui_input_feed_key(neo_key)` / `neoui_input_commit_tap()` / `neoui_input_backspace()` / `neoui_input_is_tap_active()` - `neoui_input_candidate_bar$(idle_hint$)` / `neoui_draw_multitap_bar(x, y, w, h, idle_hint$)` -#### 6. System & IPC Utilities +#### 6. System and IPC utilities - `neoui_send_plugin_cmd(plugin_name$, cmd$)` - `neoui_vibrate(duration_ms)` - `neoui_now_ms()` -### 5.4 Minimal Yabasic Starter Template +### 5.4 Minimal Yabasic starter template ```yabasic #!/usr/bin/yabasic import neoui