Add Webarchy ultrawide browser, DNS UI, WLAN/st fixes, and media/CLI packages

- Port Webarchy GTK3/WebKit2GTK browser for 2160x1080 with flush-right vertical tab bar, DPI-scaled .Xresources SIGUSR1 theming, single-instance FIFO, and GPU crash CPU fallback (src/webarchy/webarchy.cpp, geminux-webarchy)
- Cross-compile pure-C gdk-pixbuf 2.42.12 (geminux-gdk-pixbuf) and compile rootfs GSettings schemas so webkit2gtk-4.1 and gst-plugins-good install with zero Rust ELFs
- Add zero-Rust geminux-mpv (mpv v0.40.0, FFmpeg n7.1.5, libplacebo, gst-libav 1.28.9) plus python3, py3-pip, mpg123, yt-dlp (quickjs), gnupg, gpg, pass, and pinentry-curses
- Fix MT6797 WLAN peer deauth and CCMP EAPOL GTK rekey (patch 0007), set wifi.powersave = 2, pin active WLAN connections in geminux-net, and add the DNS tab with geminux-dnsctl
- Restore st filled/hollow cursor focus across screenlock and libgemui grabs via dwm, libgemui, and st updates
- Update README.md, MANUAL.md, ARCHITECTURE.md, POWER-OPTIMIZATION.md, check-rebuild.sh, and host Python tests
This commit is contained in:
Luxferre committed 2026-11-23 12:46:34 +02:00
1 parent c12ed68d19
commit e01806f3c8
82 files changed
+5499 -117

No files matched your search

+13 -8
View File
@@ -4,7 +4,7 @@ Geminux combines a custom-patched Linux `7.3.5` kernel, pure-Linux MTK flasher,
## Kernel and MediaTek MT6797X support ## 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`). - **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`).
- **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. - **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/`). - **Wi-Fi / Bluetooth CONSYS**: Staged `mt6797_wlan_core` and `btmt6797` drivers backed by NVRAM/factory firmware provisioning (`geminux-wifi-nvram` and `firmware-cache/mt6797/`).
- **Modem / Telephony**: 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)). - **Modem / Telephony**: 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)).
@@ -14,29 +14,31 @@ Geminux combines a custom-patched Linux `7.3.5` kernel, pure-Linux MTK flasher,
- **XLibre (`25.x`)**: Cross-compiled against pure Alpine Edge `aarch64` sysroots with Panfrost Glamor EGL (`libglamoregl.so`), `modesetting_drv.so`, `fbdev_drv.so`, and `libinput_drv.so` ([scripts/build-xlibre.sh](file:///home/lux/proj/geminux/scripts/build-xlibre.sh)). Zero Wayland compositors (`sway`, `weston`, `phosh`, `xwayland`, etc.) are installed. - **XLibre (`25.x`)**: Cross-compiled against pure Alpine Edge `aarch64` sysroots with Panfrost Glamor EGL (`libglamoregl.so`), `modesetting_drv.so`, `fbdev_drv.so`, and `libinput_drv.so` ([scripts/build-xlibre.sh](file:///home/lux/proj/geminux/scripts/build-xlibre.sh)). Zero Wayland compositors (`sway`, `weston`, `phosh`, `xwayland`, etc.) are installed.
- **Patched suckless desktop**: - **Patched suckless desktop**:
- `st` with HarfBuzz font shaping (`hb.c`) supporting Fira Code programming ligatures, Nerd Font fallback, mouse/two-finger wheel scrollback, and `SIGUSR1` live `.Xresources` reload. - `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` (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, and `SIGUSR1` `.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, 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 `Bantam AI agent` and `Lynx Web Browser` in `st` (and wrapping `Terminal=true` `.desktop` entries in `st -e`). - `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`. - **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`.
- **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`, 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`.
- **Zero-Rust media & `yt-dlp` stack**: [scripts/build-mpv.sh](file:///home/lux/proj/geminux/scripts/build-mpv.sh) cross-compiles `libplacebo v7.360.1` (`-Ddovi=disabled`), `FFmpeg n7.1.5` (private `/usr/lib/geminux-mpv` `RUNPATH`, zero `librav1e`), `mpv v0.40.0` (Panfrost X11 EGL + PipeWire/Pulse/ALSA), and `gst-libav 1.28.9` (`libgstlibav.so` linked against private `geminux-mpv` libs for WebKit HTML5 media), paired with `mpg123`, `python3`/`py3-pip`, and `yt-dlp-core` + `yt-dlp-ejs-rt-quickjs` (`quickjs`, avoiding `deno`/`py3-cryptography`).
## Custom UI toolkit and zero-poll C11 daemons ## 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`). - **`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`, `geminux-audio`, `geminux-datetime`, `geminux-net`, `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`. - **11 landscape HiDPI applications** ([src/geminux-apps/](file:///home/lux/proj/geminux/src/geminux-apps)): `geminux-control`, `geminux-audio`, `geminux-datetime`, `geminux-net` (5 tabs including active WLAN persistence 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)): - **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`, keyboard/touch/pointer activity), `KOBJECT_UEVENT`, `/run/geminux/powerd.sock`, and `timerfd`; 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-powerd` — `epoll` over `/dev/input/event*` (`SW_LID`, `KEY_POWER`, keyboard/touch/pointer activity), `KOBJECT_UEVENT`, `/run/geminux/powerd.sock`, and `timerfd`; 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`, `KOBJECT_UEVENT`, `inotify`, and minute-aligned `timerfd`; updates root `WM_NAME` with zero child shell forks. - `geminux-statusd` — `epoll` over `signalfd` (`SIGUSR1`), `RTMGRP_LINK`/`RTMGRP_IPV4_IFADDR`, `KOBJECT_UEVENT`, `inotify`, and minute-aligned `timerfd`; updates root `WM_NAME` 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-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-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`; idles cleanly if MD firmware is absent. - `geminux-ccci-daemon` — `epoll` over `/dev/ccci_*`, uevents, and `/run/geminux/ccci.sock`; idles cleanly if MD firmware is absent.
- `geminux-modem-ctl`, `geminux-bt-obex` (GLib `GMainLoop`/GDBus), `geminux-power-ctl`, `geminux-power-audit`, `geminux-tzctl`, `geminux-wifi-nvram`, and `geminux-checkpw`. - `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`.
## APK package pinning and zero-Rust enforcement ## APK package pinning and zero-Rust enforcement
To keep Alpine Edge `aarch64` userspace freely updatable while locking all hardware-tuned components: 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`). 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 eight `.apk` packages via `apk mkpkg` and indexes them into `APKINDEX.tar.gz` via `apk mkndx`: 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`:
- `geminux-kernel-modules` - `geminux-kernel-modules`
- `geminux-xlibre` - `geminux-xlibre`
- `geminux-suckless` - `geminux-suckless`
@@ -44,8 +46,11 @@ To keep Alpine Edge `aarch64` userspace freely updatable while locking all hardw
- `geminux-ui` - `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-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-gsocket` (`gs-netcat` / `gsocket` NAT traversal toolkit built via [scripts/build-gsocket.sh](file:///home/lux/proj/geminux/scripts/build-gsocket.sh))
- `geminux-config` (includes `/etc/htoprc`, `/etc/skel/.config/htop/htoprc`, `/etc/skel/.lynx.cfg`, `/etc/skel/.apexrc`) - `geminux-mpv` (`mpv v0.40.0`, `ffmpeg`, `ffprobe`, private `libplacebo`/FFmpeg shared libs, and `libgstlibav.so` built via [scripts/build-mpv.sh](file:///home/lux/proj/geminux/scripts/build-mpv.sh))
3. `/etc/apk/world` pins all eight with `name@geminux=version` and locks out Rust/Wayland/upstream overrides via `!` constraints from [scripts/rootfs-prune-packages.txt](file:///home/lux/proj/geminux/scripts/rootfs-prune-packages.txt). - `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-config` (includes `/etc/htoprc`, `/etc/skel/.config/htop/htoprc`, `/etc/skel/.lynx.cfg`, `/etc/skel/.apexrc`, `/etc/skel/.bashrc` with `GPG_TTY`)
3. `/etc/apk/world` pins all eleven with `name@geminux=version` and locks out Rust/Wayland/upstream overrides 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 7 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. 4. `/etc/apk/protected_paths.d/geminux.list` shields Geminux configuration directories across upgrades.
## Pure-Linux flasher and eMMC layout ## Pure-Linux flasher and eMMC layout
+6 -5
View File
@@ -17,7 +17,7 @@ In [src/dwm/config.h](file:///home/lux/proj/geminux/src/dwm/config.h), `MODKEY`
| --- | --- | | --- | --- |
| `Mod4 + Return` | Launch `st` terminal (with Fira Code HarfBuzz ligatures) | | `Mod4 + Return` | Launch `st` terminal (with Fira Code HarfBuzz ligatures) |
| `Mod4 + Shift + Return` | Promote focused window to master (`zoom`) | | `Mod4 + Shift + Return` | Promote focused window to master (`zoom`) |
| `Mod4 + Space` / `Mod4 + p` | Launch `geminux-launcher` (`dmenu` with Nerd Font icons, pinned GUI apps, `Bantam AI agent`, and `Lynx Web Browser` in `st`) | | `Mod4 + Space` / `Mod4 + p` | Launch `geminux-launcher` (`dmenu` with Nerd Font icons, pinned GUI apps, `Webarchy Browser`, `Bantam AI agent`, and `Lynx Web Browser` in `st`) |
| `Mod4 + c` | Open `geminux-control` (backlight, volume, power profiles, LEDs, suspend) | | `Mod4 + c` | Open `geminux-control` (backlight, volume, power profiles, LEDs, suspend) |
| `Mod4 + d` | Open `geminux-dialer` | | `Mod4 + d` | Open `geminux-dialer` |
| `Mod4 + s` | Open `geminux-sms` | | `Mod4 + s` | Open `geminux-sms` |
@@ -53,16 +53,17 @@ geminux-apply-theme # list available themes
geminux-apply-theme TokyoNight geminux-apply-theme TokyoNight
``` ```
`geminux-apply-theme` updates `~/.Xresources`, merges into the X11 resource database via `xrdb`, translates the unified `theme.*` keys into `~/.config/dunst/dunstrc` via `geminux-sync-dunst-theme`, restarts `dunst`, and sends `SIGUSR1` to live `dwm`, `st`, and `libgemui` applications for instant in-place redraw. `geminux-apply-theme` updates `~/.Xresources`, merges into the X11 resource database via `xrdb`, translates the unified `theme.*` keys into `~/.config/dunst/dunstrc` via `geminux-sync-dunst-theme`, restarts `dunst`, and sends `SIGUSR1` to live `dwm`, `st`, `webarchy`, and `libgemui` applications for instant in-place redraw.
## Applications and daemons ## Applications and daemons
- **Webarchy Browser (`webarchy` / `xwebarchy`)**: Ultrawide `2160x1080` `GTK3` + `WebKit2GTK` browser featuring a collapsible right-side vertical tab bar (`Tabs ◫` or `Ctrl+B` / `Alt+T`), omnibar URL/DuckDuckGo search, persistent SQLite cookies and bookmarks (`~/.config/geminux/webarchy/` and `~/.local/share/geminux/webarchy/`), User-Agent presets, Dark Mode inverter (`Ctrl+Shift+D`), Reader Width Fit, Find in Page (`Ctrl+F`), single-instance URL forwarding via CLI, live `.Xresources` reloading (`SIGUSR1`), and automatic CPU renderer fallback on WebProcess crash (`--software` or `~/.config/geminux/webarchy/software_renderer`). Shortcuts: `Ctrl+T` new tab, `Ctrl+W` close tab, `Ctrl+Shift+T` reopen closed tab, `Ctrl+Tab` / `Alt+Up`/`Down` / `Alt+1..9` switch vertical tabs, `Ctrl+L` / `F6` focus URL bar, `Alt+Left` / `Alt+Right` back/forward, `Ctrl+D` bookmark, `Ctrl++` / `-` / `0` zoom, and `F11` fullscreen.
- **Telephony & messaging**: `geminux-dialer`, `geminux-callscreen`, `geminux-sms`, `geminux-contacts` backed by `geminux-modem-ctl` and `geminux-ccci-daemon` (using `alsaucm` UCM2 `VoiceCall` / `HiFi` switching and call suspend inhibitors). - **Telephony & messaging**: `geminux-dialer`, `geminux-callscreen`, `geminux-sms`, `geminux-contacts` backed by `geminux-modem-ctl` and `geminux-ccci-daemon` (using `alsaucm` UCM2 `VoiceCall` / `HiFi` switching and call suspend inhibitors).
- **Audio & date/time**: `geminux-audio` manages PipeWire sink/source routing, mute state, and per-stream volume via `wpctl`/`pactl`. `geminux-datetime` manages the system timezone (`geminux-tzctl`) and shows live Chrony NTP sync status. - **Audio & date/time**: `geminux-audio` manages PipeWire sink/source routing, mute state, and per-stream volume via `wpctl`/`pactl`. `geminux-datetime` manages the system timezone (`geminux-tzctl`) and shows live Chrony NTP sync status.
- **Connectivity**: `geminux-net` manages Wi-Fi (`nmcli`), 4G/CCCI state (`mmcli` + `/run/geminux/ccci.sock`), Bluetooth (`bluetoothctl` / `rfkill`), and SiI9024 external HDMI output (`xrandr`). - **Connectivity**: `geminux-net` manages Wi-Fi (`nmcli`, keeping the currently associated WLAN connection pinned at the top with a `Disconnect` control), 4G/CCCI state (`mmcli` + `/run/geminux/ccci.sock`), Bluetooth (`bluetoothctl` / `rfkill`), SiI9024 external HDMI output (`xrandr`), and the **`DNS` tab** (`geminux-dnsctl`, supporting router-provided Default DNS, Cloudflare, Google, RadicalDNS, Quad9, custom IPv4/IPv6 nameservers, and live DNS lookup testing).
- **Camera**: `geminux-camera` configures the MT6797 Media Controller pipeline (`ov5670`/`s5k4e6` -> `seninf` -> `camsv`), captures 10-bit Bayer (`SBGGR10`/`SGRBG10`) frames over V4L2 `mmap` with a pure-C demosaic + AWB software ISP, and writes native `libjpeg-turbo` stills to `~/Pictures/` and MJPEG-AVI clips to `~/Videos/`. - **Camera**: `geminux-camera` configures the MT6797 Media Controller pipeline (`ov5670`/`s5k4e6` -> `seninf` -> `camsv`), captures 10-bit Bayer (`SBGGR10`/`SGRBG10`) frames over V4L2 `mmap` with a pure-C demosaic + AWB software ISP, and writes native `libjpeg-turbo` stills to `~/Pictures/` and MJPEG-AVI clips to `~/Videos/`.
- **System control, LEDs & lock**: `geminux-control` adjusts display backlight, PipeWire audio volume, MT6797X power profile (`eco`, `balanced`, `performance`), and AW9120 LEDs (`/run/geminux/leds.sock`). `geminux-leds` drives the 5-LED RGB back strip (`rgb:indicator-1..5`, defaulting to off when idle or 100% charged) plus `rgb:indicator-6` (amber while charging), supports calibrated presets including `rgb 160 16 0` ("Amber Warn"), and preserves manual `off` / `rgb` overrides across battery uevents. `geminux-lock` secures the X session using `doas -n /usr/sbin/geminux-checkpw`, resolving the desktop account dynamically from UID `10000` (`--username` or default `user`). `geminux-powerd` implements an input-driven screensaver: on battery it dims then triggers `geminux-lock` + suspend, while on AC / `performance` it triggers `geminux-lock` + backlight blanking (waking back onto the lock screen on key, touch, pointer, or power-button activity), timed strictly from the last active user input. - **System control, LEDs & lock**: `geminux-control` adjusts display backlight, PipeWire audio volume, MT6797X power profile (`eco`, `balanced`, `performance`), and AW9120 LEDs (`/run/geminux/leds.sock`). `geminux-leds` drives the 5-LED RGB back strip (`rgb:indicator-1..5`, defaulting to off when idle or 100% charged) plus `rgb:indicator-6` (amber while charging), supports calibrated presets including `rgb 160 16 0` ("Amber Warn"), and preserves manual `off` / `rgb` overrides across battery uevents. `geminux-lock` secures the X session using `doas -n /usr/sbin/geminux-checkpw`, resolving the desktop account dynamically from UID `10000` (`--username` or default `user`). `geminux-powerd` implements an input-driven screensaver: on battery it dims then triggers `geminux-lock` + suspend, while on AC / `performance` it triggers `geminux-lock` + backlight blanking (waking back onto the lock screen on key, touch, pointer, or power-button activity), timed strictly from the last active user input.
- **CLI developer & network tools**: `bantam` (`geminux-bantam`, minimalist C++20 OpenAI-compatible terminal AI agent defaulting to `kilo-auto/free`; see [src/bantam/README.md](file:///home/lux/proj/geminux/src/bantam/README.md)), `lynx` (configured via `~/.lynx.cfg` with `http://frogfind.com` start page, UTF-8, vi keys, mouse support, and persistent sessions/cookies), `gsocket` (`gs-netcat` plus `gs-key`/`gs-enter`/`gs-deploy-cmd`), `dtach` (`dmux`), `ovault`, default `htop` layout (`/etc/htoprc` / `~/.config/htop/htoprc`), `/etc/skel/.apexrc` defaults (`EDITOR='nano -FEDSMAGic/max%_T2'`, `PAGER='less -RXF'`, `nn`, `pg`, `l`, `defalias`/`toalias`/`savealias`, `rw`/`ee`, `sshed`, `dl`, `gcm`/`gp`/`gpm`, `sloc`, and `doas`-aware `pkgadd`/`pkgdel`/`pkgsearch`/`sysup`/`sysclean`), and `/etc/skel/.gitconfig` are preinstalled. - **CLI developer, media & security tools**: Zero-Rust `mpv` (`/etc/mpv/mpv.conf` with Panfrost X11 EGL + PipeWire) & `ffmpeg`/`ffprobe`, `mpg123`, `yt-dlp` (`yt-dlp-ejs-rt-quickjs`), `python3` & `pip3` (`py3-pip`), `gpg` (`gnupg` + `pinentry-curses` + `GPG_TTY`), `pass`, `bantam` (`geminux-bantam`, minimalist C++20 OpenAI-compatible terminal AI agent defaulting to `kilo-auto/free`; see [src/bantam/README.md](file:///home/lux/proj/geminux/src/bantam/README.md)), `lynx` (configured via `~/.lynx.cfg` with `http://frogfind.com` start page, UTF-8, vi keys, mouse support, and persistent sessions/cookies), `gsocket` (`gs-netcat` plus `gs-key`/`gs-enter`/`gs-deploy-cmd`), `dtach` (`dmux`), `ovault`, default `htop` layout (`/etc/htoprc` / `~/.config/htop/htoprc`), `/etc/skel/.apexrc` defaults (`EDITOR='nano -FEDSMAGic/max%_T2'`, `PAGER='less -RXF'`, `nn`, `pg`, `l`, `defalias`/`toalias`/`savealias`, `rw`/`ee`, `sshed`, `dl`, `gcm`/`gp`/`gpm`, `sloc`, and `doas`-aware `pkgadd`/`pkgdel`/`pkgsearch`/`sysup`/`sysclean`), and `/etc/skel/.gitconfig` are preinstalled.
## Maintaining Alpine Edge packages safely ## Maintaining Alpine Edge packages safely
@@ -73,4 +74,4 @@ doas apk update
doas apk upgrade doas apk upgrade
``` ```
Because custom Geminux components (`geminux-kernel-modules`, `geminux-xlibre`, `geminux-suckless`, `geminux-dunst`, `geminux-ui`, `geminux-bantam`, `geminux-gsocket`, `geminux-config`) are exact-version pinned (`name@geminux=version`) in `/etc/apk/world` and Rust/upstream overrides (`!rust`, `!cargo`, `!librsvg`, `!libglycin`, `!gdk-pixbuf`, `!xorg-server`, `!linux-edge`, etc.) are negated in `/etc/apk/world`, normal Alpine Edge upgrades update upstream libraries, CLI tools, NetworkManager, ModemManager, PipeWire, and Mesa without overwriting custom patched binaries or pulling Rust packages. Because custom Geminux components (`geminux-kernel-modules`, `geminux-xlibre`, `geminux-suckless`, `geminux-dunst`, `geminux-ui`, `geminux-bantam`, `geminux-gsocket`, `geminux-mpv`, `geminux-gdk-pixbuf`, `geminux-webarchy`, `geminux-config`) are exact-version pinned (`name@geminux=version`) in `/etc/apk/world` and Rust/Wayland/upstream overrides (`!rust`, `!cargo`, `!librsvg`, `!libglycin`, `!gdk-pixbuf`, `!deno`, `!py3-cryptography`, `!xorg-server`, `!linux-edge`, etc.) are negated in `/etc/apk/world`, normal Alpine Edge upgrades update upstream libraries, CLI tools, NetworkManager, ModemManager, PipeWire, and Mesa without overwriting custom patched binaries or pulling Rust packages.
+1 -1
View File
@@ -41,7 +41,7 @@ Closing the Gemini PDA clamshell (`SW_LID = 1`) suspends immediately to RAM (`me
- **Audio**: PipeWire uses `default.clock.min-quantum = 1024` and `quantum = 2048` (`10-geminux-power.conf`); WirePlumber suspends idle ALSA and BlueZ nodes after `3` seconds (`50-geminux-suspend.conf`) so audio DSP clocks gate quickly. - **Audio**: PipeWire uses `default.clock.min-quantum = 1024` and `quantum = 2048` (`10-geminux-power.conf`); WirePlumber suspends idle ALSA and BlueZ nodes after `3` seconds (`50-geminux-suspend.conf`) so audio DSP clocks gate quickly.
- **Bluetooth**: `bluetooth` OpenRC service is disabled from default boot (`AutoEnable=false` in `etc/bluetooth/main.conf`); users toggle Bluetooth on demand via `geminux-net`. - **Bluetooth**: `bluetooth` OpenRC service is disabled from default boot (`AutoEnable=false` in `etc/bluetooth/main.conf`); users toggle Bluetooth on demand via `geminux-net`.
- **Wi-Fi**: NetworkManager enforces `wifi.powersave = 3` (`10-geminux-power.conf`). - **Wi-Fi**: NetworkManager configures `wifi.powersave = 2` (`10-geminux-power.conf`) to keep CONSYS Wi-Fi awake while associated so GTK rekeys, ARP, and DNS never stall; the radio still powers down cleanly on Wi-Fi toggle-off or system S3 suspend.
- **Storage**: `noatime,commit=60` in `etc/fstab` alongside `vm.dirty_writeback_centisecs=1500` reduces eMMC write amplification and wakes. - **Storage**: `noatime,commit=60` in `etc/fstab` alongside `vm.dirty_writeback_centisecs=1500` reduces eMMC write amplification and wakes.
## Auditing on device ## Auditing on device
+13 -11
View File
@@ -1,42 +1,44 @@
# Geminux # Geminux
Geminux is an Alpine Linux (`aarch64`, musl, OpenRC) distribution built specifically for the Planet Computers Gemini PDA (Wi-Fi + 4G, MediaTek MT6797X / Helio X27). It runs a patched Linux `7.3.5-geminux` kernel, XLibre Xorg with Panfrost Glamor 3D acceleration, a custom Pango/HarfBuzz-enabled DWM/st/dmenu desktop with Fira Code ligatures and Noto fonts, zero-poll C11 system daemons, 11 landscape HiDPI applications (`libgemui.so`), the preinstalled `bantam` CLI AI agent (`geminux-bantam`, `kilo-auto/free` default), `lynx`, `gsocket`, and a pure-Linux MediaTek flasher with account provisioning and optional LUKS2 full-disk encryption. Geminux is an Alpine Linux (`aarch64`, musl, OpenRC) distribution built specifically for the Planet Computers Gemini PDA (Wi-Fi + 4G, MediaTek MT6797X / Helio X27). It runs a patched Linux `7.3.5-geminux` kernel, XLibre Xorg with Panfrost Glamor 3D acceleration, a custom Pango/HarfBuzz-enabled DWM/st/dmenu desktop with Fira Code ligatures and Noto fonts, zero-poll C11 system daemons, 11 landscape HiDPI applications (`libgemui.so`), the ported Webarchy ultrawide `GTK3`/`WebKit2GTK` browser (`geminux-webarchy`, right-side vertical tab bar), zero-Rust `mpv` + `ffmpeg` (`geminux-mpv`), `mpg123`, `yt-dlp`, `python3`/`pip`, `gpg` (`gnupg`), `pass`, the preinstalled `bantam` CLI AI agent (`geminux-bantam`, `kilo-auto/free` default), `lynx`, `gsocket`, and a pure-Linux MediaTek flasher with account provisioning and optional LUKS2 full-disk encryption.
## Key design goals ## Key design goals
- Pure Alpine Edge userspace updatable via `apk update && apk upgrade` - Pure Alpine Edge userspace updatable via `apk update && apk upgrade`
- Pinned kernel, modules, XLibre, suckless desktop, custom UI, `bantam`, `gsocket`, and device configs in local signed `@geminux` APK packages (`name@geminux=version`) - Pinned kernel, modules, XLibre, suckless desktop, custom UI, Webarchy browser, pure-C `gdk-pixbuf`, `mpv`/`ffmpeg`, `bantam`, `gsocket`, and device configs across 11 local signed `@geminux` APK packages (`name@geminux=version`)
- Zero Rust-dependent packages preinstalled (verified across installed ELF binaries and blocked via `!` pins in `/etc/apk/world`) - Zero Rust-dependent packages preinstalled (verified across installed ELF binaries and blocked via `!` pins in `/etc/apk/world`)
- Full eMMC occupancy for Linux (`geminux-root`) without Android dual-boot sharing, while strictly preserving the MediaTek protected region (`LBA 0..0x6FFFF`) - Full eMMC occupancy for Linux (`geminux-root`) without Android dual-boot sharing, while strictly preserving the MediaTek protected region (`LBA 0..0x6FFFF`)
- Optional LUKS2 + `dm-crypt` full-disk encryption (`--encrypt`, `aes-xts-plain64` with ARMv8 AES-CE, Argon2id) with early-boot `simpledrm` + Gemini matrix keyboard unlock and automatic first-boot ext4 expansion, alongside offline desktop/`root` credential provisioning during flashing - Optional LUKS2 + `dm-crypt` full-disk encryption (`--encrypt`, `aes-xts-plain64` with ARMv8 AES-CE, Argon2id) with early-boot `simpledrm` + Gemini matrix keyboard unlock and automatic first-boot ext4 expansion, alongside offline desktop/`root` credential provisioning during flashing
- Aggressive battery optimization from kernel (`HZ_100`, `RCU_LAZY`, `SUSPEND`, LZ4 `zram`, `SCHEDUTIL`) up to userspace (`epoll`-based zero-poll daemons, A72 big-cluster gating, WirePlumber idle suspend, Wi-Fi `powersave = 3`, Bluetooth disabled at boot, default-off cover LEDs, lid-close S3 suspend) - Aggressive battery optimization from kernel (`HZ_100`, `RCU_LAZY`, `SUSPEND`, LZ4 `zram`, `SCHEDUTIL`) up to userspace (`epoll`-based zero-poll daemons, A72 big-cluster gating, WirePlumber idle suspend, Wi-Fi `powersave = 2` keeping CONSYS awake while associated and gated on toggle-off/suspend, Bluetooth disabled at boot, default-off cover LEDs, lid-close S3 suspend)
## Component stack ## Component stack
| Subsystem | Implementation | Source / Script | | Subsystem | Implementation | Source / Script |
| --- | --- | --- | | --- | --- | --- |
| Kernel & boot | Linux `7.3.5-geminux` + Gemini x27 patches (`SSD2092` DSI/touch, CONSYS Wi-Fi/BT, CCCI/CLDMA, `sii902x`, `dm-crypt` LUKS2 initramfs) | [scripts/build-kernel.sh](file:///home/lux/proj/geminux/scripts/build-kernel.sh) | | Kernel & boot | Linux `7.3.5-geminux` + Gemini x27 patches (`SSD2092` DSI/touch, CONSYS Wi-Fi/BT + peer deauth/GTK rekey fix, CCCI/CLDMA, `sii902x`, `dm-crypt` LUKS2 initramfs) | [scripts/build-kernel.sh](file:///home/lux/proj/geminux/scripts/build-kernel.sh) |
| Flasher & GPT | Vendored GPLv3 `mtkclient` + MT6797 DA + GPT builder + offline credential & LUKS2 provisioning | [flash-mtk.sh](file:///home/lux/proj/geminux/flash-mtk.sh), [flash-mtk.py](file:///home/lux/proj/geminux/flash-mtk.py), [scripts/geminux_accounts.py](file:///home/lux/proj/geminux/scripts/geminux_accounts.py), [scripts/geminux_luks.py](file:///home/lux/proj/geminux/scripts/geminux_luks.py) | | Flasher & GPT | Vendored GPLv3 `mtkclient` + MT6797 DA + GPT builder + offline credential & LUKS2 provisioning | [flash-mtk.sh](file:///home/lux/proj/geminux/flash-mtk.sh), [flash-mtk.py](file:///home/lux/proj/geminux/flash-mtk.py), [scripts/geminux_accounts.py](file:///home/lux/proj/geminux/scripts/geminux_accounts.py), [scripts/geminux_luks.py](file:///home/lux/proj/geminux/scripts/geminux_luks.py) |
| Display server | XLibre Xorg 25.x (`Glamor`, `modesetting`, `fbdev`, `libinput`) | [scripts/build-xlibre.sh](file:///home/lux/proj/geminux/scripts/build-xlibre.sh) | | Display server | XLibre Xorg 25.x (`Glamor`, `modesetting`, `fbdev`, `libinput`) | [scripts/build-xlibre.sh](file:///home/lux/proj/geminux/scripts/build-xlibre.sh) |
| Window manager & terminal | Patched `dwm` (Pango, systray, `.Xresources`, `Mod4`), `st` (HarfBuzz ligatures, wheel scrollback), full-height `dmenu` | [scripts/build-suckless.sh](file:///home/lux/proj/geminux/scripts/build-suckless.sh) | | Window manager & terminal | Patched `dwm` (Pango, systray, `.Xresources`, `Mod4`), `st` (HarfBuzz ligatures, focus cursor sync, wheel scrollback), full-height `dmenu` | [scripts/build-suckless.sh](file:///home/lux/proj/geminux/scripts/build-suckless.sh) |
| Notifications | Pure-X11 zero-`gdk-pixbuf` `dunst v1.12.2` + custom GDBus `notify-send` / `dunstify` | [scripts/build-dunst.sh](file:///home/lux/proj/geminux/scripts/build-dunst.sh) | | Notifications | Pure-X11 zero-`gdk-pixbuf` `dunst v1.12.2` + custom GDBus `notify-send` / `dunstify` | [scripts/build-dunst.sh](file:///home/lux/proj/geminux/scripts/build-dunst.sh) |
| UI, daemons & CLI tools | `libgemui.so`, 11 landscape HiDPI apps, zero-poll C11 daemons, `bantam` CLI AI agent, `lynx`, `gsocket`, `.apexrc`, default `htoprc` | [scripts/build-geminux-ui.sh](file:///home/lux/proj/geminux/scripts/build-geminux-ui.sh), [scripts/build-bantam.sh](file:///home/lux/proj/geminux/scripts/build-bantam.sh), [scripts/build-gsocket.sh](file:///home/lux/proj/geminux/scripts/build-gsocket.sh) | | Web browser | Webarchy C++20 `GTK3` + `WebKit2GTK-4.1` ultrawide browser (right-side vertical tab bar, DPI-scaled `.Xresources` `SIGUSR1` theming) + pure-C `gdk-pixbuf 2.42.12` | [scripts/build-webarchy.sh](file:///home/lux/proj/geminux/scripts/build-webarchy.sh), [scripts/compile-gsettings-schemas.sh](file:///home/lux/proj/geminux/scripts/compile-gsettings-schemas.sh) |
| Local APK repository | 8 signed `@geminux` `.apk` packages + `APKINDEX.tar.gz` | [scripts/package-local-apks.sh](file:///home/lux/proj/geminux/scripts/package-local-apks.sh) | | UI & system daemons | `libgemui.so`, 11 landscape HiDPI apps (`geminux-net` DNS tab + active WLAN persistence), zero-poll C11 daemons (`geminux-dnsctl`, etc.) | [scripts/build-geminux-ui.sh](file:///home/lux/proj/geminux/scripts/build-geminux-ui.sh) |
| Media & CLI tools | Zero-Rust `mpv v0.40.0` (Panfrost X11 EGL + PipeWire), `ffmpeg`/`ffprobe`, `libgstlibav.so`, `mpg123`, `yt-dlp` (`quickjs`), `python3`/`pip3`, `gpg` (`gnupg`), `pass`, `bantam`, `lynx`, `gsocket`, `.apexrc`, default `htoprc` | [scripts/build-mpv.sh](file:///home/lux/proj/geminux/scripts/build-mpv.sh), [scripts/build-bantam.sh](file:///home/lux/proj/geminux/scripts/build-bantam.sh), [scripts/build-gsocket.sh](file:///home/lux/proj/geminux/scripts/build-gsocket.sh) |
| Local APK repository | 11 signed `@geminux` `.apk` packages + `APKINDEX.tar.gz` | [scripts/package-local-apks.sh](file:///home/lux/proj/geminux/scripts/package-local-apks.sh) |
| Full build & checks | Full image assembly + offline verification suite | [rebuild-image.sh](file:///home/lux/proj/geminux/rebuild-image.sh), [scripts/check-rebuild.sh](file:///home/lux/proj/geminux/scripts/check-rebuild.sh) | | Full build & checks | Full image assembly + offline verification suite | [rebuild-image.sh](file:///home/lux/proj/geminux/rebuild-image.sh), [scripts/check-rebuild.sh](file:///home/lux/proj/geminux/scripts/check-rebuild.sh) |
## Repository layout ## Repository layout
- [kernel/](file:///home/lux/proj/geminux/kernel) and [patches/kernel/](file:///home/lux/proj/geminux/patches/kernel) — kernel manifest, MT6797X configuration, and Linux `7.3.5` patch queue - [kernel/](file:///home/lux/proj/geminux/kernel) and [patches/kernel/](file:///home/lux/proj/geminux/patches/kernel) — kernel manifest, MT6797X configuration, and Linux `7.3.5` patch queue
- [src/](file:///home/lux/proj/geminux/src) — initramfs scripts, `st`, `dwm`, `dmenu`, `dunst-notify`, `bantam`, `libgemui`, `geminux-apps`, and `geminux-daemons` - [src/](file:///home/lux/proj/geminux/src) — initramfs scripts, `st`, `dwm`, `dmenu`, `dunst-notify`, `bantam`, `webarchy`, `libgemui`, `geminux-apps`, and `geminux-daemons`
- [overlay/rootfs/](file:///home/lux/proj/geminux/overlay/rootfs) — OpenRC services, ALSA UCM2, XKB layout, console keymap, Xorg drop-ins, 21 `.xth` themes, PipeWire/WirePlumber, udev, and NetworkManager configs - [overlay/rootfs/](file:///home/lux/proj/geminux/overlay/rootfs) — OpenRC services, ALSA UCM2, XKB layout, console keymap, Xorg drop-ins, 21 `.xth` themes, PipeWire/WirePlumber, udev, and NetworkManager configs
- [scripts/](file:///home/lux/proj/geminux/scripts) — cross-compilation builders, APK packager, rootfs bootstrapper, verification suite, and unit tests - [scripts/](file:///home/lux/proj/geminux/scripts) — cross-compilation builders, APK packager, rootfs bootstrapper, verification suite, and unit tests
- [prebuilt/](file:///home/lux/proj/geminux/prebuilt) — cross-compiled `aarch64` staging tree (`images/` holds built boot, recovery, and ext4 rootfs images) - [prebuilt/](file:///home/lux/proj/geminux/prebuilt) — cross-compiled `aarch64` staging tree (`images/` holds built boot, recovery, and ext4 rootfs images)
## Verification status vs. on-device testing ## Verification status vs. on-device testing
All cross-compiled binaries, kernel/DTB artifacts, GPT repartitioning logic, offline credential/LUKS2 builders, XKB keymap compilation, `.Xresources`-to-`dunstrc` theme syncing, MT6797 CCCI framing/handshake unit tests, zero-poll power policy tests, ELF binary Rust scan, and `apk upgrade --simulate` checks are verified automatically via [scripts/check-rebuild.sh](file:///home/lux/proj/geminux/scripts/check-rebuild.sh). All cross-compiled binaries, kernel/DTB artifacts, GPT repartitioning logic, offline credential/LUKS2 builders, XKB keymap compilation, `.Xresources`-to-`dunstrc` theme syncing, MT6797 CCCI framing/handshake unit tests, zero-poll power policy tests, Webarchy renderer profile & WebKit GSettings schema tests, ELF binary Rust scan, and `apk upgrade --simulate` checks are verified automatically via [scripts/check-rebuild.sh](file:///home/lux/proj/geminux/scripts/check-rebuild.sh).
Live hardware bring-up on a physical Planet Computers Gemini PDA (x27 Wi-Fi + 4G) has been verified for USB BROM/DA flashing, offline account provisioning, LUKS2 full-disk encryption unlock & first-boot ext4 resize, `SSD2092` FHD+ display & multi-touch gestures (`geminux-touchd`), CONSYS Wi-Fi/BT, PipeWire audio, Media Controller + 10-bit Bayer camera ISP, AW9120 RGB back LEDs, Chrony online time sync, and USB NCM networking. Accessory/carrier-dependent checks (such as live cellular calls/SMS with a SIM card and external Slimport/HDMI monitors) are documented in the hardware checklist in [INSTALL.md](file:///home/lux/proj/geminux/INSTALL.md). Live hardware bring-up on a physical Planet Computers Gemini PDA (x27 Wi-Fi + 4G) has been verified for USB BROM/DA flashing, offline account provisioning, LUKS2 full-disk encryption unlock & first-boot ext4 resize, `SSD2092` FHD+ display & multi-touch gestures (`geminux-touchd`), CONSYS Wi-Fi/BT (`geminux-net` DNS tab & associated WLAN persistence), Webarchy ultrawide Panfrost GPU rendering, PipeWire audio, Media Controller + 10-bit Bayer camera ISP, AW9120 RGB back LEDs, Chrony online time sync, and USB NCM networking. Accessory/carrier-dependent checks (such as live cellular calls/SMS with a SIM card and external Slimport/HDMI monitors) are documented in the hardware checklist in [INSTALL.md](file:///home/lux/proj/geminux/INSTALL.md).
## Quick start (host build and checks) ## Quick start (host build and checks)
@@ -45,7 +47,7 @@ Live hardware bring-up on a physical Planet Computers Gemini PDA (x27 Wi-Fi + 4G
./scripts/check-rebuild.sh ./scripts/check-rebuild.sh
``` ```
To rebuild all cross-compiled components from scratch (kernel, XLibre, suckless desktop, dunst, UI apps/daemons, Bantam, gsocket, signed `@geminux` APKs, and rootfs ext4): To rebuild all cross-compiled components from scratch (kernel, XLibre, suckless desktop, dunst, UI apps/daemons, Bantam, gsocket, mpv/FFmpeg/`gst-libav`, pure-C `gdk-pixbuf`/Webarchy, signed `@geminux` APKs, and rootfs ext4):
```sh ```sh
./rebuild-image.sh --rebuild-all --force-bootstrap ./rebuild-image.sh --rebuild-all --force-bootstrap
@@ -1,6 +1,7 @@
[connection] [connection]
# Enable aggressive IEEE 802.11 power save for Wi-Fi radio standby savings. # Keep Wi-Fi awake while associated so CONSYS GTK rekeys, ARP, and DNS never stall;
wifi.powersave = 3 # radio still powers down on toggle-off or system suspend.
wifi.powersave = 2
[keyfile] [keyfile]
# Allow geminux-usb-gadget init script to manage usb0 (172.16.42.1/24) cleanly. # Allow geminux-usb-gadget init script to manage usb0 (172.16.42.1/24) cleanly.
@@ -2,5 +2,6 @@ permit persist :wheel
permit nopass :wheel as root cmd /usr/bin/geminux-power-ctl permit nopass :wheel as root cmd /usr/bin/geminux-power-ctl
permit nopass :wheel as root cmd /usr/sbin/geminux-checkpw permit nopass :wheel as root cmd /usr/sbin/geminux-checkpw
permit nopass :wheel as root cmd /usr/sbin/geminux-tzctl permit nopass :wheel as root cmd /usr/sbin/geminux-tzctl
permit nopass :wheel as root cmd /usr/sbin/geminux-dnsctl
permit nopass :wheel as root cmd /sbin/poweroff permit nopass :wheel as root cmd /sbin/poweroff
permit nopass :wheel as root cmd /sbin/reboot permit nopass :wheel as root cmd /sbin/reboot
+1
View File
@@ -4,6 +4,7 @@ if [ -r /etc/profile.d/10-geminux-env.sh ]; then
fi fi
export LANG="${LANG:-en_US.UTF-8}" export LANG="${LANG:-en_US.UTF-8}"
export LC_ALL="${LC_ALL:-en_US.UTF-8}" export LC_ALL="${LC_ALL:-en_US.UTF-8}"
[ -t 0 ] && export GPG_TTY="$(tty)"
PS1='[\u@\h \W]\$ ' PS1='[\u@\h \W]\$ '
alias ll='ls -la' alias ll='ls -la'
alias power-audit='geminux-power-audit' alias power-audit='geminux-power-audit'
+2 -2
View File
@@ -31,8 +31,8 @@ fi
/usr/bin/geminux-sync-dunst-theme /usr/bin/geminux-sync-dunst-theme
# Signal live applications (dwm, st, libgemui apps) to reload .Xresources via SIGUSR1 # Signal live applications (dwm, st, webarchy, libgemui apps) to reload .Xresources via SIGUSR1
for proc in dwm st geminux-dialer geminux-callscreen geminux-sms geminux-contacts \ for proc in dwm st webarchy geminux-dialer geminux-callscreen geminux-sms geminux-contacts \
geminux-net geminux-audio geminux-camera geminux-control geminux-datetime geminux-themes geminux-lock; do geminux-net geminux-audio geminux-camera geminux-control geminux-datetime geminux-themes geminux-lock; do
for pid in $(pidof "$proc" 2>/dev/null || true); do for pid in $(pidof "$proc" 2>/dev/null || true); do
kill -USR1 "$pid" 2>/dev/null || true kill -USR1 "$pid" 2>/dev/null || true
+1
View File
@@ -21,6 +21,7 @@ fi
LAUNCHER_LIST=" LAUNCHER_LIST="
 Terminal|st  Terminal|st
󰚩 Bantam AI agent|st -t 'Bantam AI agent' -e /bin/bash -lc 'exec bantam' 󰚩 Bantam AI agent|st -t 'Bantam AI agent' -e /bin/bash -lc 'exec bantam'
󰖟 Webarchy Browser|webarchy
󰖟 Lynx Web Browser|st -e sh -c 'exec lynx -cfg="$HOME/.lynx.cfg"' 󰖟 Lynx Web Browser|st -e sh -c 'exec lynx -cfg="$HOME/.lynx.cfg"'
 Dialer|geminux-dialer  Dialer|geminux-dialer
󰍩 SMS Messages|geminux-sms 󰍩 SMS Messages|geminux-sms
@@ -0,0 +1,212 @@
--- a/drivers/net/wireless/mediatek/mt6797/mac-priv.h
+++ b/drivers/net/wireless/mediatek/mt6797/mac-priv.h
@@ -832,6 +832,16 @@ void mt6797_ccmp_connection_lost(struct mt6797_mac *mac, const char *source,
void mt6797_ccmp_receive(struct mt6797_mac *mac, struct sk_buff *skb);
+bool mt6797_ccmp_rx_ready(struct mt6797_mac *mac);
+
+bool mt6797_join_peer_deauth(const unsigned char *packet, size_t bytes,
+ unsigned char channel, const unsigned char own[6],
+ const unsigned char ap[6], unsigned char bmc_index,
+ unsigned int *reason_out);
+
+bool mt6797_ccmp_rx_eapol_rekey(const unsigned char *packet, size_t bytes,
+ const struct mt6797_ccmp_rx_context *context);
+
int mt6797_mac_join_open_lifetime(struct mt6797_mac *mac);
void mt6797_mac_join_read_bss(struct mt6797_mac *mac, struct ieee80211_vif *vif,
const struct ieee80211_bss_conf *info);
--- a/drivers/net/wireless/mediatek/mt6797/data.c
+++ b/drivers/net/wireless/mediatek/mt6797/data.c
@@ -1174,7 +1174,7 @@ void mt6797_ccmp_withdraw(struct mt6797_mac *mac)
complete_all(&mac->ccmp_key_done);
}
-static bool mt6797_ccmp_rx_ready(struct mt6797_mac *mac)
+bool mt6797_ccmp_rx_ready(struct mt6797_mac *mac)
{
return !mac->ccmp_closed && mac->ccmp_rx.active && mac->ccmp_rx.authorized &&
mac->ccmp_decap && rcu_access_pointer(mac->ccmp_sta) && mac->ccmp_ptk &&
@@ -1919,3 +1919,135 @@ void mt6797_mac_eapol_trace(struct mt6797_mac *mac, size_t bytes,
bytes, frame_bytes, eapol_bytes, p[5], !!(p[6] & 0x80),
copied, (int)sizeof(header), header);
}
+
+bool mt6797_join_peer_deauth(const unsigned char *packet, size_t bytes,
+ unsigned char channel, const unsigned char own[6],
+ const unsigned char ap[6], unsigned char bmc_index,
+ unsigned int *reason_out)
+{
+ static const unsigned char broadcast[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
+ size_t offset = 16;
+ unsigned int type, groups, match, status, fc, subtype;
+ const unsigned char *f;
+
+ if (!packet || !own || !ap || !channel || bytes < 16 || bytes > 4096 ||
+ mt6797_join_le16(packet) != bytes || packet[5] != channel)
+ return false;
+ type = mt6797_join_le16(packet + 2);
+ if ((type & 0xe00f) != 0xe001)
+ return false;
+ if ((packet[6] & 0xbf) != 24 || packet[7] != 0x04)
+ return false;
+ match = packet[4] & 0x3f;
+ if (match == 0x02) {
+ if (packet[8] != 1)
+ return false;
+ } else if (match == 0x08) {
+ if (packet[8] != bmc_index)
+ return false;
+ } else {
+ return false;
+ }
+ status = mt6797_join_le16(packet + 10);
+ if (status != 0xe000 && status != 0xe004)
+ return false;
+ groups = (type >> 9) & 15;
+ if (groups & 8)
+ offset += 16;
+ if (groups & 1)
+ offset += 16;
+ if (groups & 2)
+ offset += 8;
+ if (groups & 4)
+ offset += 24;
+ if (packet[6] & 0x40)
+ offset += 2;
+ if (offset > bytes || bytes - offset < 26)
+ return false;
+ f = packet + offset;
+ fc = mt6797_join_le16(f);
+ subtype = (fc >> 4) & 15;
+ if ((fc & 0xc70f) || (subtype != 10 && subtype != 12) ||
+ (mt6797_join_le16(f + 22) & 15))
+ return false;
+ if (match == 0x02) {
+ if (memcmp(f + 4, own, 6))
+ return false;
+ } else if (memcmp(f + 4, broadcast, 6)) {
+ return false;
+ }
+ if (memcmp(f + 10, ap, 6) || memcmp(f + 16, ap, 6))
+ return false;
+ if (reason_out)
+ *reason_out = mt6797_join_le16(f + 24);
+ return true;
+}
+
+bool mt6797_ccmp_rx_eapol_rekey(const unsigned char *packet, size_t bytes,
+ const struct mt6797_ccmp_rx_context *context)
+{
+ unsigned char pn[6];
+ size_t offset = 48;
+ unsigned int groups, fc, i, tid;
+ const unsigned char *last;
+ const unsigned char *ethernet;
+ bool greater = false, own_any = false, ap_any = false, source_any = false;
+
+ if (!packet || !context || bytes < 16 || bytes > 2352 ||
+ !context->authorized || !context->active || !context->seeded ||
+ !context->pairwise || context->cipher != 0x000fac04U ||
+ context->key_bytes != 16 || context->key_id ||
+ context->wlan_index != 1 || context->rxd_bssid > 63 || !context->channel ||
+ (context->own[0] & 1) || (context->ap[0] & 1))
+ return false;
+ for (i = 0; i < 6; i++) {
+ own_any |= context->own[i] != 0;
+ ap_any |= context->ap[i] != 0;
+ }
+ if (!own_any || !ap_any || mt6797_join_le16(packet) != bytes ||
+ (mt6797_join_le16(packet + 2) >> 13) != 2 ||
+ packet[4] != 0x02 || packet[5] != context->channel ||
+ (packet[6] & 0xbf) != 0x8e ||
+ packet[7] != (unsigned int)context->rxd_bssid << 2 ||
+ packet[8] != context->wlan_index || (packet[9] & 0xf0) != 0x40 ||
+ !mt6797_ccmp_rx_status_ok(mt6797_join_le16(packet + 10)))
+ return false;
+ groups = (mt6797_join_le16(packet + 2) >> 9) & 15;
+ if ((groups & 9) != 9)
+ return false;
+ if (groups & 2)
+ offset += 8;
+ if (groups & 4)
+ offset += 24;
+ if (packet[6] & 0x40)
+ offset += 2;
+ if (offset > bytes || bytes - offset <= 14)
+ return false;
+ fc = mt6797_join_le16(packet + 16);
+ if ((fc & ~(0x2800U | MT6797_CCMP_RX_QOS_BIT)) != 0x4208 ||
+ (mt6797_join_le16(packet + 24) & 15) ||
+ !mt6797_ccmp_rx_tid_ok(packet, fc, 0x40) ||
+ mt6797_join_le32(packet + 28))
+ return false;
+ ethernet = packet + offset;
+ for (i = 0; i < 6; i++) {
+ if (packet[18 + i] != context->ap[i] || ethernet[i] != context->own[i])
+ return false;
+ source_any |= ethernet[6 + i] != 0;
+ pn[i] = packet[32 + 5 - i];
+ }
+ if (!source_any || (ethernet[6] & 1) ||
+ ethernet[12] != 0x88 || ethernet[13] != 0x8e)
+ return false;
+ tid = packet[9] & 15;
+ last = tid ? context->tid_pn[tid - 1] : context->pn;
+ for (i = 0; i < 6; i++) {
+ if (pn[i] < last[i])
+ return false;
+ if (pn[i] > last[i]) {
+ greater = true;
+ break;
+ }
+ }
+ return greater;
+}
--- a/drivers/net/wireless/mediatek/mt6797/join.c
+++ b/drivers/net/wireless/mediatek/mt6797/join.c
@@ -2838,6 +2838,7 @@ void mt6797_mac_join_work(struct work_struct *work)
mac->native_diag_bytes };
bool admitted;
struct mt6797_native_beacon nbcn;
+ unsigned int deauth_reason;
nb.native_rx = mac->ccmp_queued;
admitted = mac->native_diag_state == MT6797_ND_ACTIVE &&
@@ -2861,6 +2862,35 @@ void mt6797_mac_join_work(struct work_struct *work)
goto failed;
continue;
}
+ if (mac->join_assoc_received && !mac->join_assoc_status &&
+ !mac->join_cleanup_done &&
+ mt6797_join_peer_deauth(mac->join_packet,
+ rx.logical_bytes,
+ mac->join_chan_number,
+ mac->hw->wiphy->perm_addr,
+ mac->join_ap,
+ MT6797_JOIN_BMC_WLAN_INDEX,
+ &deauth_reason)) {
+ if (mac->join_data_phase && !mac->join_data_ended) {
+ dev_info(wiphy_dev(mac->hw->wiphy),
+ "one-shot WLAN peer deauth/disassoc: reason=%u\n",
+ deauth_reason);
+ mt6797_mac_join_end_data(mac, "peer-deauth");
+ mt6797_ccmp_connection_lost(mac, "peer-deauth",
+ deauth_reason);
+ }
+ continue;
+ }
+ if (admitted && mt6797_ccmp_rx_ready(mac) &&
+ mt6797_ccmp_rx_eapol_rekey(mac->join_packet,
+ rx.logical_bytes,
+ &mac->ccmp_rx)) {
+ dev_info(wiphy_dev(mac->hw->wiphy),
+ "one-shot WLAN peer GTK rekey: triggering reassociation\n");
+ mt6797_mac_join_end_data(mac, "gtk-rekey");
+ mt6797_ccmp_connection_lost(mac, "gtk-rekey", 0);
+ continue;
+ }
if (admitted)
ret = mt6797_ccmp_queue_rx(mac, rx.logical_bytes,
&received);
+1
View File
@@ -4,3 +4,4 @@
0004-gemini-ssd2092-display-and-touch.patch 0004-gemini-ssd2092-display-and-touch.patch
0005-mt6797-consys-wifi-factory-firmware.patch 0005-mt6797-consys-wifi-factory-firmware.patch
0006-mt6797-boot-cleanups.patch 0006-mt6797-boot-cleanups.patch
0007-mt6797-wlan-peer-deauth-and-rekey.patch
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
# Pure-C gdk-pixbuf 2.42.12: all standard loaders (png, jpeg, gif, bmp, ico, xpm, xbm, tga, pnm) are built-in.
+1
View File
@@ -0,0 +1 @@
libgdk_pixbuf-2.0.so.0.4200.12
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+224
View File
@@ -0,0 +1,224 @@
#
# mpv configuration file
#
#########################
# encoding profile file #
#########################
#
# Note: by default, this file is installed to /etc/mpv/encoding-profiles.conf
# (or a different location, depending on --prefix). mpv will load it by
# default on program start. If ~/.mpv/encoding-profiles.conf exists, this file
# will be loaded instead.
#
# Then, list all profiles by
# mpv --profile=help | grep enc-
#
# The following kinds of encoding profiles exist:
# enc-a-*: initialize an audio codec including good defaults
# enc-v-*: initialize a video codec including good defaults
# enc-f-*: initialize a file format including good defaults, including
# selecting and initializing a good audio and video codec
# enc-to-*: load known good settings for a target device; this typically
# includes selecting an enc-f-* profile, then adjusting some
# settings like frame rate, resolution and codec parameters
#
# AFTER including a profile of these, you can of course still change
# options, or even switch to another codec.
#
# You can view the exact options a profile sets by
# mpv --show-profile=enc-to-hp-slate-7
#
# Examples:
# mpv --profile=enc-to-dvdpal --o=outfile.mpg infile.mkv
# mpv --profile=enc-f-avi --vf=fps=30 --o=outfile.avi infile.mkv
# mpv --profile=enc-v-mpeg4 --ovcopts-add=qscale=7 --profile=enc-a-mp3 --oacopts-add=b=320k --o=outfile.avi infile.mkv
################
# audio codecs #
################
[enc-a-aac]
profile-desc = "AAC (libfdk-aac or FFmpeg)"
oac = libfdk_aac,aac
oacopts = b=96k
[enc-a-ac3]
profile-desc = "AC3 (FFmpeg)"
oac = ac3
oacopts = b=448k
[enc-a-mp3]
profile-desc = "MP3 (LAME)"
oac = libmp3lame
oacopts = b=128k
[enc-a-vorbis]
profile-desc = "Vorbis (libvorbis or FFmpeg)"
oac = libvorbis,vorbis
oacopts = qscale=3
[enc-a-opus]
profile-desc = "Opus (libopus or FFmpeg)"
oac = libopus,opus
audio-samplerate = 48000
oacopts = b=96k
################
# video codecs #
################
[enc-v-h263]
profile-desc = "H.263 (FFmpeg)"
ovc = h263
ovcopts = qscale=4
[enc-v-h264]
profile-desc = "H.264 (x264)"
ovc = libx264
ovcopts = preset=medium,crf=23,threads=0
# If you want to restrict the output video to something compatible with most
# hardware and basic decoders, add "profile=high,level=41" to ovcopts above and
# uncomment the following line to avoid errors when source video isn't yuv420p:
#vf-add = format=yuv420p
[enc-v-mpeg2]
profile-desc = "MPEG-2 Video (FFmpeg)"
ovc = mpeg2video
[enc-v-mpeg4]
profile-desc = "MPEG-4 Part 2 (FFmpeg)"
ovc = mpeg4
ovcopts = qscale=4
[enc-v-vp8]
profile-desc = "VP8 (libvpx)"
ovc = libvpx
ovcopts = speed=0,lag-in-frames=8,slices=2,threads=0,b=2M,crf=10,qmin=0,qmax=36
[enc-v-vp9]
profile-desc = "VP9 (libvpx)"
ovc = libvpx-vp9
ovcopts = speed=6,lag-in-frames=8,slices=2,threads=0,crf=18,qmin=0,qmax=36
###########
# formats #
###########
[enc-f-3gp]
profile-desc = "H.263 + AAC (for 3GP)"
of = 3gp
profile = enc-v-h263
profile = enc-a-aac
ofopts = ""
[enc-f-avi]
profile-desc = "MPEG-4 + MP3 (for AVI)"
of = avi
profile = enc-v-mpeg4
profile = enc-a-mp3
ofopts = ""
[enc-f-mp4]
profile-desc = "H.264 + AAC (for MP4)"
of = mp4
profile = enc-v-h264
profile = enc-a-aac
## equivalent to using qt-faststart tool
## can be used to speed up seeking when streaming
# ofopts = movflags=+faststart
[enc-f-webm]
profile-desc = "VP9 + Opus (for WebM)"
of = webm
profile = enc-v-vp9
profile = enc-a-opus
ofopts = ""
##################
# target devices #
##################
[enc-to-dvdpal]
profile-desc = "DVD-Video PAL, use dvdauthor -v pal -a ac3+en (MUST be used with 4:3 or 16:9 aspect, and 720x576, 704x576, 352x576 or 352x288 resolution)"
profile = enc-v-mpeg2
profile = enc-a-ac3
of = dvd
ofopts-append = packetsize=2048
ofopts-append = muxrate=10080000
vf-add = fps=25
audio-samplerate = 48000
ovcopts = g=15,b=6000000,maxrate=9000000,minrate=0,bufsize=1835008
[enc-to-dvdntsc]
profile-desc = "DVD-Video NTSC, use dvdauthor -v ntsc -a ac3+en (MUST be used with 4:3 or 16:9 aspect, and 720x480, 704x480, 352x480 or 352x240 resolution)"
profile = enc-v-mpeg2
profile = enc-a-ac3
of = dvd
ofopts-append = packetsize=2048
ofopts-append = muxrate=10080000
vf-add = fps="24000/1001"
audio-samplerate = 48000
ovcopts = g=18,b=6000000,maxrate=9000000,minrate=0,bufsize=1835008
[enc-to-nok-n900]
profile-desc = "MP4 for Nokia N900"
profile = enc-f-mp4
# DW = 800, DH = 480, SAR = 1
vf-add = lavfi=graph="scale=floor(min(min(800\,dar*480)\,in_w*max(1\,sar))/2+0.5)*2:floor(min(min(800/dar\,480)\,in_h*max(1/sar\,1))/2+0.5)*2,setsar=sar=1"
ovcopts-append = profile=baseline
ovcopts-append = level=30
ovcopts-append = maxrate=10000k
ovcopts-append = bufsize=10000k
ovcopts-append = rc_init_occupancy=9000k
ovcopts-append = refs=5
[enc-to-nok-6300]
profile-desc = "3GP for Nokia 6300"
profile = enc-f-3gp
vf-add = fps=25
vf-add = lavfi=graph="scale=176:144"
audio-samplerate = 16000
audio-channels = 1
oacopts-add = b=32k
[enc-to-hp-slate-7]
profile-desc = "MP4 for HP Slate 7 (1024x600, crazy aspect)"
profile = enc-f-mp4
ovcopts-add = profile=high
# DW = 1024, DH = 600, DAR = 97:54 (=> SAR = 2425:2304)
vf-add = lavfi=graph="scale=floor(min(1024*min(1\,dar/(97/54))\,in_w)/2+0.5)*2:floor(min(600*min((97/54)/dar\,1)\,in_h)/2+0.5)*2,setsar=sar=sar/(2425/2304)"
# Advanced scaling for specific output devices - how it works:
# DW = display width (px) (1024)
# DH = display height (px) (600)
# SAR = display sample aspect ratio, i.e. DAR * DH / DW (2425:2304)
# DAR = display aspect ratio, i.e. SAR * DW / DH (97:54)
# Variant: zoomed out
# vf-add = lavfi=graph="scale=floor(min(DW*min(1\,dar/DAR)\,in_w*max(1\,sar/SAR))/2+0.5)*2:floor(min(DH*min(DAR/dar\,1)\,in_h*max(SAR/sar\,1))/2+0.5)*2,setsar=sar=1"
# Variant: zoomed in
# vf-add = lavfi=graph="scale=floor(min(DW*max(1\,dar/DAR)\,in_w*max(1\,sar/SAR))/2+0.5)*2:floor(min(DH*max(DAR/dar\,1)\,in_h*max(SAR/sar\,1))/2+0.5)*2,setsar=sar=1"
# How it works:
# 1a: DW, DH*dar/DAR - fit to display width
# 1b: DH*DAR/dar, DH - fit to display height
# 1: the min of 1a and 1b these (i.e. fit inside both width and height); for zoomed in view, use the max
# 2a: in_w, in_h*SAR/sar - fit to original width
# 2b: in_w*sar/SAR, in_h - fit to original height
# 2: the max of 2a and 2b (i.e. avoid enlarging both dimensions - let HW scaling handle this)
# output: the min of 1 and 2 (i.e. fulfill both constraints)
# setsar=sar=1 to prevent scaling on the device (skip this if the device actually wants the proper SAR to be specified for not performing needless scaling)
#
# Simplified special case for SAR == 1, DAR == DW/DH:
# Variant: zoomed out
# vf-add = lavfi=graph="scale=floor(min(min(DW\,dar*DH)\,in_w*max(1\,sar))/2+0.5)*2:floor(min(min(DW/dar\,DH)\,in_h*max(1/sar\,1))/2+0.5)*2,setsar=sar=1"
# Variant: zoomed in
# vf-add = lavfi=graph="scale=floor(min(max(DW\,dar*DH)\,in_w*max(1\,sar))/2+0.5)*2:floor(min(max(DW/dar\,DH)\,in_h*max(1/sar\,1))/2+0.5)*2,setsar=sar=1"
# setsar=sar=1 to prevent nasty almost-1 SAR to be passed to the codec due to the rounding which can fail
#
# If the device supports file SAR properly, we can make use of it to avoid
# upscaling. The setsar=sar=sar/SAR at the end serves to fake the SAR for devices that don't know their own display's SAR.
# Variant: zoomed out
# vf-add = lavfi=graph="scale=floor(min(DW*min(1\,dar/DAR)\,in_w)/2+0.5)*2:floor(min(DH*min(DAR/dar\,1)\,in_h)/2+0.5)*2,setsar=sar=sar/SAR"
# Variant: zoomed in
# vf-add = lavfi=graph="scale=floor(min(DW*max(1\,dar/DAR)\,in_w)/2+0.5)*2:floor(min(DH*max(DAR/dar\,1)\,in_h)/2+0.5)*2,setsar=sar=sar/SAR"
# Simplified special case for SAR == 1, DAR == DW/DH:
# Variant: zoomed out
# vf-add = lavfi=graph="scale=floor(min(min(DW\,dar*DH)\,in_w)/2+0.5)*2:floor(min(min(DW/dar\,DH)\,in_h)/2+0.5)*2"
# Variant: zoomed in
# vf-add = lavfi=graph="scale=floor(min(max(DW\,dar*DH)\,in_w)/2+0.5)*2:floor(min(max(DW/dar\,DH)\,in_h)/2+0.5)*2"
+7
View File
@@ -0,0 +1,7 @@
# Geminux defaults (MT6797X + Mali-T880 Panfrost X11 EGL + PipeWire)
vo=gpu
gpu-api=opengl
gpu-context=x11egl
ao=pipewire,pulse,alsa
vd-lavc-threads=4
osc=yes
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+1
View File
@@ -0,0 +1 @@
libavcodec.so.61.19.101
Binary file not shown.
+1
View File
@@ -0,0 +1 @@
libavdevice.so.61.3.100
Binary file not shown.
+1
View File
@@ -0,0 +1 @@
libavfilter.so.10.5.100
Binary file not shown.
+1
View File
@@ -0,0 +1 @@
libavformat.so.61.7.103
Binary file not shown.
+1
View File
@@ -0,0 +1 @@
libavutil.so.59.39.100
Binary file not shown.
Binary file not shown.
+1
View File
@@ -0,0 +1 @@
libswresample.so.5.3.100
Binary file not shown.
+1
View File
@@ -0,0 +1 @@
libswscale.so.8.3.100
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,51 @@
[Desktop Entry]
Type=Application
Name=mpv Media Player
Name[ar]=مشغل وسائط mpv
Name[ca]=Reproductor multimèdia mpv
Name[cs]=mpv přehrávač
Name[da]=mpv-medieafspiller
Name[fr]=Lecteur multimédia mpv
Name[it]=Lettore multimediale mpv
Name[ja]=mpv メディアプレイヤー
Name[pl]=Odtwarzacz mpv
Name[ru]=Проигрыватель mpv
Name[tr]=mpv Ortam Oynatıcı
Name[zh_CN]=mpv 媒体播放器
Name[zh_TW]=mpv 媒體播放器
GenericName=Multimedia player
GenericName[ar]=مُشَغِّل وسائط متعددة
GenericName[cs]=Multimediální přehrávač
GenericName[da]=Multimedieafspiller
GenericName[fr]=Lecteur multimédia
GenericName[it]=Lettore multimediale
GenericName[ja]=マルチメディアプレイヤー
GenericName[ru]=Мультимедийный проигрыватель
GenericName[tr]=Çoklu ortam oynatıcı
GenericName[zh_CN]=多媒体播放器
GenericName[zh_TW]=多媒體播放器
Comment=Play movies and songs
Comment[ar]=شَغِّل الأفلام والأغاني
Comment[ca]=Reproduïu vídeos i cançons
Comment[cs]=Přehrává filmy a hudbu
Comment[da]=Afspil film og sange
Comment[de]=Filme und Musik abspielen
Comment[es]=Reproduzca vídeos y canciones
Comment[fr]=Lire des vidéos et des musiques
Comment[ja]=映画や音楽を再生する
Comment[it]=Riproduci video e canzoni
Comment[pl]=Odtwarzaj filmy i muzykę
Comment[ru]=Воспроизведение фильмов и музыки
Comment[tr]=Filmleri ve şarkıları oynatın
Comment[zh_CN]=播放电影和歌曲
Comment[zh_TW]=播放電影和歌曲
Icon=mpv
TryExec=mpv
Exec=mpv --player-operation-mode=pseudo-gui -- %U
Terminal=false
Categories=AudioVideo;Audio;Video;Player;TV;
MimeType=application/ogg;application/x-ogg;application/mxf;application/sdp;application/smil;application/x-smil;application/streamingmedia;application/x-streamingmedia;application/vnd.rn-realmedia;application/vnd.rn-realmedia-vbr;audio/aac;audio/x-aac;audio/vnd.dolby.heaac.1;audio/vnd.dolby.heaac.2;audio/aiff;audio/x-aiff;audio/m4a;audio/x-m4a;application/x-extension-m4a;audio/mp1;audio/x-mp1;audio/mp2;audio/x-mp2;audio/mp3;audio/x-mp3;audio/mpeg;audio/mpeg2;audio/mpeg3;audio/mpegurl;audio/x-mpegurl;audio/mpg;audio/x-mpg;audio/rn-mpeg;audio/musepack;audio/x-musepack;audio/ogg;audio/scpls;audio/x-scpls;audio/vnd.rn-realaudio;audio/wav;audio/x-pn-wav;audio/x-pn-windows-pcm;audio/x-realaudio;audio/x-pn-realaudio;audio/x-ms-wma;audio/x-pls;audio/x-wav;video/mpeg;video/x-mpeg2;video/x-mpeg3;video/mp4v-es;video/x-m4v;video/mp4;application/x-extension-mp4;video/divx;video/vnd.divx;video/msvideo;video/x-msvideo;video/ogg;video/quicktime;video/vnd.rn-realvideo;video/x-ms-afs;video/x-ms-asf;audio/x-ms-asf;application/vnd.ms-asf;video/x-ms-wmv;video/x-ms-wmx;video/x-ms-wvxvideo;video/x-avi;video/avi;video/x-flic;video/fli;video/x-flc;video/flv;video/x-flv;video/x-theora;video/x-theora+ogg;video/x-matroska;video/mkv;audio/x-matroska;application/x-matroska;video/webm;audio/webm;audio/vorbis;audio/x-vorbis;audio/x-vorbis+ogg;video/x-ogm;video/x-ogm+ogg;application/x-ogm;application/x-ogm-audio;application/x-ogm-video;application/x-shorten;audio/x-shorten;audio/x-ape;audio/x-wavpack;audio/x-tta;audio/AMR;audio/ac3;audio/eac3;audio/amr-wb;video/mp2t;audio/flac;audio/mp4;application/x-mpegurl;video/vnd.mpegurl;application/vnd.apple.mpegurl;audio/x-pn-au;video/3gp;video/3gpp;video/3gpp2;audio/3gpp;audio/3gpp2;video/dv;audio/dv;audio/opus;audio/vnd.dts;audio/vnd.dts.hd;audio/x-adpcm;application/x-cue;audio/m3u;audio/vnd.wave;video/vnd.avi;
X-KDE-Protocols=appending,file,ftp,hls,http,https,mms,mpv,rist,rtmp,rtmps,rtmpt,rtmpts,rtp,rtsp,rtsps,sftp,smb,srt,srtp,webdav,webdavs
StartupWMClass=mpv
Keywords=mpv;media;player;video;audio;tv;
Keywords[ar]=mpv;إم بي في;ام بي في;وسائط;مشغل;فيديو;مرئية;صوتي;تلفاز;
@@ -0,0 +1,142 @@
#
# This file is part of mpv.
#
# mpv is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# mpv is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with mpv. If not, see <http://www.gnu.org/licenses/>.
#
_mpv_options()
{
if [ -z ${_mpv_options_cache+x} ]; then
_mpv_options_cache=$(mpv --no-config --list-options)
fi
echo "$_mpv_options_cache"
}
_mpv_get_args()
{
local doc=$(_mpv_options | grep -E "^\\s*$1\\s")
local partial="$2"
local type=$(echo "$doc" | awk '{print $2;}')
# We special-case profiles to ensure we read the config
if [ "$1" = "--show-profile" ]; then
type="ShowProfile"
elif [ "$1" = "--profile" ]; then
type="Profile"
fi
declare -a candidates
case $type in
String)
if echo "$doc" | grep -q '\[file\]' ; then
if [ "$cur" = '=' ]; then
# Without this, _filedir will try and complete files starting with '='
cur=""
fi
_filedir 2>/dev/null || COMPREPLY=($(compgen -f))
return 0
else
candidates=($(mpv --no-config $1=help | grep -v ':' | awk '{print $1;}'))
candidates+=("help")
fi
;;
Flag)
candidates=("yes" "no" "help")
;;
Choices:|Object)
candidates=($(mpv --no-config $1=help | grep -v ':' | awk '{print $1;}'))
candidates+=("help")
;;
Image)
candidates=($(mpv --no-config $1=help))
candidates=("${candidates[@]:2}")
candidates+=("help")
;;
Profile)
candidates=($(mpv $1=help | grep -v ':' | awk '{print $1;}'))
candidates+=("help")
;;
ShowProfile)
candidates=($(mpv $1= | grep -v ':' | awk '{print $1;}'))
;;
*)
# There are other categories; some of which we could do something smarter
# about, with enough work.
;;
esac
COMPREPLY=($(compgen -W "${candidates[*]}" -- "${partial}"))
if [ ${#COMPREPLY[@]} -gt 1 ]; then
compopt -o nospace mpv
fi
}
# This regex detects special options where we don't want an '=' appended
_mpv_special_regex='\s(Flag.*\[not in config files\]|Print)'
_mpv_skip_regex='\sremoved \[deprecated\]'
_mpv_regular_options()
{
if [ -z ${_mpv_regular_options_cache+x} ]; then
_mpv_regular_options_cache=($(_mpv_options | grep -vE "$_mpv_skip_regex" | \
grep -vE "$_mpv_special_regex" | awk '{print "\\"$1;}' | grep '\--'))
_mpv_regular_options_cache="${_mpv_regular_options_cache[*]}"
fi
echo "$_mpv_regular_options_cache"
}
_mpv_special_options()
{
if [ -z ${_mpv_special_options_cache+x} ]; then
_mpv_special_options_cache=($(_mpv_options | grep -vE "$_mpv_skip_regex" | \
grep -E "$_mpv_special_regex" | awk '{print "\\"$1;}' | grep '\--'))
_mpv_special_options_cache="${_mpv_special_options_cache[*]}"
fi
echo "$_mpv_special_options_cache"
}
_mpv()
{
compopt +o nospace mpv
# _filedir requires the current candidate be in $cur
local cur=${COMP_WORDS[COMP_CWORD]}
local prev=${COMP_WORDS[((COMP_CWORD - 1))]}
if [ "$cur" = '=' ]; then
# If the current word is '=' then we are looking for an argument for the
# option specified by the previous word.
_mpv_get_args "$prev"
elif [ "$prev" = '=' ]; then
# If the previous word is '=' then we are completing an argument for the
# option specified by the word before the '='.
local prevprev=${COMP_WORDS[((COMP_CWORD - 2))]}
_mpv_get_args "$prevprev" "$cur"
else
case $cur in
-*)
COMPREPLY=($(compgen -W "$(_mpv_regular_options)" -S '=' -- "${cur}"))
local normal_count=${#COMPREPLY[@]}
COMPREPLY+=($(compgen -W "$(_mpv_special_options)" -- "${cur}"))
if [ $normal_count -gt 0 -o ${#COMPREPLY[@]} -gt 1 ]; then
compopt -o nospace mpv
fi
;;
*)
_filedir 2>/dev/null || COMPREPLY=($(compgen -f))
;;
esac
fi
}
complete -F _mpv mpv
@@ -0,0 +1,95 @@
#
# This file is part of mpv.
#
# mpv is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# mpv is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with mpv. If not, see <http://www.gnu.org/licenses/>.
#
#
# Add the completion for mpv. The first argument is the option with the dash
# included and the rest of the arguments are directly passed to complete
function _complete_mpv
set --local opt $argv[1]
set --local opt_type --short-option
if string match -q -r '--' -- $opt
set opt_type --long-option
end
complete --command mpv $opt_type (string trim --left --chars '-' -- $opt) $argv[2..]
end
function _complete_mpv_run_help
mpv $argv \
# Remove the text before the option list
| string match --regex --invert '^\w.*:' \
| string trim
end
# Print the possible values for the option
function _complete_mpv_option -a opt
# We insert a tab so that it is recognized as the description of the argument
set --local value_description_rewrite 's/ /\t/'
switch $opt
case "--audio-device" "--vulkan-device"
# The value is enclosed in single quotes and the description in parentheses
set value_description_rewrite 's/\'([^\']+)\'\s+\((.*)\)$/\1\t\2/'
end
_complete_mpv_run_help $opt=help \
| sed -E $value_description_rewrite
end
# Print the possible values for the image option
function _complete_mpv_image_option -a opt
mpv $opt=help | sed -e 's/.*: //' -e 's/ /\n/g'
end
# Print the possible values for the profile option
function _complete_mpv_profile_option -a opt
_complete_mpv_run_help $opt=
end
# Cache all the mpv options
set --local mpv_options (mpv --no-config --list-options | string match --entire --regex '^\s*--' | string trim)
for opt_line in $mpv_options
set --local opt_line_split (string split --max 1 ' ' -- $opt_line | string trim)
set --local opt $opt_line_split[1]
set --local doc $opt_line_split[2]
set --local type (string split --field 1 ' ' $doc)
if test $opt = '--show-profile'
set type 'Profile'
end
switch $type
case String
if string match -q -r '\[file\]' $doc
_complete_mpv $opt --force-files
else
_complete_mpv $opt --exclusive --arguments "help (_complete_mpv_option $opt)"
end
case Flag
if string match -q -r '\[not in config files\]' $doc
_complete_mpv $opt
else
_complete_mpv $opt --exclusive --arguments 'yes no help'
end
case 'Choices:' Object
_complete_mpv $opt --exclusive --arguments "help (_complete_mpv_option $opt)"
case Image
_complete_mpv $opt --exclusive --arguments "help (_complete_mpv_image_option $opt)"
case Profile
_complete_mpv $opt --exclusive --arguments "help (_complete_mpv_profile_option $opt)"
case '*'
# Unimplemented categories
_complete_mpv $opt
end
end
Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 759 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

@@ -0,0 +1,198 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="64"
height="64"
viewBox="0 0 63.999999 63.999999"
id="svg2"
version="1.1"
inkscape:version="0.91 r13725"
sodipodi:docname="mpv-gradient.svg">
<defs
id="defs4">
<linearGradient
inkscape:collect="always"
id="linearGradient4430">
<stop
style="stop-color:#65376e;stop-opacity:1"
offset="0"
id="stop4432" />
<stop
style="stop-color:#4c2354;stop-opacity:1"
offset="1"
id="stop4434" />
</linearGradient>
<linearGradient
id="linearGradient4418"
inkscape:collect="always">
<stop
id="stop4420"
offset="0"
style="stop-color:#e6e2e8;stop-opacity:1" />
<stop
id="stop4422"
offset="1"
style="stop-color:#aaa3ad;stop-opacity:1" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient4402">
<stop
style="stop-color:#320f38;stop-opacity:1"
offset="0"
id="stop4404" />
<stop
style="stop-color:#5a2963;stop-opacity:1"
offset="1"
id="stop4406" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient4392">
<stop
style="stop-color:#6b3c74;stop-opacity:1"
offset="0"
id="stop4394" />
<stop
style="stop-color:#461b4d;stop-opacity:1"
offset="1"
id="stop4396" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient4382">
<stop
style="stop-color:#fafafa;stop-opacity:1"
offset="0"
id="stop4384" />
<stop
style="stop-color:#bababa;stop-opacity:1"
offset="1"
id="stop4386" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4382"
id="linearGradient5278"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(-86.873198,699.81912)"
x1="97.187729"
y1="305.67371"
x2="140.38228"
y2="335.64926" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4392"
id="linearGradient5280"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(-32.973108,701.2155)"
x1="50.828064"
y1="298.31949"
x2="78.197021"
y2="339.65219" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4402"
id="linearGradient5282"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(-31.48364,700.09839)"
x1="53.620815"
y1="305.76682"
x2="77.824654"
y2="331.73938" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4418"
id="linearGradient5284"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(-87.152474,700.0053)"
x1="110.31366"
y1="312.28323"
x2="126.88398"
y2="329.41211" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4430"
id="linearGradient5286"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(-87.152474,700.0053)"
x1="115.97468"
y1="317.41763"
x2="119.37984"
y2="322.43457" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="5.3710484"
inkscape:cx="-19.490294"
inkscape:cy="18.643164"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
units="px"
inkscape:window-width="1920"
inkscape:window-height="1016"
inkscape:window-x="0"
inkscape:window-y="27"
inkscape:window-maximized="1" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-988.3622)">
<circle
style="opacity:1;fill:url(#linearGradient5278);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.10161044;stroke-linecap:round;stroke-linejoin:bevel;stroke-miterlimit:1;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.99215686"
id="path4380-0"
cx="32"
cy="1020.3622"
r="27.949194" />
<circle
style="opacity:1;fill:url(#linearGradient5280);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.0988237;stroke-linecap:round;stroke-linejoin:bevel;stroke-miterlimit:1;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.99215686"
id="path4390-3"
cx="32.727058"
cy="1019.5079"
r="25.950588" />
<circle
style="opacity:1;fill:url(#linearGradient5282);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.1;stroke-linecap:round;stroke-linejoin:bevel;stroke-miterlimit:1;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.99215686"
id="path4400-3"
cx="34.224396"
cy="1017.7957"
r="20" />
<path
style="fill:url(#linearGradient5284);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 44.481446,1020.4807 a 12.848894,12.848894 0 0 1 -12.84889,12.8489 12.848894,12.848894 0 0 1 -12.8489,-12.8489 12.848894,12.848894 0 0 1 12.8489,-12.8489 12.848894,12.848894 0 0 1 12.84889,12.8489 z"
id="path4412-5"
inkscape:connector-curvature="0" />
<path
style="fill:url(#linearGradient5286);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 28.374316,1014.709 0,11.4502 9.21608,-5.8647 z"
id="path4426-2"
inkscape:connector-curvature="0" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 6.6 KiB

@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="64"
height="64"
viewBox="0 0 63.999999 63.999999"
id="svg2"
version="1.1"
inkscape:version="0.91 r13725"
sodipodi:docname="mpv-symbolic.svg">
<defs
id="defs4" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="5.3710484"
inkscape:cx="19.094402"
inkscape:cy="44.778512"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
units="px"
inkscape:window-width="1920"
inkscape:window-height="1016"
inkscape:window-x="0"
inkscape:window-y="27"
inkscape:window-maximized="1" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-988.3622)">
<path
style="opacity:1;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.10161044;stroke-linecap:round;stroke-linejoin:bevel;stroke-miterlimit:1;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.99215686"
d="M 32.582031 2.9101562 A 27.949194 27.949194 0 0 0 4.6328125 30.859375 A 27.949194 27.949194 0 0 0 32.582031 58.808594 A 27.949194 27.949194 0 0 0 60.53125 30.859375 A 27.949194 27.949194 0 0 0 32.582031 2.9101562 z M 33.308594 4.0546875 A 25.950588 25.950588 0 0 1 59.259766 30.005859 A 25.950588 25.950588 0 0 1 33.308594 55.955078 A 25.950588 25.950588 0 0 1 7.359375 30.005859 A 25.950588 25.950588 0 0 1 33.308594 4.0546875 z "
transform="translate(0,988.3622)"
id="path4380" />
<path
id="path4412"
transform="translate(0,988.3622)"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 32.214844,18.128906 a 12.848894,12.848894 0 0 0 -12.84961,12.84961 12.848894,12.848894 0 0 0 12.84961,12.847656 12.848894,12.848894 0 0 0 12.849609,-12.847656 12.848894,12.848894 0 0 0 -12.849609,-12.84961 z m -3.257813,7.078125 9.214844,5.583985 -9.214844,5.865234 0,-11.449219 z M 54.806488,28.2928 a 20,20 0 0 1 -20,20 20,20 0 0 1 -20,-20 20,20 0 0 1 20,-19.99997 20,20 0 0 1 20,19.99997 z" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.0 KiB

@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop-application">
<id>io.mpv.mpv</id>
<name>mpv</name>
<summary>A free, open source, and cross-platform media player</summary>
<description>
<p>mpv is a free (as in freedom) media player for the command line. It supports a wide variety of media file formats, audio and video codecs, and subtitle types.</p>
<p>mpv has an OpenGL, Vulkan, and D3D11 based video output that is capable of many features loved by videophiles, such as video scaling with popular high quality algorithms, color management, frame timing, interpolation, HDR, and more.</p>
<p>While mpv strives for minimalism and provides no real GUI, it has a small controller on top of the video for basic control.</p>
<p>mpv can leverage most hardware decoding APIs on all platforms. Hardware decoding can be enabled at runtime on demand.</p>
<p>Powerful scripting capabilities can make the player do almost anything. There is a large selection of user scripts on the wiki.</p>
<p>A straightforward C API was designed from the ground up to make mpv usable as a library and facilitate easy integration into other applications.</p>
</description>
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-2.0-or-later AND LGPL-2.0-or-later</project_license>
<developer_name>mpv.io</developer_name>
<launchable type="desktop-id">mpv.desktop</launchable>
<content_rating type="oars-1.1" />
<screenshots>
<screenshot type="default">
<image>https://mpv.io/images/mpv-screenshot-34cd36ae.jpg</image>
<caption>Main window</caption>
</screenshot>
</screenshots>
<url type="homepage">https://mpv.io/</url>
<url type="bugtracker">https://github.com/mpv-player/mpv/issues</url>
<url type="faq">https://github.com/mpv-player/mpv/wiki/FAQ</url>
<url type="help">https://mpv.io/manual/stable</url>
</component>
@@ -0,0 +1,269 @@
#compdef mpv
# ZSH completion for mpv
#
# For customization, see:
# https://github.com/mpv-player/mpv/wiki/Zsh-completion-customization
#
# This file is part of mpv.
#
# mpv is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# mpv is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with mpv. If not, see <http://www.gnu.org/licenses/>.
#
local curcontext="$curcontext" state state_descr line
typeset -A opt_args
local -a match mbegin mend
local MATCH MBEGIN MEND
# By default, don't complete URLs unless no files match
local -a tag_order
zstyle -a ":completion:*:*:$service:*" tag-order tag_order ||
zstyle ":completion:*:*:$service:*" tag-order '!urls'
local -a urls
zstyle -a ":completion:*:*:$service:*:urls" urls urls ||
zstyle ":completion:*:*:$service:*:urls" urls av://lavfi:testsrc av://lavfi:sine
typeset -ga _mpv_completion_arguments _mpv_completion_protocols
function _mpv_generate_arguments {
_mpv_completion_arguments=()
local -a option_aliases=()
local list_options_line
for list_options_line in "${(@f)$($~words[1] --no-config --list-options)}"; do
[[ $list_options_line =~ $'^[ \t]+--([^ \t]+)[ \t]*(.*)' ]] || continue
local name=$match[1] desc=$match[2]
if [[ $desc == Flag* ]]; then
_mpv_completion_arguments+="$name"
if [[ $name != (\{|\}|v|list-options) ]]; then
# Negated version
_mpv_completion_arguments+="no-$name"
fi
elif [[ -z $desc ]]; then
# Sub-option for list option
if [[ $name == *-(clr|help) ]]; then
# Like a flag
_mpv_completion_arguments+="$name"
else
# Find the parent option and use that with this option's name
_mpv_completion_arguments+="${(S)_mpv_completion_arguments[(R)${name%-*}=*]/*=/$name=}"
fi
elif [[ $desc == Print* ]]; then
_mpv_completion_arguments+="$name"
elif [[ $desc =~ $'^alias for (--)?([^ \t]+)' ]]; then
# Save this for later; we might not have parsed the target option yet
option_aliases+="$name $match[2]"
elif [[ $desc =~ $'^removed ' ]]; then
# skip
else
# Option takes argument
local entry="$name=-:${desc//:/\\:}:"
if [[ $desc =~ '^Choices: ([^(]*)' ]]; then
local -a choices=(${(s: :)match[1]})
entry+="($choices)"
# If "no" is one of the choices, it can also be negated like a flag
# (--no-whatever is equivalent to --whatever=no).
if (( ${+choices[(r)no]} )); then
_mpv_completion_arguments+="no-$name"
fi
elif [[ $desc == *'[file]'* ]]; then
entry+='->files'
elif [[ $desc = 'Object settings list'* || $name == (profile|audio-device|vulkan-device) ]]; then
entry+="->parse-help-$name"
elif [[ $name == show-profile ]]; then
entry+="->parse-help-profile"
elif [[ $name == h(|elp) ]]; then
entry+="->help-options"
fi
_mpv_completion_arguments+="$entry"
fi
done
# Process aliases
local to_from real_name arg_spec
for to_from in $option_aliases; do
# to_from='alias-name real-name'
real_name=${to_from##* }
for arg_spec in "$real_name" "$real_name=*" "no-$real_name"; do
arg_spec=${_mpv_completion_arguments[(r)$arg_spec]}
[[ -n $arg_spec ]] &&
_mpv_completion_arguments+="${arg_spec/$real_name/${to_from%% *}}"
done
done
# Older versions of zsh have a bug where they won't complete an option listed
# after one that's a prefix of it. To work around this, we can sort the
# options by length, longest first, so that any prefix of an option will be
# listed after it. On newer versions of zsh where the bug is fixed, we skip
# this to avoid slowing down the first tab press any more than we have to.
autoload -Uz is-at-least
if ! is-at-least 5.2; then
# If this were a real language, we wouldn't have to sort by prepending the
# length, sorting the whole thing numerically, and then removing it again.
local -a sort_tmp=()
for arg_spec in $_mpv_completion_arguments; do
sort_tmp+=${#arg_spec%%=*}_$arg_spec
done
_mpv_completion_arguments=(${${(On)sort_tmp}/#*_})
fi
}
function _mpv_generate_protocols {
_mpv_completion_protocols=()
local list_protos_line
for list_protos_line in "${(@f)$($~words[1] --no-config --list-protocols)}"; do
if [[ $list_protos_line =~ $'^[ \t]+(.*)' ]]; then
_mpv_completion_protocols+="$match[1]"
fi
done
}
function _mpv_generate_if_changed {
# Called with $1 = 'arguments' or 'protocols'. Generates the respective list
# on the first run and re-generates it if the executable being completed for
# is different than the one we used to generate the cached list.
typeset -gA _mpv_completion_binary
local current_binary=${~words[1]:c}
zmodload -F zsh/stat b:zstat
current_binary+=T$(zstat +mtime $current_binary)
if [[ $_mpv_completion_binary[$1] != $current_binary ]]; then
# Use PCRE for regular expression matching if possible. This approximately
# halves the execution time of generate_arguments compared to the default
# POSIX regex, which translates to a more responsive first tab press.
# However, we can't rely on PCRE being available, so we keep all our
# patterns POSIX-compatible.
zmodload -s -F zsh/pcre C:pcre-match && setopt re_match_pcre
_mpv_generate_$1
_mpv_completion_binary[$1]=$current_binary
fi
}
# Only consider generating arguments if the argument being completed looks like
# an option. This way, the user should never see a delay when just completing a
# filename.
if [[ $words[$CURRENT] == -* ]]; then
_mpv_generate_if_changed arguments
fi
local rc=1
_arguments -C -S \*--$_mpv_completion_arguments '*:files:->mfiles' && rc=0
case $state in
parse-help-*)
local option_name=${state#parse-help-}
local no_config="--no-config"
# Can't do non-capturing groups without pcre, so we index the ones we want
local pattern name_group=1 desc_group=2
case $option_name in
audio-device|vulkan-device)
pattern=$'^[ \t]+'\''([^'\'']*)'\'$'[ \t]+''\((.*)\)'
;;
profile)
# The generic pattern would actually work in most cases for --profile,
# but would break if a profile name contained spaces. This stricter one
# only breaks if a profile name contains tabs.
pattern=$'^\t([^\t]*)\t(.*)'
# We actually want config so we can autocomplete the user's profiles
no_config=""
;;
*)
pattern=$'^[ \t]+(--'${option_name}$'=)?([^ \t]+)[ \t]*[-:]?[ \t]*(.*)'
name_group=2 desc_group=3
;;
esac
local -a values
local current
for current in "${(@f)$($~words[1] ${no_config} --${option_name}=help)}"; do
[[ $current =~ $pattern ]] || continue;
local name=${match[name_group]//:/\\:} desc=${match[desc_group]}
if [[ -n $desc ]]; then
values+="${name}:${desc}"
else
values+="${name}"
fi
done
(( $#values )) && {
compset -P '*,'
compset -S ',*'
_describe "$state_descr" values -r ',=: \t\n\-' && rc=0
}
;;
files)
compset -P '*,'
compset -S ',*'
_files -r ',/ \t\n\-' && rc=0
;;
mfiles)
local expl
_tags files urls
while _tags; do
_requested files expl 'media file' _files && rc=0
if _requested urls; then
while _next_label urls expl URL; do
_urls "$expl[@]" && rc=0
_mpv_generate_if_changed protocols
compadd -S '' "$expl[@]" $_mpv_completion_protocols && rc=0
done
fi
(( rc )) || return 0
done
;;
help-options)
compadd ${${${_mpv_completion_arguments%%=*}:#no-*}:#*-(add|append|clr|pre|set|remove|toggle)}
;;
esac
return rc
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
+1
View File
@@ -0,0 +1 @@
webarchy
@@ -0,0 +1,10 @@
[Desktop Entry]
Type=Application
Name=Webarchy Browser
Comment=Ultrawide WebKit2GTK Browser with Vertical Tabs
Exec=/usr/bin/webarchy %u
Icon=web-browser
Terminal=false
NoDisplay=true
Categories=Network;WebBrowser;
MimeType=text/html;text/xml;application/xhtml+xml;x-scheme-handler/http;x-scheme-handler/https;
+9
View File
@@ -67,6 +67,15 @@ if [ "$REBUILD_ALL" -eq 1 ] || [ ! -x "$BASE_DIR/prebuilt/gsocket/usr/local/bin/
"$BASE_DIR/scripts/build-gsocket.sh" "$BASE_DIR/scripts/build-gsocket.sh"
fi fi
if [ "$REBUILD_ALL" -eq 1 ] || [ ! -x "$BASE_DIR/prebuilt/mpv/usr/bin/mpv" ]; then
"$BASE_DIR/scripts/build-mpv.sh"
fi
if [ "$REBUILD_ALL" -eq 1 ] || [ ! -x "$BASE_DIR/prebuilt/webarchy/usr/bin/webarchy" ] || \
[ ! -f "$BASE_DIR/prebuilt/gdk-pixbuf/usr/lib/libgdk_pixbuf-2.0.so.0" ]; then
"$BASE_DIR/scripts/build-webarchy.sh"
fi
if [ "$SKIP_APKS" -eq 0 ]; then if [ "$SKIP_APKS" -eq 0 ]; then
"$BASE_DIR/scripts/package-local-apks.sh" "$BASE_DIR/scripts/package-local-apks.sh"
fi fi
+11 -7
View File
@@ -58,15 +58,16 @@ if command -v apk >/dev/null 2>&1 && \
# Clear any older @geminux world pins and installed hashes so rebuilt local # Clear any older @geminux world pins and installed hashes so rebuilt local
# packages with unchanged -r0 version strings always extract updated payloads. # packages with unchanged -r0 version strings always extract updated payloads.
if [ -f "$TARGET_ROOTFS/etc/apk/world" ]; then if [ -f "$TARGET_ROOTFS/etc/apk/world" ]; then
grep -v -E '^geminux-(kernel-modules|xlibre|suckless|dunst|ui|bantam|gsocket|config)(@|=|$)' \ grep -v -E '^geminux-(kernel-modules|xlibre|suckless|dunst|ui|bantam|gsocket|mpv|gdk-pixbuf|webarchy|config)(@|=|$)' \
"$TARGET_ROOTFS/etc/apk/world" > "$TARGET_ROOTFS/etc/apk/world.tmp" || true "$TARGET_ROOTFS/etc/apk/world" > "$TARGET_ROOTFS/etc/apk/world.tmp" || true
mv "$TARGET_ROOTFS/etc/apk/world.tmp" "$TARGET_ROOTFS/etc/apk/world" mv "$TARGET_ROOTFS/etc/apk/world.tmp" "$TARGET_ROOTFS/etc/apk/world"
fi fi
apk --root "$TARGET_ROOTFS" --arch aarch64 del --no-scripts --purge=yes \ apk --root "$TARGET_ROOTFS" --arch aarch64 del --no-scripts --purge=yes \
geminux-config geminux-gsocket geminux-bantam geminux-ui geminux-dunst geminux-suckless \ geminux-config geminux-webarchy geminux-mpv geminux-gsocket geminux-bantam geminux-ui geminux-dunst geminux-suckless \
geminux-xlibre geminux-kernel-modules 2>/dev/null || true geminux-xlibre geminux-kernel-modules 2>/dev/null || true
apk --root "$TARGET_ROOTFS" --arch aarch64 add --no-scripts --clean-protected=no \ apk --root "$TARGET_ROOTFS" --arch aarch64 add --no-scripts --clean-protected=no \
"geminux-gdk-pixbuf@geminux=2.42.12-r0" \
"geminux-kernel-modules@geminux=7.3.5-r0" \ "geminux-kernel-modules@geminux=7.3.5-r0" \
"geminux-xlibre@geminux=25.2.0-r0" \ "geminux-xlibre@geminux=25.2.0-r0" \
"geminux-suckless@geminux=${VER}-r0" \ "geminux-suckless@geminux=${VER}-r0" \
@@ -74,13 +75,16 @@ if command -v apk >/dev/null 2>&1 && \
"geminux-ui@geminux=${VER}-r0" \ "geminux-ui@geminux=${VER}-r0" \
"geminux-bantam@geminux=${VER}-r0" \ "geminux-bantam@geminux=${VER}-r0" \
"geminux-gsocket@geminux=1.4.43-r0" \ "geminux-gsocket@geminux=1.4.43-r0" \
"geminux-mpv@geminux=0.40.0-r0" \
"geminux-webarchy@geminux=${VER}-r0" \
"geminux-config@geminux=${VER}-r0" "geminux-config@geminux=${VER}-r0"
apk --root "$TARGET_ROOTFS" --arch aarch64 fix --no-scripts --reinstall geminux-gdk-pixbuf >/dev/null
else else
# Fallback direct copy when running on host without apk-tools # Fallback direct copy when running on host without apk-tools
if [ -d "$BASE_DIR/overlay/rootfs" ]; then if [ -d "$BASE_DIR/overlay/rootfs" ]; then
cp -af "$BASE_DIR/overlay/rootfs/." "$TARGET_ROOTFS/" cp -af "$BASE_DIR/overlay/rootfs/." "$TARGET_ROOTFS/"
fi fi
for subdir in xlibre suckless dunst geminux bantam gsocket; do for subdir in xlibre suckless dunst geminux bantam gsocket mpv gdk-pixbuf webarchy; do
if [ -d "$BASE_DIR/prebuilt/$subdir" ]; then if [ -d "$BASE_DIR/prebuilt/$subdir" ]; then
cp -af "$BASE_DIR/prebuilt/$subdir/." "$TARGET_ROOTFS/" cp -af "$BASE_DIR/prebuilt/$subdir/." "$TARGET_ROOTFS/"
fi fi
@@ -131,10 +135,7 @@ if [ -f "$BASE_DIR/keys/geminux_id_ed25519.pub" ]; then
chmod 0600 "$TARGET_ROOTFS/root/.ssh/authorized_keys" "$TARGET_ROOTFS/home/user/.ssh/authorized_keys" chmod 0600 "$TARGET_ROOTFS/root/.ssh/authorized_keys" "$TARGET_ROOTFS/home/user/.ssh/authorized_keys"
fi fi
if command -v glib-compile-schemas >/dev/null 2>&1 && \ "$BASE_DIR/scripts/compile-gsettings-schemas.sh" "$TARGET_ROOTFS"
[ -d "$TARGET_ROOTFS/usr/share/glib-2.0/schemas" ]; then
glib-compile-schemas "$TARGET_ROOTFS/usr/share/glib-2.0/schemas" 2>/dev/null || true
fi
rm -f "$TARGET_ROOTFS/etc/runlevels/sysinit/hwdrivers" rm -f "$TARGET_ROOTFS/etc/runlevels/sysinit/hwdrivers"
rm -f "$TARGET_ROOTFS/etc/runlevels/default/wpa_supplicant" rm -f "$TARGET_ROOTFS/etc/runlevels/default/wpa_supplicant"
@@ -188,6 +189,9 @@ fi
if [ -x "$TARGET_ROOTFS/bin/bash" ] && [ ! -e "$TARGET_ROOTFS/usr/bin/bash" ]; then if [ -x "$TARGET_ROOTFS/bin/bash" ] && [ ! -e "$TARGET_ROOTFS/usr/bin/bash" ]; then
ln -sf /bin/bash "$TARGET_ROOTFS/usr/bin/bash" ln -sf /bin/bash "$TARGET_ROOTFS/usr/bin/bash"
fi fi
if [ -x "$TARGET_ROOTFS/usr/bin/pinentry-curses" ] && [ ! -e "$TARGET_ROOTFS/usr/bin/pinentry" ]; then
ln -sf pinentry-curses "$TARGET_ROOTFS/usr/bin/pinentry"
fi
if [ -f "$TARGET_ROOTFS/etc/passwd" ]; then if [ -f "$TARGET_ROOTFS/etc/passwd" ]; then
sed -i -E \ sed -i -E \
+24 -5
View File
@@ -18,18 +18,31 @@ echo "Bootstrapping Geminux aarch64 rootfs for $DEVICE"
echo "============================================================" echo "============================================================"
echo "[1/8] Configuring pure Alpine Edge apk repositories and trusted keys..." echo "[1/8] Configuring pure Alpine Edge apk repositories and trusted keys..."
cat > /etc/apk/repositories <<EOF mkdir -p "$ROOTFS/etc/apk/keys" "$ROOTFS/lib/apk/db" "$ROOTFS/var/cache/apk" "$ROOTFS/var/lib/geminux/apk-repo"
if [ -d "$REPO/prebuilt/apk-repo" ] && \
[ -f "$REPO/prebuilt/apk-repo/aarch64/APKINDEX.tar.gz" ]; then
cp -af "$REPO/prebuilt/apk-repo/." "$ROOTFS/var/lib/geminux/apk-repo/"
mkdir -p /var/lib/geminux
ln -sfn "$ROOTFS/var/lib/geminux/apk-repo" /var/lib/geminux/apk-repo
cat > /etc/apk/repositories <<EOF
@geminux /var/lib/geminux/apk-repo
https://dl-cdn.alpinelinux.org/alpine/edge/main https://dl-cdn.alpinelinux.org/alpine/edge/main
https://dl-cdn.alpinelinux.org/alpine/edge/community https://dl-cdn.alpinelinux.org/alpine/edge/community
https://dl-cdn.alpinelinux.org/alpine/edge/testing https://dl-cdn.alpinelinux.org/alpine/edge/testing
EOF EOF
else
cat > /etc/apk/repositories <<EOF
https://dl-cdn.alpinelinux.org/alpine/edge/main
https://dl-cdn.alpinelinux.org/alpine/edge/community
https://dl-cdn.alpinelinux.org/alpine/edge/testing
EOF
fi
mkdir -p /etc/apk/keys mkdir -p /etc/apk/keys
cp "$REPO"/keys/alpine-devel@*.rsa.pub /etc/apk/keys/ cp "$REPO"/keys/alpine-devel@*.rsa.pub /etc/apk/keys/
if [ -f "$REPO/keys/geminux-local.rsa.pub" ]; then if [ -f "$REPO/keys/geminux-local.rsa.pub" ]; then
cp "$REPO/keys/geminux-local.rsa.pub" /etc/apk/keys/ cp "$REPO/keys/geminux-local.rsa.pub" /etc/apk/keys/
fi fi
mkdir -p "$ROOTFS/etc/apk/keys" "$ROOTFS/lib/apk/db" "$ROOTFS/var/cache/apk"
cp /etc/apk/repositories "$ROOTFS/etc/apk/repositories" cp /etc/apk/repositories "$ROOTFS/etc/apk/repositories"
rm -f "$ROOTFS/etc/apk/keys/"*.rsa.pub rm -f "$ROOTFS/etc/apk/keys/"*.rsa.pub
cp "$REPO"/keys/alpine-devel@*.rsa.pub "$ROOTFS/etc/apk/keys/" cp "$REPO"/keys/alpine-devel@*.rsa.pub "$ROOTFS/etc/apk/keys/"
@@ -43,17 +56,23 @@ apk add --no-cache python3 kmod openssl glib >/dev/null
echo "[3/8] Installing the Geminux aarch64 package set..." echo "[3/8] Installing the Geminux aarch64 package set..."
PKGS="$(grep -v '^[[:space:]]*#' "$PKGS_FILE" | grep -v '^[[:space:]]*$' | tr '\n' ' ')" PKGS="$(grep -v '^[[:space:]]*#' "$PKGS_FILE" | grep -v '^[[:space:]]*$' | tr '\n' ' ')"
if [ -f "$ROOTFS/etc/apk/world" ]; then if [ -f "$ROOTFS/etc/apk/world" ]; then
grep -v -E '^geminux-(kernel-modules|xlibre|suckless|dunst|ui|bantam|gsocket|config)(@|=|$)' \ grep -v -E '^geminux-(kernel-modules|xlibre|suckless|dunst|ui|bantam|gsocket|mpv|gdk-pixbuf|webarchy|config)(@|=|$)' \
"$ROOTFS/etc/apk/world" > "$ROOTFS/etc/apk/world.tmp" || true "$ROOTFS/etc/apk/world" > "$ROOTFS/etc/apk/world.tmp" || true
mv "$ROOTFS/etc/apk/world.tmp" "$ROOTFS/etc/apk/world" mv "$ROOTFS/etc/apk/world.tmp" "$ROOTFS/etc/apk/world"
fi fi
"$REPO/scripts/prune-rootfs-packages.sh" "$ROOTFS" world "$REPO/scripts/prune-rootfs-packages.sh" "$ROOTFS" world
EXTRA_GEMINUX=""
if [ -f "$ROOTFS/var/lib/geminux/apk-repo/aarch64/APKINDEX.tar.gz" ]; then
EXTRA_GEMINUX="geminux-gdk-pixbuf@geminux=2.42.12-r0"
fi
if [ ! -f "$ROOTFS/lib/apk/db/installed" ]; then if [ ! -f "$ROOTFS/lib/apk/db/installed" ]; then
# shellcheck disable=SC2086 # shellcheck disable=SC2086
apk --root "$ROOTFS" --arch aarch64 add --initdb --no-scripts $PKGS >/dev/null apk --root "$ROOTFS" --arch aarch64 add --initdb --no-scripts $EXTRA_GEMINUX $PKGS >/dev/null
else else
# An existing rootfs only needs newly added packages; also refresh @geminux index.
apk --root "$ROOTFS" --arch aarch64 update --force-refresh >/dev/null
# shellcheck disable=SC2086 # shellcheck disable=SC2086
apk --root "$ROOTFS" --arch aarch64 add --no-scripts $PKGS >/dev/null apk --root "$ROOTFS" --arch aarch64 add --no-scripts $EXTRA_GEMINUX $PKGS >/dev/null
fi fi
"$REPO/scripts/prune-rootfs-packages.sh" "$ROOTFS" purge "$REPO/scripts/prune-rootfs-packages.sh" "$ROOTFS" purge
+314
View File
@@ -0,0 +1,314 @@
#!/bin/sh
# Cross-compile zero-Rust, X11 EGL (Panfrost) + PipeWire/Pulse/ALSA mpv
# with private libplacebo (no libdovi), FFmpeg, and gst-libav for aarch64.
set -eu
BASE_DIR="$(cd "$(dirname "$0")/.." && pwd)"
mkdir -p "$BASE_DIR/build-cache" "$BASE_DIR/prebuilt/mpv"
exec docker run --rm --network=host \
-e HOST_UID="$(id -u)" \
-e HOST_GID="$(id -g)" \
-e FORCE_REBUILD="${FORCE_REBUILD:-0}" \
-v "$BASE_DIR:/geminux" \
alpine:3.24 sh -eu -c '
cat > /etc/apk/repositories <<EOF
https://mirror.nura.eco/postmarketos/v26.06
https://dl-cdn.alpinelinux.org/alpine/edge/main
https://dl-cdn.alpinelinux.org/alpine/edge/community
https://dl-cdn.alpinelinux.org/alpine/edge/testing
EOF
cp /geminux/keys/*.rsa.pub /etc/apk/keys/
cleanup_perms() {
chown -R "$HOST_UID:$HOST_GID" /geminux/prebuilt/mpv /geminux/build-cache 2>/dev/null || true
}
trap cleanup_perms EXIT
echo "[1/6] Installing host aarch64 cross-compile toolchain and meson/ninja..."
apk add --no-cache \
build-base \
curl \
xz \
git \
ca-certificates \
gcc-aarch64 \
g++-aarch64 \
binutils-aarch64 \
meson \
ninja \
pkgconf \
python3 \
py3-jinja2 \
py3-markupsafe \
perl >/dev/null
PLACEBO_SRC="/geminux/build-cache/libplacebo-src"
if [ ! -f "$PLACEBO_SRC/meson.build" ]; then
echo "[1b/6] Cloning libplacebo v7.360.1..."
rm -rf "$PLACEBO_SRC"
git clone --recurse-submodules --shallow-submodules --depth 1 --branch v7.360.1 \
https://code.videolan.org/videolan/libplacebo.git "$PLACEBO_SRC"
fi
FFMPEG_SRC="/geminux/build-cache/ffmpeg-src"
if [ ! -f "$FFMPEG_SRC/configure" ]; then
echo "[1c/6] Cloning FFmpeg n7.1.5..."
rm -rf "$FFMPEG_SRC"
git clone --depth 1 --branch n7.1.5 \
https://github.com/FFmpeg/FFmpeg.git "$FFMPEG_SRC"
fi
MPV_SRC="/geminux/build-cache/mpv-src"
if [ ! -f "$MPV_SRC/meson.build" ]; then
echo "[1d/6] Cloning mpv v0.40.0..."
rm -rf "$MPV_SRC"
git clone --depth 1 --branch v0.40.0 \
https://github.com/mpv-player/mpv.git "$MPV_SRC"
fi
GST_LIBAV_SRC="/geminux/build-cache/gst-libav-src"
if [ ! -f "$GST_LIBAV_SRC/meson.build" ]; then
echo "[1e/6] Downloading gst-libav 1.28.9..."
rm -rf "$GST_LIBAV_SRC"
mkdir -p "$GST_LIBAV_SRC"
curl -fsSL https://gstreamer.freedesktop.org/src/gst-libav/gst-libav-1.28.9.tar.xz | \
tar -xJ --strip-components=1 -C "$GST_LIBAV_SRC"
fi
echo "[2/6] Preparing pure Alpine Edge aarch64 sysroot for zero-Rust mpv..."
SYSROOT="/tmp/aarch64-sysroot"
mkdir -p "$SYSROOT/etc/apk/keys"
cat > "$SYSROOT/etc/apk/repositories" <<EOF
https://dl-cdn.alpinelinux.org/alpine/edge/main
https://dl-cdn.alpinelinux.org/alpine/edge/community
https://dl-cdn.alpinelinux.org/alpine/edge/testing
EOF
cp /geminux/keys/alpine-devel@*.rsa.pub "$SYSROOT/etc/apk/keys/"
apk --root "$SYSROOT" --initdb --arch aarch64 add --no-scripts \
alpine-baselayout \
musl-dev \
libstdc++-dev \
linux-headers \
zlib-dev \
bzip2-dev \
xz-dev \
openssl-dev \
dav1d-dev \
libvpx-dev \
opus-dev \
libvorbis-dev \
lame-dev \
mpg123-dev \
libass-dev \
glib-dev \
gstreamer-dev \
gst-plugins-base-dev \
freetype-dev \
harfbuzz-dev \
fribidi-dev \
fontconfig-dev \
lcms2-dev \
libjpeg-turbo-dev \
libpng-dev \
luajit-dev \
uchardet-dev \
zimg-dev \
alsa-lib-dev \
pipewire-dev \
pulseaudio-dev \
libx11-dev \
libxext-dev \
libxrandr-dev \
libxinerama-dev \
libxscrnsaver-dev \
libxv-dev \
libxpresent-dev \
libxfixes-dev \
libdrm-dev \
libdisplay-info-dev \
mesa-dev >/dev/null
cat > /tmp/aarch64-cross.ini <<EOF
[binaries]
c = '\''aarch64-alpine-linux-musl-gcc'\''
cpp = '\''aarch64-alpine-linux-musl-g++'\''
ar = '\''aarch64-alpine-linux-musl-ar'\''
strip = '\''aarch64-alpine-linux-musl-strip'\''
pkg-config = '\''pkgconf'\''
[built-in options]
c_args = ['\''--sysroot=/tmp/aarch64-sysroot'\'', '\''-O2'\'', '\''-march=armv8-a+crc+crypto'\'', '\''-mtune=cortex-a53'\'', '\''-fno-plt'\'']
cpp_args = ['\''--sysroot=/tmp/aarch64-sysroot'\'', '\''-O2'\'', '\''-march=armv8-a+crc+crypto'\'', '\''-mtune=cortex-a53'\'', '\''-fno-plt'\'']
c_link_args = ['\''--sysroot=/tmp/aarch64-sysroot'\'', '\''-Wl,-O1,--as-needed'\'', '\''-Wl,-rpath,/usr/lib/geminux-mpv'\'', '\''-Wl,-rpath-link,/tmp/aarch64-sysroot/usr/lib/geminux-mpv'\'']
cpp_link_args = ['\''--sysroot=/tmp/aarch64-sysroot'\'', '\''-Wl,-O1,--as-needed'\'', '\''-Wl,-rpath,/usr/lib/geminux-mpv'\'', '\''-Wl,-rpath-link,/tmp/aarch64-sysroot/usr/lib/geminux-mpv'\'']
[properties]
sys_root = '\''/tmp/aarch64-sysroot'\''
pkg_config_libdir = '\''/tmp/aarch64-sysroot/usr/lib/geminux-mpv/pkgconfig:/tmp/aarch64-sysroot/usr/lib/pkgconfig:/tmp/aarch64-sysroot/usr/share/pkgconfig'\''
[host_machine]
system = '\''linux'\''
cpu_family = '\''aarch64'\''
cpu = '\''aarch64'\''
endian = '\''little'\''
EOF
echo "[3/6] Cross-compiling libplacebo v7.360.1 (dovi disabled)..."
rm -rf /tmp/build-placebo
meson setup /tmp/build-placebo "$PLACEBO_SRC" \
--cross-file=/tmp/aarch64-cross.ini \
--prefix=/usr \
--libdir=lib/geminux-mpv \
--default-library=shared \
--buildtype=release \
-Ddovi=disabled \
-Dvulkan=disabled \
-Dglslang=disabled \
-Dshaderc=disabled \
-Dopengl=enabled \
-Dlcms=enabled \
-Dxxhash=disabled \
-Dunwind=disabled \
-Ddemos=false \
-Dtests=false
ninja -C /tmp/build-placebo
DESTDIR="$SYSROOT" ninja -C /tmp/build-placebo install
echo "[4/6] Cross-compiling FFmpeg n7.1.5 (zero external Rust codecs)..."
rm -rf /tmp/build-ffmpeg
mkdir -p /tmp/build-ffmpeg
(
cd /tmp/build-ffmpeg
export PKG_CONFIG_SYSROOT_DIR="$SYSROOT"
export PKG_CONFIG_LIBDIR="$SYSROOT/usr/lib/geminux-mpv/pkgconfig:$SYSROOT/usr/lib/pkgconfig:$SYSROOT/usr/share/pkgconfig"
export PKG_CONFIG_PATH=""
"$FFMPEG_SRC/configure" \
--prefix=/usr \
--libdir=/usr/lib/geminux-mpv \
--shlibdir=/usr/lib/geminux-mpv \
--arch=aarch64 \
--target-os=linux \
--enable-cross-compile \
--cross-prefix=aarch64-alpine-linux-musl- \
--sysroot="$SYSROOT" \
--pkg-config=pkgconf \
--extra-cflags="-O2 -march=armv8-a+crc+crypto -mtune=cortex-a53 -fno-plt" \
--extra-ldflags="-Wl,-O1,--as-needed -Wl,-rpath,/usr/lib/geminux-mpv -Wl,-rpath-link,$SYSROOT/usr/lib/geminux-mpv" \
--enable-shared \
--disable-static \
--enable-gpl \
--enable-version3 \
--enable-ffmpeg \
--enable-ffprobe \
--disable-ffplay \
--disable-doc \
--disable-debug \
--disable-postproc \
--enable-openssl \
--enable-libdav1d \
--enable-libvpx \
--enable-libopus \
--enable-libvorbis \
--enable-libmp3lame \
--enable-libass \
--enable-libfreetype \
--enable-libharfbuzz \
--enable-libfribidi \
--enable-libfontconfig \
--enable-zlib \
--enable-bzlib \
--enable-lzma \
--disable-encoders \
--enable-encoder=png,mjpeg,wrapped_avframe,rawvideo,pcm_s16le,pcm_f32le,aac,flac,alac,libmp3lame,libopus,libvorbis
make -j"$(nproc)"
make DESTDIR="$SYSROOT" install
)
echo "[5/6] Cross-compiling mpv v0.40.0 (X11 EGL + PipeWire/Pulse/ALSA)..."
rm -rf /tmp/build-mpv
meson setup /tmp/build-mpv "$MPV_SRC" \
--cross-file=/tmp/aarch64-cross.ini \
--prefix=/usr \
--libdir=lib \
--sysconfdir=/etc \
--buildtype=release \
-Dcplayer=true \
-Dlibmpv=false \
-Dtests=false \
-Dmanpage-build=disabled \
-Dwayland=disabled \
-Degl-wayland=disabled \
-Dvaapi-wayland=disabled \
-Dvulkan=disabled \
-Dvaapi=disabled \
-Dx11=enabled \
-Degl=enabled \
-Degl-x11=enabled \
-Degl-drm=enabled \
-Ddrm=enabled \
-Dgl=enabled \
-Dxv=enabled \
-Dpipewire=enabled \
-Dpulse=enabled \
-Dalsa=enabled \
-Dlua=luajit \
-Dlcms2=enabled \
-Djpeg=enabled \
-Duchardet=enabled \
-Dzimg=enabled \
-Dlibarchive=disabled \
-Drubberband=disabled
ninja -C /tmp/build-mpv
echo "[5b/6] Cross-compiling gst-libav 1.28.9 against private geminux FFmpeg..."
rm -rf /tmp/build-gst-libav /tmp/gst-libav-dest
meson setup /tmp/build-gst-libav "$GST_LIBAV_SRC" \
--cross-file=/tmp/aarch64-cross.ini \
--prefix=/usr \
--libdir=lib \
--buildtype=release \
-Ddoc=disabled \
-Dtests=disabled
ninja -C /tmp/build-gst-libav
echo "[6/6] Staging and stripping prebuilt/mpv aarch64 artifacts..."
rm -rf /geminux/prebuilt/mpv
mkdir -p /geminux/prebuilt/mpv/usr/lib/geminux-mpv \
/geminux/prebuilt/mpv/usr/lib/gstreamer-1.0 \
/geminux/prebuilt/mpv/etc/mpv
DESTDIR=/geminux/prebuilt/mpv ninja -C /tmp/build-mpv install
DESTDIR=/tmp/gst-libav-dest ninja -C /tmp/build-gst-libav install
cp -af /tmp/gst-libav-dest/usr/lib/gstreamer-1.0/libgstlibav.so \
/geminux/prebuilt/mpv/usr/lib/gstreamer-1.0/libgstlibav.so
cp -f "$SYSROOT/usr/bin/ffmpeg" "$SYSROOT/usr/bin/ffprobe" /geminux/prebuilt/mpv/usr/bin/
chmod 0755 /geminux/prebuilt/mpv/usr/bin/mpv \
/geminux/prebuilt/mpv/usr/bin/ffmpeg \
/geminux/prebuilt/mpv/usr/bin/ffprobe \
/geminux/prebuilt/mpv/usr/lib/gstreamer-1.0/libgstlibav.so
cp -a "$SYSROOT/usr/lib/geminux-mpv/"*.so.* /geminux/prebuilt/mpv/usr/lib/geminux-mpv/
rm -rf /geminux/prebuilt/mpv/usr/include \
/geminux/prebuilt/mpv/usr/lib/pkgconfig \
/geminux/prebuilt/mpv/usr/share/doc \
/geminux/prebuilt/mpv/usr/share/man
cat > /geminux/prebuilt/mpv/etc/mpv/mpv.conf <<EOF
# Geminux defaults (MT6797X + Mali-T880 Panfrost X11 EGL + PipeWire)
vo=gpu
gpu-api=opengl
gpu-context=x11egl
ao=pipewire,pulse,alsa
vd-lavc-threads=4
osc=yes
EOF
aarch64-alpine-linux-musl-strip --strip-unneeded \
/geminux/prebuilt/mpv/usr/bin/mpv \
/geminux/prebuilt/mpv/usr/bin/ffmpeg \
/geminux/prebuilt/mpv/usr/bin/ffprobe \
/geminux/prebuilt/mpv/usr/lib/gstreamer-1.0/libgstlibav.so
find /geminux/prebuilt/mpv/usr/lib/geminux-mpv -maxdepth 1 -type f ! -type l -name "*.so*" \
-exec aarch64-alpine-linux-musl-strip --strip-unneeded {} +
ls -lh /geminux/prebuilt/mpv/usr/bin/ /geminux/prebuilt/mpv/usr/lib/geminux-mpv/ /geminux/prebuilt/mpv/usr/lib/gstreamer-1.0/
'
+205
View File
@@ -0,0 +1,205 @@
#!/bin/sh
# Cross-compile pure-C gdk-pixbuf 2.42.12 (zero glycin, zero librsvg) and
# Webarchy GTK3/WebKit2GTK browser for aarch64.
set -eu
BASE_DIR="$(cd "$(dirname "$0")/.." && pwd)"
mkdir -p "$BASE_DIR/build-cache" "$BASE_DIR/prebuilt/gdk-pixbuf" "$BASE_DIR/prebuilt/webarchy"
exec docker run --rm --network=host \
-e HOST_UID="$(id -u)" \
-e HOST_GID="$(id -g)" \
-e FORCE_REBUILD="${FORCE_REBUILD:-0}" \
-v "$BASE_DIR:/geminux" \
alpine:3.24 sh -eu -c '
cat > /etc/apk/repositories <<EOF
https://mirror.nura.eco/postmarketos/v26.06
https://dl-cdn.alpinelinux.org/alpine/edge/main
https://dl-cdn.alpinelinux.org/alpine/edge/community
https://dl-cdn.alpinelinux.org/alpine/edge/testing
EOF
cp /geminux/keys/*.rsa.pub /etc/apk/keys/
cleanup_perms() {
chown -R "$HOST_UID:$HOST_GID" \
/geminux/prebuilt/gdk-pixbuf \
/geminux/prebuilt/webarchy \
/geminux/build-cache 2>/dev/null || true
}
trap cleanup_perms EXIT
echo "[1/5] Installing host aarch64 cross-compile toolchain..."
apk add --no-cache \
build-base \
curl \
ca-certificates \
xz \
gcc-aarch64 \
g++-aarch64 \
binutils-aarch64 \
meson \
ninja \
pkgconf \
python3 \
glib-dev >/dev/null
GP_VER="2.42.12"
GP_SRC="/geminux/build-cache/gdk-pixbuf-src"
if [ "$FORCE_REBUILD" = "1" ] || [ ! -f /geminux/prebuilt/gdk-pixbuf/usr/lib/libgdk_pixbuf-2.0.so.0 ]; then
if [ ! -f "$GP_SRC/meson.build" ]; then
echo "[1b/5] Downloading pure-C gdk-pixbuf ${GP_VER}..."
rm -rf "$GP_SRC"
mkdir -p "$GP_SRC"
curl -fsSL "https://download.gnome.org/sources/gdk-pixbuf/2.42/gdk-pixbuf-${GP_VER}.tar.xz" | \
tar -xJ --strip-components=1 -C "$GP_SRC"
fi
echo "[2/5] Preparing pure-C aarch64 sysroot for gdk-pixbuf ${GP_VER}..."
GP_SYSROOT="/tmp/aarch64-gp-sysroot"
mkdir -p "$GP_SYSROOT/etc/apk/keys"
cat > "$GP_SYSROOT/etc/apk/repositories" <<EOF
https://dl-cdn.alpinelinux.org/alpine/edge/main
https://dl-cdn.alpinelinux.org/alpine/edge/community
https://dl-cdn.alpinelinux.org/alpine/edge/testing
EOF
cp /geminux/keys/alpine-devel@*.rsa.pub "$GP_SYSROOT/etc/apk/keys/"
apk --root "$GP_SYSROOT" --initdb --arch aarch64 add --no-scripts \
alpine-baselayout \
musl-dev \
glib-dev \
libpng-dev \
libjpeg-turbo-dev \
shared-mime-info \
zlib-dev \
pcre2-dev \
libffi-dev \
util-linux-dev >/dev/null
cat > /tmp/aarch64-gp-cross.ini <<EOF
[binaries]
c = '\''aarch64-alpine-linux-musl-gcc'\''
cpp = '\''aarch64-alpine-linux-musl-g++'\''
ar = '\''aarch64-alpine-linux-musl-ar'\''
strip = '\''aarch64-alpine-linux-musl-strip'\''
pkg-config = '\''pkgconf'\''
[built-in options]
c_args = ['\''--sysroot=/tmp/aarch64-gp-sysroot'\'', '\''-O2'\'', '\''-march=armv8-a+crc+crypto'\'', '\''-mtune=cortex-a53'\'', '\''-fno-plt'\'']
c_link_args = ['\''--sysroot=/tmp/aarch64-gp-sysroot'\'', '\''-Wl,-O1,--as-needed'\'']
[properties]
sys_root = '\''/tmp/aarch64-gp-sysroot'\''
pkg_config_libdir = '\''/tmp/aarch64-gp-sysroot/usr/lib/pkgconfig:/tmp/aarch64-gp-sysroot/usr/share/pkgconfig'\''
[host_machine]
system = '\''linux'\''
cpu_family = '\''aarch64'\''
cpu = '\''aarch64'\''
endian = '\''little'\''
EOF
echo "[3/5] Cross-compiling pure-C gdk-pixbuf ${GP_VER} (builtin_loaders=all, zero glycin)..."
rm -rf /tmp/build-gdk-pixbuf /geminux/prebuilt/gdk-pixbuf
meson setup /tmp/build-gdk-pixbuf "$GP_SRC" \
--cross-file=/tmp/aarch64-gp-cross.ini \
--prefix=/usr \
--libdir=lib \
--default-library=shared \
--buildtype=release \
-Dpng=enabled \
-Djpeg=enabled \
-Dtiff=disabled \
-Dgif=enabled \
-Dothers=enabled \
-Dbuiltin_loaders=all \
-Drelocatable=false \
-Dnative_windows_loaders=false \
-Dinstalled_tests=false \
-Dgio_sniffing=true \
-Dman=false \
-Dgtk_doc=false \
-Dintrospection=disabled \
-Dtests=false
ninja -C /tmp/build-gdk-pixbuf
DESTDIR=/tmp/gp-dev ninja -C /tmp/build-gdk-pixbuf install
cp -a /tmp/gp-dev/. /geminux/prebuilt/gdk-pixbuf/
rm -rf \
/geminux/prebuilt/gdk-pixbuf/usr/include \
/geminux/prebuilt/gdk-pixbuf/usr/lib/pkgconfig \
/geminux/prebuilt/gdk-pixbuf/usr/lib/libgdk_pixbuf-2.0.so \
/geminux/prebuilt/gdk-pixbuf/usr/share/locale
mkdir -p /geminux/prebuilt/gdk-pixbuf/usr/lib/gdk-pixbuf-2.0/2.10.0/loaders
cat > /geminux/prebuilt/gdk-pixbuf/usr/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache <<EOF
# Pure-C gdk-pixbuf ${GP_VER}: all standard loaders (png, jpeg, gif, bmp, ico, xpm, xbm, tga, pnm) are built-in.
EOF
aarch64-alpine-linux-musl-strip --strip-unneeded \
/geminux/prebuilt/gdk-pixbuf/usr/bin/* \
/geminux/prebuilt/gdk-pixbuf/usr/lib/libgdk_pixbuf-2.0.so.*.*
else
echo "[2/5] Reusing cached prebuilt/gdk-pixbuf ${GP_VER} (set FORCE_REBUILD=1 to rebuild)..."
fi
echo "[4/5] Preparing aarch64 sysroot for Webarchy (GTK3 + WebKit2GTK-4.1)..."
WA_SYSROOT="/tmp/aarch64-wa-sysroot"
mkdir -p "$WA_SYSROOT/etc/apk/keys"
cat > "$WA_SYSROOT/etc/apk/repositories" <<EOF
https://dl-cdn.alpinelinux.org/alpine/edge/main
https://dl-cdn.alpinelinux.org/alpine/edge/community
https://dl-cdn.alpinelinux.org/alpine/edge/testing
EOF
cp /geminux/keys/alpine-devel@*.rsa.pub "$WA_SYSROOT/etc/apk/keys/"
apk --root "$WA_SYSROOT" --initdb --arch aarch64 add --no-scripts \
alpine-baselayout \
musl-dev \
libstdc++-dev \
webkit2gtk-4.1-dev \
gtk+3.0-dev \
libx11-dev \
glib-dev \
cairo-dev \
pango-dev \
libpng-dev \
libjpeg-turbo-dev >/dev/null
# Overlay pure-C gdk-pixbuf 2.42.12 headers/.pc (when built) or shared library onto the compile sysroot
if [ -d /tmp/gp-dev/usr ]; then
cp -af /tmp/gp-dev/usr/. "$WA_SYSROOT/usr/"
else
cp -af /geminux/prebuilt/gdk-pixbuf/. "$WA_SYSROOT/"
ln -sfn libgdk_pixbuf-2.0.so.0 "$WA_SYSROOT/usr/lib/libgdk_pixbuf-2.0.so"
fi
echo "[5/5] Cross-compiling Webarchy for aarch64..."
export PKG_CONFIG_SYSROOT_DIR="$WA_SYSROOT"
export PKG_CONFIG_LIBDIR="$WA_SYSROOT/usr/lib/pkgconfig:$WA_SYSROOT/usr/share/pkgconfig"
export PKG_CONFIG_PATH=""
WA_CFLAGS="$(pkgconf --cflags webkit2gtk-4.1 gtk+-3.0 x11)"
WA_LIBS="$(pkgconf --libs webkit2gtk-4.1 gtk+-3.0 x11)"
rm -rf /geminux/prebuilt/webarchy
mkdir -p /geminux/prebuilt/webarchy/usr/bin \
/geminux/prebuilt/webarchy/usr/share/applications
aarch64-alpine-linux-musl-g++ --sysroot="$WA_SYSROOT" \
-std=c++20 -O2 -march=armv8-a+crc+crypto -mtune=cortex-a53 -fno-plt \
-Wall -Wextra \
/geminux/src/webarchy/webarchy.cpp \
$WA_CFLAGS $WA_LIBS \
-o /geminux/prebuilt/webarchy/usr/bin/webarchy
aarch64-alpine-linux-musl-strip --strip-unneeded /geminux/prebuilt/webarchy/usr/bin/webarchy
chmod 0755 /geminux/prebuilt/webarchy/usr/bin/webarchy
ln -sfn webarchy /geminux/prebuilt/webarchy/usr/bin/xwebarchy
cat > /geminux/prebuilt/webarchy/usr/share/applications/webarchy.desktop <<EOF
[Desktop Entry]
Type=Application
Name=Webarchy Browser
Comment=Ultrawide WebKit2GTK Browser with Vertical Tabs
Exec=/usr/bin/webarchy %u
Icon=web-browser
Terminal=false
NoDisplay=true
Categories=Network;WebBrowser;
MimeType=text/html;text/xml;application/xhtml+xml;x-scheme-handler/http;x-scheme-handler/https;
EOF
ls -lh /geminux/prebuilt/gdk-pixbuf/usr/lib/libgdk_pixbuf-2.0.so* /geminux/prebuilt/webarchy/usr/bin/
'
+46 -7
View File
@@ -25,9 +25,9 @@ echo "OK"
echo "[2/8] Checking excluded Wayland/Rust/upstream packages..." echo "[2/8] Checking excluded Wayland/Rust/upstream packages..."
for bad_pkg in sway wayfire weston phosh cage xwayland grim slurp wofi \ for bad_pkg in sway wayfire weston phosh cage xwayland grim slurp wofi \
sudo-rs postmarketos-base-sudo-rs rust cargo librsvg libglycin rav1e \ librsvg libglycin rav1e rav1e-libs libdovi mesa-rusticl gdk-pixbuf adwaita-icon-theme imv-x11 \
rav1e-libs libdovi mesa-rusticl gdk-pixbuf adwaita-icon-theme imv-x11 \ gst-libav gst-plugins-bad libnotify \
gst-libav gst-plugins-bad gst-plugins-good libnotify \ deno py3-cryptography \
linux-edge linux-lts xorg-server xf86-input-libinput xf86-video-fbdev; do linux-edge linux-lts xorg-server xf86-input-libinput xf86-video-fbdev; do
if grep -Fxq "P:$bad_pkg" "$ROOTFS_DIR/lib/apk/db/installed"; then if grep -Fxq "P:$bad_pkg" "$ROOTFS_DIR/lib/apk/db/installed"; then
echo "FAIL: forbidden package '$bad_pkg' is installed in rootfs" >&2 echo "FAIL: forbidden package '$bad_pkg' is installed in rootfs" >&2
@@ -108,7 +108,8 @@ docker run --rm --network=host \
printf "%s\n" "$UPG_OUT" printf "%s\n" "$UPG_OUT"
for pkg in geminux-kernel-modules geminux-xlibre geminux-suckless \ for pkg in geminux-kernel-modules geminux-xlibre geminux-suckless \
geminux-dunst geminux-ui geminux-bantam geminux-gsocket geminux-config; do geminux-dunst geminux-ui geminux-bantam geminux-gsocket geminux-mpv \
geminux-gdk-pixbuf geminux-webarchy geminux-config; do
if ! grep -q "^${pkg}@geminux=" /rootfs/etc/apk/world; then if ! grep -q "^${pkg}@geminux=" /rootfs/etc/apk/world; then
echo "FAIL: ${pkg} is not exact-version pinned to @geminux in world" >&2 echo "FAIL: ${pkg} is not exact-version pinned to @geminux in world" >&2
exit 1 exit 1
@@ -119,7 +120,7 @@ docker run --rm --network=host \
fi fi
done done
if printf "%s\n" "$UPG_OUT" | grep -q -E "(rust|cargo|librsvg|libglycin|gdk-pixbuf|rav1e|libdovi|xorg-server|linux-edge)"; then if printf "%s\n" "$UPG_OUT" | grep -q -E "(rust|cargo|librsvg|libglycin|gdk-pixbuf|rav1e|libdovi|deno|py3-cryptography|xorg-server|linux-edge)"; then
echo "FAIL: upgrade simulation tried to pull forbidden Rust or upstream override package" >&2 echo "FAIL: upgrade simulation tried to pull forbidden Rust or upstream override package" >&2
exit 1 exit 1
fi fi
@@ -149,7 +150,15 @@ file \
"$BASE_DIR/prebuilt/bantam/usr/bin/bantam" \ "$BASE_DIR/prebuilt/bantam/usr/bin/bantam" \
"$BASE_DIR/prebuilt/gsocket/usr/local/bin/gs-netcat" \ "$BASE_DIR/prebuilt/gsocket/usr/local/bin/gs-netcat" \
"$BASE_DIR/prebuilt/gsocket/usr/local/bin/gsocket_dso.so.0" \ "$BASE_DIR/prebuilt/gsocket/usr/local/bin/gsocket_dso.so.0" \
"$BASE_DIR/prebuilt/gsocket/usr/local/bin/gsocket_uchroot_dso.so.0" | \ "$BASE_DIR/prebuilt/gsocket/usr/local/bin/gsocket_uchroot_dso.so.0" \
"$BASE_DIR/prebuilt/mpv/usr/bin/mpv" \
"$BASE_DIR/prebuilt/mpv/usr/bin/ffmpeg" \
"$BASE_DIR/prebuilt/mpv/usr/bin/ffprobe" \
"$BASE_DIR/prebuilt/mpv/usr/lib/geminux-mpv/"*.so.*.* \
"$BASE_DIR/prebuilt/mpv/usr/lib/gstreamer-1.0/libgstlibav.so" \
"$BASE_DIR/prebuilt/gdk-pixbuf/usr/bin/gdk-pixbuf-"* \
"$BASE_DIR/prebuilt/gdk-pixbuf/usr/lib/libgdk_pixbuf-2.0.so.0."* \
"$BASE_DIR/prebuilt/webarchy/usr/bin/webarchy" | \
awk '!/ARM aarch64/ { print "FAIL: not aarch64: " $0; bad=1 } END { exit bad }' awk '!/ARM aarch64/ { print "FAIL: not aarch64: " $0; bad=1 } END { exit bad }'
echo "OK (all aarch64 ELFs verified)" echo "OK (all aarch64 ELFs verified)"
@@ -284,13 +293,31 @@ for req_rel in ("etc/pam.d/autologin", "etc/init.d/geminux-hwinit",
"usr/share/X11/xkb/types/custom", "usr/sbin/dnsmasq", "usr/share/X11/xkb/types/custom", "usr/sbin/dnsmasq",
"etc/NetworkManager/conf.d/20-geminux-wifi.conf", "etc/shells", "etc/NetworkManager/conf.d/20-geminux-wifi.conf", "etc/shells",
"usr/sbin/geminux-wifi-nvram", "usr/sbin/geminux-tzctl", "usr/sbin/geminux-wifi-nvram", "usr/sbin/geminux-tzctl",
"usr/sbin/geminux-dnsctl",
"usr/bin/geminux-datetime", "usr/bin/geminux-datetime",
"usr/bin/bantam", "usr/bin/bantam",
"usr/bin/lynx", "usr/bin/lynx",
"usr/bin/webarchy",
"usr/bin/xwebarchy",
"usr/bin/dtach", "usr/bin/dtach",
"usr/bin/gpg",
"usr/bin/gpg-agent",
"usr/bin/openssl", "usr/bin/openssl",
"usr/bin/pass",
"usr/bin/pinentry",
"usr/bin/python3",
"usr/bin/pip3",
"usr/bin/mpv",
"usr/bin/ffmpeg",
"usr/bin/ffprobe",
"usr/bin/mpg123",
"usr/bin/yt-dlp",
"usr/lib/libgdk_pixbuf-2.0.so.0",
"usr/lib/gstreamer-1.0/libgstlibav.so",
"usr/share/glib-2.0/schemas/gschemas.compiled",
"usr/local/bin/gs-netcat", "usr/local/bin/gs-netcat",
"usr/local/bin/gsocket", "usr/local/bin/gsocket",
"etc/mpv/mpv.conf",
"etc/htoprc", "etc/htoprc",
"etc/keymap/gemini-us.map", "etc/keymap/gemini-us.map",
"etc/skel/.gitconfig", "etc/skel/.gitconfig",
@@ -327,6 +354,7 @@ for rel, needle in (
("etc/NetworkManager/conf.d/20-geminux-wifi.conf", "wifi.scan-rand-mac-address = no"), ("etc/NetworkManager/conf.d/20-geminux-wifi.conf", "wifi.scan-rand-mac-address = no"),
("etc/NetworkManager/conf.d/20-geminux-wifi.conf", "wifi-sec.pmf = 1"), ("etc/NetworkManager/conf.d/20-geminux-wifi.conf", "wifi-sec.pmf = 1"),
("etc/shells", "/bin/bash"), ("etc/shells", "/bin/bash"),
("usr/bin/geminux-launcher", "Webarchy Browser"),
("usr/bin/geminux-launcher", "Bantam AI agent"), ("usr/bin/geminux-launcher", "Bantam AI agent"),
): ):
p = os.path.join(rootfs, rel) p = os.path.join(rootfs, rel)
@@ -340,6 +368,15 @@ with open(os.path.join(rootfs, "usr/bin/bantam"), "rb") as f:
bantam_bin = f.read() bantam_bin = f.read()
if b"kilo-auto/free" not in bantam_bin or b"openrouter/free" in bantam_bin: if b"kilo-auto/free" not in bantam_bin or b"openrouter/free" in bantam_bin:
raise SystemExit("FAIL: rootfs/usr/bin/bantam does not default to 'kilo-auto/free'") raise SystemExit("FAIL: rootfs/usr/bin/bantam does not default to 'kilo-auto/free'")
repo_dir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(sys.argv[5]))))
with open(os.path.join(repo_dir, "src/dwm/dwm.c"), "r", encoding="utf-8") as f:
dwm_src = f.read()
if "PropertyChangeMask |\n FocusChangeMask;" not in dwm_src or "NotifyWhileGrabbed" not in dwm_src:
raise SystemExit("FAIL: src/dwm/dwm.c missing root FocusChangeMask or NotifyWhileGrabbed guard")
with open(os.path.join(repo_dir, "src/st/x.c"), "r", encoding="utf-8") as f:
stx_src = f.read()
if 'ttywrite("\\033[I", 3, 0);\n\t\tredraw();' not in stx_src or 'ttywrite("\\033[O", 3, 0);\n\t\tredraw();' not in stx_src:
raise SystemExit("FAIL: src/st/x.c focus() missing immediate redraw()")
awk_path = os.path.join(rootfs, "usr", "bin", "awk") awk_path = os.path.join(rootfs, "usr", "bin", "awk")
if not os.path.lexists(awk_path): if not os.path.lexists(awk_path):
@@ -459,12 +496,14 @@ if readelf -Ws "$ROOTFS_DIR/usr/bin/Xorg" | grep -q systemd_logind_take_fd; then
fi fi
(cd "$IMAGES_DIR" && sha256sum -c SHA256SUMS) (cd "$IMAGES_DIR" && sha256sum -c SHA256SUMS)
echo "[8/8] Running all 5 Python unit/verification suites..." echo "[8/8] Running all 7 Python unit/verification suites..."
python3 "$BASE_DIR/scripts/test-flash-mtk-gpt.py" python3 "$BASE_DIR/scripts/test-flash-mtk-gpt.py"
python3 "$BASE_DIR/scripts/test-xkb-keymap.py" python3 "$BASE_DIR/scripts/test-xkb-keymap.py"
python3 "$BASE_DIR/scripts/test-theme-dunst-sync.py" python3 "$BASE_DIR/scripts/test-theme-dunst-sync.py"
python3 "$BASE_DIR/scripts/test-ccci-protocol.py" python3 "$BASE_DIR/scripts/test-ccci-protocol.py"
python3 "$BASE_DIR/scripts/test-power-policy.py" python3 "$BASE_DIR/scripts/test-power-policy.py"
python3 "$BASE_DIR/scripts/test-webarchy-renderer.py"
python3 "$BASE_DIR/scripts/test-webkit-gsettings.py"
echo "============================================================" echo "============================================================"
echo "ALL GEMINUX CHECKS PASSED CLEANLY" echo "ALL GEMINUX CHECKS PASSED CLEANLY"
+41
View File
@@ -0,0 +1,41 @@
#!/bin/sh
# Compile the target rootfs's GSettings XML schemas.
# Apk installs packages with --no-scripts, so gschemas.compiled is not created
# by package triggers. WebKitGTK's network process aborts when the compiled
# schema database is missing.
set -eu
BASE_DIR="$(cd "$(dirname "$0")/.." && pwd)"
TARGET_ROOTFS="${1:-${ROOTFS_DIR:-$BASE_DIR/rootfs}}"
SCHEMA_DIR="$TARGET_ROOTFS/usr/share/glib-2.0/schemas"
if [ ! -d "$SCHEMA_DIR" ]; then
echo "Error: GSettings schema directory is missing: $SCHEMA_DIR" >&2
exit 1
fi
schema_found=0
for schema_file in "$SCHEMA_DIR"/*.gschema.xml "$SCHEMA_DIR"/*.enums.xml; do
if [ -f "$schema_file" ]; then
schema_found=1
break
fi
done
if [ "$schema_found" -ne 1 ]; then
echo "Error: no GSettings schema XML files found in $SCHEMA_DIR" >&2
exit 1
fi
if ! command -v glib-compile-schemas >/dev/null 2>&1; then
echo "Error: glib-compile-schemas is required to compile $SCHEMA_DIR" >&2
exit 1
fi
glib-compile-schemas --strict --targetdir="$SCHEMA_DIR" "$SCHEMA_DIR" >/dev/null
if [ ! -s "$SCHEMA_DIR/gschemas.compiled" ]; then
echo "Error: glib-compile-schemas did not create gschemas.compiled" >&2
exit 1
fi
chmod 0644 "$SCHEMA_DIR/gschemas.compiled"
echo "[ok] compiled GSettings schemas in $SCHEMA_DIR"
+50 -3
View File
@@ -79,10 +79,10 @@ def collect_needed_so(stage_dir):
for root, _, names in os.walk(stage_dir): for root, _, names in os.walk(stage_dir):
for name in names: for name in names:
p = os.path.join(root, name) p = os.path.join(root, name)
if os.path.islink(p) or not os.path.isfile(p):
continue
if ".so" in name: if ".so" in name:
internal.add(name) internal.add(name)
if os.path.islink(p) or not os.path.isfile(p):
continue
with open(p, "rb") as f: with open(p, "rb") as f:
if f.read(4) == b"\x7fELF": if f.read(4) == b"\x7fELF":
elfs.append(p) elfs.append(p)
@@ -250,7 +250,51 @@ make_pkg(
depends=["bash", "openssl"] + collect_needed_so(gstage), depends=["bash", "openssl"] + collect_needed_so(gstage),
) )
# 8. geminux-config # 8. geminux-mpv
mstage = os.path.join(work_dir, "geminux-mpv")
copy_tree_dedup("/geminux/prebuilt/mpv", mstage)
make_pkg(
"geminux-mpv", "0.40.0-r0",
"Pure-X11 zero-Rust mpv media player and FFmpeg CLI tools with Panfrost EGL and PipeWire",
mstage,
provides=["cmd:mpv=0.40.0-r0", "mpv=0.40.0-r0",
"cmd:ffmpeg=7.1.5-r0", "cmd:ffprobe=7.1.5-r0", "ffmpeg=7.1.5-r0"],
depends=collect_needed_so(mstage),
)
# 9. geminux-gdk-pixbuf
gpstage = os.path.join(work_dir, "geminux-gdk-pixbuf")
copy_tree_dedup("/geminux/prebuilt/gdk-pixbuf", gpstage)
make_pkg(
"geminux-gdk-pixbuf", "2.42.12-r0",
"Pure-C zero-glycin gdk-pixbuf 2.42.12 with built-in PNG/JPEG/GIF/BMP/ICO/XPM loaders",
gpstage,
provides=[
"so:libgdk_pixbuf-2.0.so.0=0",
"cmd:gdk-pixbuf-query-loaders=2.42.12-r0",
"cmd:gdk-pixbuf-csource=2.42.12-r0",
"cmd:gdk-pixbuf-pixdata=2.42.12-r0",
],
depends=["shared-mime-info"] + collect_needed_so(gpstage),
)
# 10. geminux-webarchy
wstage = os.path.join(work_dir, "geminux-webarchy")
copy_tree_dedup("/geminux/prebuilt/webarchy", wstage)
make_pkg(
"geminux-webarchy", pkg_ver,
"Webarchy ultrawide GTK3/WebKit2GTK browser with right vertical tab bar and .Xresources theming",
wstage,
provides=[f"cmd:webarchy={pkg_ver}", f"cmd:xwebarchy={pkg_ver}", f"webarchy={pkg_ver}"],
depends=[
"webkit2gtk-4.1",
"gst-plugins-good",
"gsettings-desktop-schemas",
"geminux-gdk-pixbuf=2.42.12-r0",
] + collect_needed_so(wstage),
)
# 11. geminux-config
cstage = os.path.join(work_dir, "geminux-config") cstage = os.path.join(work_dir, "geminux-config")
copy_tree_dedup("/geminux/overlay/rootfs", cstage, dedup=True) copy_tree_dedup("/geminux/overlay/rootfs", cstage, dedup=True)
for rel in ("etc/os-release", "usr/lib/os-release", "etc/issue", "etc/motd"): for rel in ("etc/os-release", "usr/lib/os-release", "etc/issue", "etc/motd"):
@@ -273,6 +317,9 @@ make_pkg(
f"geminux-ui={pkg_ver}", f"geminux-ui={pkg_ver}",
f"geminux-bantam={pkg_ver}", f"geminux-bantam={pkg_ver}",
f"geminux-gsocket=1.4.43-r0", f"geminux-gsocket=1.4.43-r0",
f"geminux-mpv=0.40.0-r0",
f"geminux-gdk-pixbuf=2.42.12-r0",
f"geminux-webarchy={pkg_ver}",
], ],
replaces=[ replaces=[
"alpine-baselayout", "alpine-baselayout",
+28
View File
@@ -4,6 +4,7 @@
alpine-base alpine-base
alsa-ucm-conf alsa-ucm-conf
alsa-utils alsa-utils
attr
bash bash
bc bc
bluez bluez
@@ -19,6 +20,7 @@ coreutils
cryptsetup cryptsetup
curl curl
curl-dev curl-dev
dav1d
dbus dbus
dbus-libs dbus-libs
dbus-openrc dbus-openrc
@@ -43,8 +45,11 @@ font-noto-cjk
font-noto-emoji font-noto-emoji
git git
glib glib
gnupg
gpg
gsettings-desktop-schemas gsettings-desktop-schemas
gst-plugins-base gst-plugins-base
gst-plugins-good
gstreamer gstreamer
harfbuzz harfbuzz
hicolor-icon-theme hicolor-icon-theme
@@ -60,8 +65,11 @@ jpm
jq jq
kmod kmod
lang lang
lcms2
less less
libass
libcurl libcurl
libdisplay-info
libdrm libdrm
libepoxy libepoxy
libfreeaptx libfreeaptx
@@ -72,14 +80,18 @@ libldac
libpng libpng
libva libva
libva-utils libva-utils
libvpx
libxcvt libxcvt
libxfont2 libxfont2
libxft libxft
libxi libxi
libxinerama libxinerama
libxpresent
libxrandr libxrandr
libxscrnsaver libxscrnsaver
libxtst libxtst
libxv
luajit
lynx lynx
mandoc mandoc
mc mc
@@ -92,6 +104,7 @@ mesa-utils
mobile-broadband-provider-info mobile-broadband-provider-info
modemmanager modemmanager
modemmanager-openrc modemmanager-openrc
mpg123
mtdev mtdev
musl-locales musl-locales
nano nano
@@ -107,12 +120,14 @@ openssh
openssh-server-pam openssh-server-pam
openssl openssl
pango pango
pass
perl perl
perl-io-socket-ssl perl-io-socket-ssl
perl-libwww perl-libwww
perl-lwp-protocol-https perl-lwp-protocol-https
perl-mozilla-ca perl-mozilla-ca
perl-net-ssleay perl-net-ssleay
pinentry
pipewire pipewire
pipewire-alsa pipewire-alsa
pipewire-pulse pipewire-pulse
@@ -121,6 +136,13 @@ pipewire-tools
pixman pixman
polkit polkit
pulseaudio-utils pulseaudio-utils
py3-brotli
py3-mutagen
py3-pip
py3-pycryptodomex
py3-websockets
python3
quickjs
readline readline
rlwrap rlwrap
sbc sbc
@@ -133,10 +155,12 @@ tinydm
tinydm-openrc tinydm-openrc
tinydm-x11 tinydm-x11
tzdata tzdata
uchardet-libs
usbutils usbutils
util-linux util-linux
util-linux-misc util-linux-misc
v4l-utils v4l-utils
webkit2gtk-4.1
wireless-regdb wireless-regdb
wireplumber wireplumber
wpa_supplicant wpa_supplicant
@@ -152,5 +176,9 @@ xrdb
xset xset
xsetroot xsetroot
yabasic yabasic
yt-dlp-core
yt-dlp-ejs
yt-dlp-ejs-rt-quickjs
zimg
zram-init zram-init
zram-init-openrc zram-init-openrc
+4 -2
View File
@@ -9,6 +9,8 @@ sudo-rs
postmarketos-base-sudo-rs postmarketos-base-sudo-rs
gstreamer-ptp-helper gstreamer-ptp-helper
libheif-rav1e libheif-rav1e
deno
py3-cryptography
rust rust
cargo cargo
librsvg librsvg
@@ -25,7 +27,6 @@ adwaita-icon-theme
imv-x11 imv-x11
gst-libav gst-libav
gst-plugins-bad gst-plugins-bad
gst-plugins-good
libnotify libnotify
generate-kernel-cmdline generate-kernel-cmdline
linux-lts linux-lts
@@ -45,6 +46,8 @@ wpa_supplicant-openrc
!xwayland !xwayland
!gstreamer-ptp-helper !gstreamer-ptp-helper
!libheif-rav1e !libheif-rav1e
!deno
!py3-cryptography
!postmarketos-base-sudo-rs !postmarketos-base-sudo-rs
!sudo-rs !sudo-rs
!rust !rust
@@ -63,7 +66,6 @@ wpa_supplicant-openrc
!imv-x11 !imv-x11
!gst-libav !gst-libav
!gst-plugins-bad !gst-plugins-bad
!gst-plugins-good
!libnotify !libnotify
!generate-kernel-cmdline !generate-kernel-cmdline
!linux-lts !linux-lts
+70
View File
@@ -35,6 +35,7 @@ C_TEST = r"""
#include "geminux-bt-list.h" #include "geminux-bt-list.h"
#include "geminux-audio-parse.h" #include "geminux-audio-parse.h"
#include "geminux-tz-valid.h" #include "geminux-tz-valid.h"
#include "geminux-dns-valid.h"
#include "geminux-cam-bayer.h" #include "geminux-cam-bayer.h"
#include "geminux-leds-core.h" #include "geminux-leds-core.h"
@@ -428,6 +429,75 @@ int main(void) {
assert(geminux_uevent_is_power_supply(uev_ps, sizeof(uev_ps))); assert(geminux_uevent_is_power_supply(uev_ps, sizeof(uev_ps)));
assert(!geminux_uevent_is_power_supply(uev_in, sizeof(uev_in))); assert(!geminux_uevent_is_power_supply(uev_in, sizeof(uev_in)));
assert(!geminux_uevent_is_power_supply(uev_pfx, sizeof(uev_pfx))); assert(!geminux_uevent_is_power_supply(uev_pfx, sizeof(uev_pfx)));
/* Wi-Fi active connection preservation (iw link + merge into empty/partial scan) */
char iw_bssid[24], iw_ssid[96];
int iw_chan = 0, iw_sig = 0;
const char *iw_sample =
"Connected to 11:22:33:44:55:66 (on wlan0)\n"
"\tSSID: OfficeNet\n"
"\tfreq: 5220.0\n"
"\tsignal: -42 dBm\n";
assert(geminux_parse_iw_link(iw_sample, iw_bssid, sizeof(iw_bssid),
iw_ssid, sizeof(iw_ssid), &iw_chan, &iw_sig));
assert(strcmp(iw_bssid, "11:22:33:44:55:66") == 0);
assert(strcmp(iw_ssid, "OfficeNet") == 0);
assert(iw_chan == 44 && iw_sig == 100);
assert(!geminux_parse_iw_link("Not connected.\n", iw_bssid, sizeof(iw_bssid),
iw_ssid, sizeof(iw_ssid), &iw_chan, &iw_sig));
geminux_wifi_group_t active_only[4];
int na = geminux_merge_active_wifi(active_only, 0, 4, "OfficeNet",
"11:22:33:44:55:66", 44, 96, "WPA2");
assert(na == 1 && active_only[0].in_use);
assert(strcmp(active_only[0].ssid, "OfficeNet") == 0);
assert(active_only[0].best_chan == 44 && active_only[0].best_signal == 96);
geminux_wifi_group_t partial[4];
int np2 = geminux_parse_wifi_scan(" :aa\\:bb\\:cc\\:dd\\:ee\\:03:StrongOther:1:92:WPA2\n", partial, 4);
np2 = geminux_merge_active_wifi(partial, np2, 4, "OfficeNet",
"11:22:33:44:55:66", 44, 82, "WPA2");
assert(np2 == 2);
assert(strcmp(partial[0].ssid, "OfficeNet") == 0 && partial[0].in_use);
assert(strcmp(partial[1].ssid, "StrongOther") == 0 && !partial[1].in_use);
/* Mark existing entry active when nmcli scan missed '*' flag */
geminux_wifi_group_t unmarked[4];
int nu = geminux_parse_wifi_scan(" :aa\\:bb\\:cc\\:dd\\:ee\\:03:StrongOther:1:92:WPA2\n"
" :aa\\:bb\\:cc\\:dd\\:ee\\:04:OfficeNet:36:60:WPA2\n",
unmarked, 4);
nu = geminux_merge_active_wifi(unmarked, nu, 4, "OfficeNet", NULL, 0, 0, NULL);
assert(nu == 2 && unmarked[0].in_use && strcmp(unmarked[0].ssid, "OfficeNet") == 0);
assert(!unmarked[1].in_use);
/* DNS preset & custom nameserver parsing/validation */
assert(geminux_dns_mode_valid("default"));
assert(geminux_dns_mode_valid("cloudflare"));
assert(geminux_dns_mode_valid("google"));
assert(geminux_dns_mode_valid("radicaldns"));
assert(geminux_dns_mode_valid("quad9"));
assert(geminux_dns_mode_valid("custom"));
assert(!geminux_dns_mode_valid("evil;rm"));
assert(!geminux_dns_mode_valid(""));
char dv4[6][16], dv6[6][46], dnorm[192];
int dn4 = 0, dn6 = 0;
int dtot = geminux_parse_dns_servers(" 2a01:4f8:1c0c:82c0::1, 88.198.92.222 192.71.166.92, 88.198.92.222 ",
dv4, &dn4, 6, dv6, &dn6, 6, dnorm, sizeof(dnorm));
assert(dtot == 3 && dn4 == 2 && dn6 == 1);
assert(strcmp(dnorm, "88.198.92.222,192.71.166.92,2a01:4f8:1c0c:82c0::1") == 0);
assert(geminux_parse_dns_servers("", dv4, &dn4, 6, dv6, &dn6, 6, dnorm, sizeof(dnorm)) < 0);
assert(geminux_parse_dns_servers("1.1.1.1;id", dv4, &dn4, 6, dv6, &dn6, 6, dnorm, sizeof(dnorm)) < 0);
assert(geminux_parse_dns_servers("0.0.0.0", dv4, &dn4, 6, dv6, &dn6, 6, dnorm, sizeof(dnorm)) < 0);
assert(geminux_parse_dns_servers("224.0.0.1", dv4, &dn4, 6, dv6, &dn6, 6, dnorm, sizeof(dnorm)) < 0);
assert(geminux_parse_dns_servers("999.1.1.1", dv4, &dn4, 6, dv6, &dn6, 6, dnorm, sizeof(dnorm)) < 0);
assert(geminux_parse_dns_servers("1.1.1.1,1.0.0.1,8.8.8.8,8.8.4.4,9.9.9.9,88.198.92.222,192.71.166.92",
dv4, &dn4, 6, dv6, &dn6, 6, dnorm, sizeof(dnorm)) < 0);
char rsum[128];
int rc_cnt = geminux_parse_resolv_conf("# Generated\nnameserver 88.198.92.222\nnameserver 192.71.166.92 # rad\n",
rsum, sizeof(rsum));
assert(rc_cnt == 2 && strcmp(rsum, "88.198.92.222, 192.71.166.92") == 0);
return 0; return 0;
} }
""" """
+158
View File
@@ -0,0 +1,158 @@
#!/usr/bin/env python3
"""Host unit test for Geminux Webarchy renderer profile & ultrawide vertical tab wiring."""
import pathlib
import re
import subprocess
import sys
import tempfile
BASE = pathlib.Path(__file__).resolve().parent.parent
SOURCE = BASE / "src/webarchy/webarchy.cpp"
FUNCTIONS = (
"std::string deviceTreeCompatibles",
"bool webarchySoftwareRendererPreferred",
"void configureWebkitRenderer",
)
def extract(name, text):
start = text.find("\n" + name + "(")
if start < 0:
raise SystemExit("missing function %s in src/webarchy/webarchy.cpp" % name)
start += 1
depth = 0
opened = False
for pos in range(start, len(text)):
if text[pos] == "{":
depth += 1
opened = True
elif text[pos] == "}":
depth -= 1
if opened and depth == 0:
return text[start:pos + 1] + "\n"
raise SystemExit("unterminated function %s" % name)
HARNESS_HEAD = r'''
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <unistd.h>
static const char* g_compat_path = nullptr;
static const char* g_home = nullptr;
std::string getHomeDirPath() { return std::string(g_home); }
SOFTWARE_FLAG
#define CHECK(cond) do { \
if (!(cond)) { std::fprintf(stderr, "FAIL %s:%d: %s\n", __FILE__, __LINE__, #cond); return 1; } \
} while (0)
'''
HARNESS_MAIN = r'''
int main(int argc, char** argv) {
CHECK(argc == 4);
g_compat_path = argv[1];
g_home = argv[2];
const int expect_software = (argv[3][0] == '1');
std::string flag = std::string(g_home) + kSoftwareRendererFlag;
CHECK(webarchySoftwareRendererPreferred() == (expect_software != 0));
::unlink(flag.c_str());
::setenv("WEBKIT_DISABLE_DMABUF_RENDERER", "0", 1);
::setenv("WEBKIT_DISABLE_COMPOSITING_MODE", "0", 1);
::setenv("JSC_useJIT", "0", 1);
configureWebkitRenderer(false);
CHECK(::getenv("WEBKIT_DISABLE_DMABUF_RENDERER") == nullptr);
CHECK(::getenv("WEBKIT_DISABLE_COMPOSITING_MODE") == nullptr);
CHECK(std::string(::getenv("JSC_useJIT")) == "0");
FILE* f = std::fopen(flag.c_str(), "wb");
CHECK(f != nullptr);
std::fclose(f);
CHECK(webarchySoftwareRendererPreferred());
configureWebkitRenderer(true);
CHECK(std::string(::getenv("WEBKIT_DISABLE_DMABUF_RENDERER")) == "1");
CHECK(std::string(::getenv("WEBKIT_SKIA_ENABLE_CPU_RENDERING")) == "1");
CHECK(std::string(::getenv("WEBKIT_DISABLE_SANDBOX_THIS_IS_DANGEROUS")) == "1");
CHECK(std::string(::getenv("GDK_BACKEND")) == "x11");
return 0;
}
'''
def main():
text = SOURCE.read_text(encoding="utf-8")
for needle in (
'gtk_box_pack_end(GTK_BOX(root), app->tabSidebar',
'gtk_widget_set_hexpand(app->tabSidebar, FALSE)',
'gtk_widget_set_hexpand_set(app->tabSidebar, TRUE)',
'"wa-tabbar"',
'"wa-tablist"',
'g_unix_signal_add(SIGUSR1, onSigUsr1ThemeReload',
'onWebProcessTerminated',
'WEBKIT_WEB_PROCESS_CRASHED',
'WEBKIT_POLICY_DECISION_TYPE_NEW_WINDOW_ACTION',
):
if needle not in text:
raise SystemExit("missing expected Webarchy UI/engine marker: %s" % needle)
if 'gtk_widget_set_hexpand(GTK_WIDGET(app->tabHeaderLabel), TRUE)' in text:
raise SystemExit("tabHeaderLabel must not set hexpand=TRUE (expands right sidebar)")
if re.search(r"font-size:\s*[0-9.]+px", text):
raise SystemExit("src/webarchy/webarchy.cpp CSS must use DPI-scaled 'pt' font sizes, not 'px'")
flag_decl = re.search(
r'constexpr const char\* kSoftwareRendererFlag =\s*"([^"]+)";', text)
if not flag_decl:
raise SystemExit("missing kSoftwareRendererFlag in src/webarchy/webarchy.cpp")
funcs = "\n".join(extract(name, text) for name in FUNCTIONS)
funcs = funcs.replace('"/proc/device-tree/compatible"', 'g_compat_path')
if '"/proc/device-tree/compatible"' in funcs:
raise SystemExit("could not redirect the device-tree path")
harness = HARNESS_HEAD.replace(
"SOFTWARE_FLAG",
'constexpr const char* kSoftwareRendererFlag = "%s";' % flag_decl.group(1))
harness += funcs + HARNESS_MAIN
with tempfile.TemporaryDirectory(prefix="geminux-webarchy-") as tmp:
root = pathlib.Path(tmp)
src = root / "renderer_test.cpp"
exe = root / "renderer_test"
compat = root / "compatible"
home = root / "home"
(home / ".config/geminux/webarchy").mkdir(parents=True)
flag = home / flag_decl.group(1).lstrip("/")
src.write_text(harness, encoding="utf-8")
build = subprocess.run(
["g++", "-std=c++20", "-Wall", "-Wextra", "-Werror", str(src), "-o", str(exe)],
capture_output=True, text=True)
if build.returncode:
sys.stderr.write(build.stderr)
return 1
cases = (
("geminux-x27", b"planet,gemini-pda\0mediatek,mt6797\0", "0", False),
("beatles", b"nokia,beatles\0nokia,argon\0qcom,msm8905\0", "1", False),
("geminux-x27 + override", b"planet,gemini-pda\0mediatek,mt6797\0", "1", True),
)
for label, data, expected, override in cases:
compat.write_bytes(data)
if override:
flag.write_bytes(b"1\n")
elif flag.exists():
flag.unlink()
probe = subprocess.run([str(exe), str(compat), str(home), expected],
capture_output=True, text=True)
if probe.returncode:
sys.stderr.write("%s: %s" % (label, probe.stderr))
return 1
print("[ok] renderer profile: %s" % label)
print("webarchy renderer & layout: all checks passed")
return 0
if __name__ == "__main__":
sys.exit(main())
+89
View File
@@ -0,0 +1,89 @@
#!/usr/bin/env python3
"""Host test for the WebKitGTK GSettings schema build wiring in Geminux."""
import os
import pathlib
import shutil
import subprocess
import tempfile
BASE = pathlib.Path(__file__).resolve().parent.parent
HELPER = BASE / "scripts/compile-gsettings-schemas.sh"
PACKAGES = BASE / "scripts/rootfs-packages.txt"
OVERLAY = BASE / "scripts/apply-geminux-overlay.sh"
BOOTSTRAP = BASE / "scripts/bootstrap-rootfs-container.sh"
REBUILD = BASE / "rebuild-image.sh"
SCHEMA_XML = """<?xml version="1.0" encoding="UTF-8"?>
<schemalist>
<schema id="org.geminux.webkit.probe" path="/org/geminux/webkit/probe/">
<key name="enabled" type="b">
<default>true</default>
</key>
</schema>
</schemalist>
"""
def read(path):
return path.read_text(encoding="utf-8")
def main():
for tool in ("glib-compile-schemas", "gsettings"):
if not shutil.which(tool):
raise SystemExit("missing required host tool: %s" % tool)
if not HELPER.is_file() or not os.access(HELPER, os.X_OK):
raise SystemExit("missing executable scripts/compile-gsettings-schemas.sh")
helper = read(HELPER)
if "glib-compile-schemas --strict --targetdir" not in helper:
raise SystemExit("compile helper lost its strict targetdir compilation")
if "gschemas.compiled" not in helper:
raise SystemExit("compile helper no longer validates gschemas.compiled")
packages = {
line.strip()
for line in read(PACKAGES).splitlines()
if line.strip() and not line.lstrip().startswith("#")
}
for package in ("glib", "gsettings-desktop-schemas", "webkit2gtk-4.1", "gst-plugins-good"):
if package not in packages:
raise SystemExit("rootfs package set is missing %s" % package)
overlay = read(OVERLAY)
if "scripts/compile-gsettings-schemas.sh" not in overlay:
raise SystemExit("overlay application no longer compiles GSettings schemas")
bootstrap = read(BOOTSTRAP)
if "apk add --no-cache python3 kmod openssl glib" not in bootstrap:
raise SystemExit("bootstrap container no longer installs glib host tools")
rebuild = read(REBUILD)
if " glib " not in rebuild:
raise SystemExit("image build container no longer installs glib host tools")
print("[ok] WebKit GSettings package and build wiring")
with tempfile.TemporaryDirectory(prefix="geminux-gsettings-") as tmp:
root = pathlib.Path(tmp)
schema_dir = root / "usr/share/glib-2.0/schemas"
schema_dir.mkdir(parents=True)
(schema_dir / "org.geminux.webkit.probe.gschema.xml").write_text(
SCHEMA_XML, encoding="utf-8")
result = subprocess.run(
[str(HELPER), str(root)], capture_output=True, text=True)
if result.returncode != 0:
raise SystemExit("schema compile failed:\n%s" % result.stderr.strip())
compiled = schema_dir / "gschemas.compiled"
if not compiled.is_file() or compiled.stat().st_size == 0:
raise SystemExit("helper did not produce gschemas.compiled")
env = os.environ.copy()
env["GSETTINGS_SCHEMA_DIR"] = str(schema_dir)
listed = subprocess.run(
["gsettings", "list-schemas"], env=env,
capture_output=True, text=True)
if listed.returncode != 0 or \
"org.geminux.webkit.probe" not in listed.stdout:
raise SystemExit("compiled schema database is not readable by gsettings")
print("[ok] WebKit GSettings schema compilation")
if __name__ == "__main__":
main()
+4 -1
View File
@@ -831,6 +831,8 @@ static void focus(Client *c) {
static void focusin(XEvent *e) { static void focusin(XEvent *e) {
XFocusChangeEvent *ev = &e->xfocus; XFocusChangeEvent *ev = &e->xfocus;
if (ev->mode == NotifyGrab || ev->mode == NotifyWhileGrabbed)
return;
if (selmon->sel && ev->window != selmon->sel->win) if (selmon->sel && ev->window != selmon->sel->win)
setfocus(selmon->sel); setfocus(selmon->sel);
} }
@@ -1752,7 +1754,8 @@ static void setup(void) {
wa.cursor = cursor[CurNormal]->cursor; wa.cursor = cursor[CurNormal]->cursor;
wa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask | wa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask |
ButtonPressMask | PointerMotionMask | EnterWindowMask | ButtonPressMask | PointerMotionMask | EnterWindowMask |
LeaveWindowMask | StructureNotifyMask | PropertyChangeMask; LeaveWindowMask | StructureNotifyMask | PropertyChangeMask |
FocusChangeMask;
XChangeWindowAttributes(dpy, root, CWEventMask | CWCursor, &wa); XChangeWindowAttributes(dpy, root, CWEventMask | CWCursor, &wa);
XSelectInput(dpy, root, wa.event_mask); XSelectInput(dpy, root, wa.event_mask);
grabkeys(); grabkeys();
+1 -1
View File
@@ -28,7 +28,7 @@ geminux-datetime: geminux-datetime.c ../geminux-daemons/geminux-tz-valid.h ../li
geminux-camera: geminux-camera.c geminux-cam-bayer.h ../libgemui/gemui.h geminux-camera: geminux-camera.c geminux-cam-bayer.h ../libgemui/gemui.h
$(CC) $(CFLAGS) -o $@ $< $(LIBS) -ljpeg -lm $(CC) $(CFLAGS) -o $@ $< $(LIBS) -ljpeg -lm
geminux-net: geminux-net.c geminux-wifi-list.h geminux-bt-list.h ../libgemui/gemui.h geminux-net: geminux-net.c geminux-wifi-list.h geminux-bt-list.h ../geminux-daemons/geminux-dns-valid.h ../libgemui/gemui.h
$(CC) $(CFLAGS) -o $@ $< $(LIBS) $(CC) $(CFLAGS) -o $@ $< $(LIBS)
geminux-audio: geminux-audio.c geminux-audio-parse.h ../libgemui/gemui.h geminux-audio: geminux-audio.c geminux-audio-parse.h ../libgemui/gemui.h
+418 -60
View File
@@ -2,33 +2,43 @@
#include "gemui.h" #include "gemui.h"
#include "geminux-wifi-list.h" #include "geminux-wifi-list.h"
#include "geminux-bt-list.h" #include "geminux-bt-list.h"
#include "../geminux-daemons/geminux-dns-valid.h"
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <netdb.h>
#include <signal.h> #include <signal.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#define HIT_TAB 1 #define HIT_TAB 1
#define HIT_TOGGLE 2 #define HIT_TOGGLE 2
#define HIT_ACTION 3 #define HIT_ACTION 3
#define HIT_ROW 4 #define HIT_ROW 4
#define HIT_PSK 5 #define HIT_PSK 5
#define HIT_CONNECT 6 #define HIT_CONNECT 6
#define HIT_SHOW_PSK 7 #define HIT_SHOW_PSK 7
#define HIT_BT_CONN 8 #define HIT_BT_CONN 8
#define HIT_BT_DISC 9 #define HIT_BT_DISC 9
#define HIT_BT_REM 10 #define HIT_BT_REM 10
#define HIT_AUDIO 11 #define HIT_AUDIO 11
#define HIT_WIFI_DISC 12
#define HIT_DNS_CUSTOM 13
#define HIT_DNS_APPLY 14
enum { enum {
WORK_NONE = 0, WORK_NONE = 0,
WORK_WIFI_CONN, WORK_WIFI_CONN,
WORK_WIFI_SCAN, WORK_WIFI_SCAN,
WORK_WIFI_DISC,
WORK_DNS_APPLY,
WORK_DNS_TEST,
WORK_BT_PWR, WORK_BT_PWR,
WORK_BT_SCAN, WORK_BT_SCAN,
WORK_BT_CONN, WORK_BT_CONN,
@@ -37,19 +47,21 @@ enum {
}; };
typedef struct { typedef struct {
char col1[96]; char col1[128];
char col2[96]; char col2[96];
char col3[48]; char col3[48];
} net_row_t; } net_row_t;
typedef struct { typedef struct {
gemui_app_t *app; gemui_app_t *app;
int tab; /* 0=Wi-Fi, 1=Cellular/4G, 2=Bluetooth, 3=USB/HDMI */ int tab; /* 0=Wi-Fi, 1=DNS, 2=Cellular/4G, 3=Bluetooth, 4=USB/HDMI */
bool wifi_on; bool wifi_on;
bool wifi_connected;
bool cellular_on; bool cellular_on;
bool bt_on; bool bt_on;
bool bt_svc_up; bool bt_svc_up;
bool hdmi_on; bool hdmi_on;
int dns_mode;
net_row_t rows[32]; net_row_t rows[32];
geminux_wifi_group_t wifi_groups[GEMINUX_MAX_WIFI_GROUPS]; geminux_wifi_group_t wifi_groups[GEMINUX_MAX_WIFI_GROUPS];
geminux_bt_dev_t bt_devs[GEMINUX_MAX_BT_DEVS]; geminux_bt_dev_t bt_devs[GEMINUX_MAX_BT_DEVS];
@@ -58,7 +70,10 @@ typedef struct {
int scroll_off; int scroll_off;
char status_text[256]; char status_text[256];
char psk[128]; char psk[128];
char active_dns[128];
char custom_dns[192];
bool focus_psk; bool focus_psk;
bool focus_dns;
bool show_psk; bool show_psk;
pid_t worker_pid; pid_t worker_pid;
@@ -79,7 +94,7 @@ static uint64_t net_now_ms(void) {
static int net_visible_rows(const net_state_t *st) { static int net_visible_rows(const net_state_t *st) {
int h = st->app ? gemui_height(st->app) : 940; int h = st->app ? gemui_height(st->app) : 940;
int foot_h = (st->tab == 0 || st->tab == 2) ? 94 : 0; int foot_h = (st->tab == 0 || st->tab == 1 || st->tab == 3) ? 94 : 0;
int box_h = h - (92 + 82 + 88) - 20 - foot_h; int box_h = h - (92 + 82 + 88) - 20 - foot_h;
int vis = (box_h - 8) / 72; int vis = (box_h - 8) / 72;
return vis > 0 ? vis : 1; return vis > 0 ? vis : 1;
@@ -96,6 +111,11 @@ static void net_clamp_scroll(net_state_t *st) {
} }
} }
static void strip_eol(char *s) {
size_t n = strlen(s);
while (n > 0 && (s[n - 1] == '\n' || s[n - 1] == '\r')) s[--n] = '\0';
}
static void refresh_wifi(net_state_t *st, const char *prev_ssid) { static void refresh_wifi(net_state_t *st, const char *prev_ssid) {
static char out[16384]; static char out[16384];
out[0] = '\0'; out[0] = '\0';
@@ -104,29 +124,190 @@ static void refresh_wifi(net_state_t *st, const char *prev_ssid) {
st->wifi_on = strstr(out, "enabled") != NULL; st->wifi_on = strstr(out, "enabled") != NULL;
} }
/* Use cached BSS table so periodic UI redraws never vanish on slow HW rescans. */
out[0] = '\0'; out[0] = '\0';
const char *scan[] = {"nmcli", "-t", "-f", "IN-USE,BSSID,SSID,CHAN,SIGNAL,SECURITY", "dev", "wifi", "list", NULL}; const char *scan[] = {"nmcli", "-t", "-f", "IN-USE,BSSID,SSID,CHAN,SIGNAL,SECURITY",
if (gemui_run_cmd_timeout(scan, out, sizeof(out), 1200) == 0) { "dev", "wifi", "list", "--rescan", "no", NULL};
int ng = geminux_parse_wifi_scan(out, st->wifi_groups, GEMINUX_MAX_WIFI_GROUPS); int ng = 0;
st->num_rows = ng; if (gemui_run_cmd_timeout(scan, out, sizeof(out), 2000) == 0) {
for (int i = 0; i < ng; i++) { ng = geminux_parse_wifi_scan(out, st->wifi_groups, GEMINUX_MAX_WIFI_GROUPS);
const geminux_wifi_group_t *g = &st->wifi_groups[i]; }
net_row_t *r = &st->rows[i];
snprintf(r->col1, sizeof(r->col1), "%s%s", g->in_use ? "* " : "", g->ssid); char iw_out[1024] = {0};
if (g->ap_count > 1) { char iw_bssid[24] = {0};
snprintf(r->col2, sizeof(r->col2), "Mesh (%d) %d%%", g->ap_count, g->best_signal); char iw_ssid[96] = {0};
} else { int iw_chan = 0, iw_sig = 0;
snprintf(r->col2, sizeof(r->col2), "Signal %d%%", g->best_signal); const char *iw_cmd[] = {"iw", "dev", "wlan0", "link", NULL};
} bool iw_ok = (gemui_run_cmd_timeout(iw_cmd, iw_out, sizeof(iw_out), 700) == 0) &&
snprintf(r->col3, sizeof(r->col3), "%s", g->security); geminux_parse_iw_link(iw_out, iw_bssid, sizeof(iw_bssid),
if (prev_ssid[0] && strcmp(g->ssid, prev_ssid) == 0) { iw_ssid, sizeof(iw_ssid), &iw_chan, &iw_sig);
st->sel_row = i;
char dev_out[1024] = {0};
bool nm_conn = false;
char nm_con[96] = {0};
char ip4[48] = {0};
const char *dev_cmd[] = {"nmcli", "-t", "-f", "GENERAL.STATE,GENERAL.CONNECTION,IP4.ADDRESS",
"dev", "show", "wlan0", NULL};
if (gemui_run_cmd_timeout(dev_cmd, dev_out, sizeof(dev_out), 900) == 0) {
char *save = NULL;
for (char *ln = strtok_r(dev_out, "\n", &save); ln; ln = strtok_r(NULL, "\n", &save)) {
strip_eol(ln);
char *sep = strchr(ln, ':');
if (!sep) continue;
*sep = '\0';
const char *val = sep + 1;
if (strcmp(ln, "GENERAL.STATE") == 0) {
if (atoi(val) == 100) nm_conn = true;
} else if (strcmp(ln, "GENERAL.CONNECTION") == 0) {
if (val[0] && strcmp(val, "--") != 0) snprintf(nm_con, sizeof(nm_con), "%s", val);
} else if (strncmp(ln, "IP4.ADDRESS", 11) == 0) {
if (val[0] && !ip4[0]) {
snprintf(ip4, sizeof(ip4), "%s", val);
char *slash = strchr(ip4, '/');
if (slash) *slash = '\0';
}
} }
} }
} }
char active_ssid[96] = {0};
if (iw_ssid[0]) {
snprintf(active_ssid, sizeof(active_ssid), "%s", iw_ssid);
} else if (nm_conn && nm_con[0]) {
char nm_ssid[128] = {0};
const char *gs[] = {"nmcli", "-g", "802-11-wireless.ssid",
"connection", "show", "id", nm_con, NULL};
if (gemui_run_cmd_timeout(gs, nm_ssid, sizeof(nm_ssid), 800) == 0) {
strip_eol(nm_ssid);
if (nm_ssid[0]) snprintf(active_ssid, sizeof(active_ssid), "%s", nm_ssid);
}
if (!active_ssid[0]) snprintf(active_ssid, sizeof(active_ssid), "%s", nm_con);
}
char active_sec[48] = {0};
if ((iw_ok || nm_conn) && active_ssid[0]) {
for (int i = 0; i < ng; i++) {
if (strcmp(st->wifi_groups[i].ssid, active_ssid) == 0 &&
st->wifi_groups[i].security[0] &&
strcmp(st->wifi_groups[i].security, "--") != 0) {
snprintf(active_sec, sizeof(active_sec), "%s", st->wifi_groups[i].security);
break;
}
}
if (!active_sec[0] && nm_con[0]) {
char km[64] = {0};
const char *gk[] = {"nmcli", "-g", "802-11-wireless-security.key-mgmt",
"connection", "show", "id", nm_con, NULL};
if (gemui_run_cmd_timeout(gk, km, sizeof(km), 800) == 0) {
strip_eol(km);
if (strcmp(km, "wpa-psk") == 0) snprintf(active_sec, sizeof(active_sec), "WPA2");
else if (strcmp(km, "sae") == 0) snprintf(active_sec, sizeof(active_sec), "WPA3");
else if (!km[0]) snprintf(active_sec, sizeof(active_sec), "Open");
}
}
ng = geminux_merge_active_wifi(st->wifi_groups, ng, GEMINUX_MAX_WIFI_GROUPS,
active_ssid, iw_bssid, iw_chan, iw_sig, active_sec);
}
st->wifi_connected = ((iw_ok || nm_conn) && active_ssid[0] != '\0');
st->num_rows = ng;
for (int i = 0; i < ng; i++) {
const geminux_wifi_group_t *g = &st->wifi_groups[i];
net_row_t *r = &st->rows[i];
snprintf(r->col1, sizeof(r->col1), "%s%s", g->in_use ? "* " : "", g->ssid);
if (g->in_use) {
if (g->ap_count > 1) {
snprintf(r->col2, sizeof(r->col2), "Connected (%d) %d%%", g->ap_count, g->best_signal);
} else if (g->best_signal > 0) {
snprintf(r->col2, sizeof(r->col2), "Connected %d%%", g->best_signal);
} else {
snprintf(r->col2, sizeof(r->col2), "Connected");
}
} else if (g->ap_count > 1) {
snprintf(r->col2, sizeof(r->col2), "Mesh (%d) %d%%", g->ap_count, g->best_signal);
} else {
snprintf(r->col2, sizeof(r->col2), "Signal %d%%", g->best_signal);
}
snprintf(r->col3, sizeof(r->col3), "%s", g->security);
if (prev_ssid && prev_ssid[0] && strcmp(g->ssid, prev_ssid) == 0) {
st->sel_row = i;
} else if ((!prev_ssid || !prev_ssid[0]) && g->in_use && st->sel_row < 0) {
st->sel_row = i;
}
}
net_clamp_scroll(st); net_clamp_scroll(st);
snprintf(st->status_text, sizeof(st->status_text), "Wi-Fi %s (powersave=3)",
st->wifi_on ? "Enabled" : "Disabled"); if (st->wifi_connected) {
if (ip4[0]) {
snprintf(st->status_text, sizeof(st->status_text), "Connected: %s (%s)", active_ssid, ip4);
} else {
snprintf(st->status_text, sizeof(st->status_text), "Connected: %s", active_ssid);
}
} else {
snprintf(st->status_text, sizeof(st->status_text), "Wi-Fi %s (Not connected)",
st->wifi_on ? "Enabled" : "Disabled");
}
}
static void refresh_dns(net_state_t *st) {
int mode = GEMINUX_DNS_DEFAULT;
char saved_custom[192] = {0};
FILE *f = fopen("/etc/geminux/dns.conf", "r");
if (f) {
char line[256];
while (fgets(line, sizeof(line), f)) {
strip_eol(line);
if (strncmp(line, "mode=", 5) == 0) {
int m = geminux_dns_mode_index(line + 5);
if (m >= 0) mode = m;
} else if (strncmp(line, "custom=", 7) == 0) {
snprintf(saved_custom, sizeof(saved_custom), "%s", line + 7);
}
}
fclose(f);
}
st->dns_mode = mode;
if (!st->focus_dns && saved_custom[0]) {
snprintf(st->custom_dns, sizeof(st->custom_dns), "%s", saved_custom);
}
st->active_dns[0] = '\0';
FILE *rf = fopen("/etc/resolv.conf", "r");
if (rf) {
char rbuf[1024];
size_t nr = fread(rbuf, 1, sizeof(rbuf) - 1, rf);
rbuf[nr] = '\0';
fclose(rf);
geminux_parse_resolv_conf(rbuf, st->active_dns, sizeof(st->active_dns));
}
st->num_rows = GEMINUX_DNS_COUNT;
for (int i = 0; i < GEMINUX_DNS_COUNT; i++) {
const geminux_dns_preset_t *p = &GEMINUX_DNS_PRESETS[i];
net_row_t *r = &st->rows[i];
bool act = (i == mode);
if (i == GEMINUX_DNS_DEFAULT) {
snprintf(r->col1, sizeof(r->col1), "%s%s", act ? "* " : "", p->label);
snprintf(r->col2, sizeof(r->col2), "Automatic");
} else if (i == GEMINUX_DNS_CUSTOM) {
const char *shown = st->custom_dns[0] ? st->custom_dns
: (saved_custom[0] ? saved_custom : "Enter below...");
snprintf(r->col1, sizeof(r->col1), "%s%s: %.64s", act ? "* " : "", p->label, shown);
snprintf(r->col2, sizeof(r->col2), "Custom");
} else {
snprintf(r->col1, sizeof(r->col1), "%s%s (%s)", act ? "* " : "", p->label, p->v4_csv);
snprintf(r->col2, sizeof(r->col2), p->v6_csv[0] ? "IPv4 + IPv6" : "IPv4");
}
snprintf(r->col3, sizeof(r->col3), "%s", act ? "Active" : "Select");
}
if (st->focus_dns) st->sel_row = GEMINUX_DNS_CUSTOM;
else st->sel_row = mode;
net_clamp_scroll(st);
snprintf(st->status_text, sizeof(st->status_text), "DNS: %s | resolv.conf: %s",
GEMINUX_DNS_PRESETS[mode].label,
st->active_dns[0] ? st->active_dns : "none");
} }
static void refresh_bt(net_state_t *st, const char *prev_mac) { static void refresh_bt(net_state_t *st, const char *prev_mac) {
@@ -192,7 +373,7 @@ static void refresh_tab(net_state_t *st) {
char prev_key[96] = {0}; char prev_key[96] = {0};
if (st->tab == 0 && st->sel_row >= 0 && st->sel_row < st->num_rows) { if (st->tab == 0 && st->sel_row >= 0 && st->sel_row < st->num_rows) {
snprintf(prev_key, sizeof(prev_key), "%s", st->wifi_groups[st->sel_row].ssid); snprintf(prev_key, sizeof(prev_key), "%s", st->wifi_groups[st->sel_row].ssid);
} else if (st->tab == 2 && st->sel_row >= 0 && st->sel_row < st->num_rows) { } else if (st->tab == 3 && st->sel_row >= 0 && st->sel_row < st->num_rows) {
snprintf(prev_key, sizeof(prev_key), "%s", st->bt_devs[st->sel_row].mac); snprintf(prev_key, sizeof(prev_key), "%s", st->bt_devs[st->sel_row].mac);
} }
@@ -204,6 +385,8 @@ static void refresh_tab(net_state_t *st) {
if (st->tab == 0) { if (st->tab == 0) {
refresh_wifi(st, prev_key); refresh_wifi(st, prev_key);
} else if (st->tab == 1) { } else if (st->tab == 1) {
refresh_dns(st);
} else if (st->tab == 2) {
st->scroll_off = 0; st->scroll_off = 0;
gemui_unix_cmd("/run/geminux/ccci.sock", "status", out, sizeof(out)); gemui_unix_cmd("/run/geminux/ccci.sock", "status", out, sizeof(out));
st->cellular_on = strstr(out, "READY") != NULL; st->cellular_on = strstr(out, "READY") != NULL;
@@ -221,7 +404,7 @@ static void refresh_tab(net_state_t *st) {
st->num_rows++; st->num_rows++;
} }
} }
} else if (st->tab == 2) { } else if (st->tab == 3) {
refresh_bt(st, prev_key); refresh_bt(st, prev_key);
} else { } else {
st->scroll_off = 0; st->scroll_off = 0;
@@ -338,6 +521,22 @@ static void on_worker_fd(gemui_app_t *app, int fd, void *ud) {
} }
} else if (kind == WORK_WIFI_SCAN) { } else if (kind == WORK_WIFI_SCAN) {
gemui_show_toast(app, rc == 0 ? "Wi-Fi scan updated" : "Wi-Fi rescan failed", 1800); gemui_show_toast(app, rc == 0 ? "Wi-Fi scan updated" : "Wi-Fi rescan failed", 1800);
} else if (kind == WORK_WIFI_DISC) {
gemui_show_toast(app, rc == 0 ? "Disconnected Wi-Fi" : "Wi-Fi disconnect failed", 2000);
} else if (kind == WORK_DNS_APPLY) {
if (rc == 0) {
st->focus_dns = false;
gemui_show_toast(app, "DNS settings applied", 2200);
} else {
snprintf(toast, sizeof(toast), err[0] ? "DNS error: %.180s" : "Failed to apply DNS", err);
gemui_show_toast(app, toast, 3200);
}
} else if (kind == WORK_DNS_TEST) {
if (err[0]) {
gemui_show_toast(app, err, 3600);
} else {
gemui_show_toast(app, rc == 0 ? "DNS lookup succeeded" : "DNS lookup failed", 2600);
}
} else if (kind == WORK_BT_PWR) { } else if (kind == WORK_BT_PWR) {
if (rc == 0) gemui_show_toast(app, "Updated Bluetooth power", 1800); if (rc == 0) gemui_show_toast(app, "Updated Bluetooth power", 1800);
else { else {
@@ -375,7 +574,7 @@ static void on_worker_timer(gemui_app_t *app, void *ud) {
return; return;
} }
st->worker_tick++; st->worker_tick++;
if (st->worker_kind == WORK_BT_SCAN && (st->worker_tick % 4) == 0 && st->tab == 2) { if (st->worker_kind == WORK_BT_SCAN && (st->worker_tick % 4) == 0 && st->tab == 3) {
char prev_mac[24] = {0}; char prev_mac[24] = {0};
if (st->sel_row >= 0 && st->sel_row < st->num_rows) { if (st->sel_row >= 0 && st->sel_row < st->num_rows) {
snprintf(prev_mac, sizeof(prev_mac), "%s", st->bt_devs[st->sel_row].mac); snprintf(prev_mac, sizeof(prev_mac), "%s", st->bt_devs[st->sel_row].mac);
@@ -467,8 +666,7 @@ static void wifi_delete_ssid_profiles(const char *ssid) {
char p_ssid[128] = {0}; char p_ssid[128] = {0};
const char *get_ssid[] = {"nmcli", "-g", "802-11-wireless.ssid", "connection", "show", "uuid", uuid, NULL}; const char *get_ssid[] = {"nmcli", "-g", "802-11-wireless.ssid", "connection", "show", "uuid", uuid, NULL};
if (gemui_run_cmd_timeout(get_ssid, p_ssid, sizeof(p_ssid), 1200) == 0) { if (gemui_run_cmd_timeout(get_ssid, p_ssid, sizeof(p_ssid), 1200) == 0) {
size_t n = strlen(p_ssid); strip_eol(p_ssid);
while (n > 0 && (p_ssid[n - 1] == '\n' || p_ssid[n - 1] == '\r')) p_ssid[--n] = '\0';
if (strcmp(p_ssid, ssid) == 0) { if (strcmp(p_ssid, ssid) == 0) {
const char *del_u[] = {"nmcli", "connection", "delete", "uuid", uuid, NULL}; const char *del_u[] = {"nmcli", "connection", "delete", "uuid", uuid, NULL};
gemui_run_cmd_timeout(del_u, NULL, 0, 5000); gemui_run_cmd_timeout(del_u, NULL, 0, 5000);
@@ -531,7 +729,10 @@ static int child_wifi_connect(void *ctx) {
rc = gemui_run_cmd_timeout(up, out, sizeof(out), 22000); rc = gemui_run_cmd_timeout(up, out, sizeof(out), 22000);
} }
} }
if (rc != 0 && out[0]) { if (rc == 0) {
const char *dns_apply[] = {"doas", "/usr/sbin/geminux-dnsctl", "apply", NULL};
gemui_run_cmd_timeout(dns_apply, NULL, 0, 5000);
} else if (out[0]) {
fputs(out, stdout); fputs(out, stdout);
} }
return rc; return rc;
@@ -546,6 +747,58 @@ static int child_wifi_rescan(void *ctx) {
return rc; return rc;
} }
static int child_wifi_disconnect(void *ctx) {
(void)ctx;
char out[256] = {0};
const char *argv[] = {"nmcli", "device", "disconnect", "wlan0", NULL};
int rc = gemui_run_cmd_timeout(argv, out, sizeof(out), 8000);
if (rc != 0 && out[0]) fputs(out, stdout);
return rc;
}
typedef struct {
int mode;
char custom[192];
} dns_job_t;
static int child_dns_apply(void *ctx) {
dns_job_t *j = ctx;
char out[256] = {0};
const char *mode_str = GEMINUX_DNS_PRESETS[j->mode].mode;
const char *argv_custom[] = {"doas", "/usr/sbin/geminux-dnsctl", "set", mode_str, j->custom, NULL};
const char *argv_preset[] = {"doas", "/usr/sbin/geminux-dnsctl", "set", mode_str, NULL};
int rc = gemui_run_cmd_timeout((j->mode == GEMINUX_DNS_CUSTOM) ? argv_custom : argv_preset,
out, sizeof(out), 8000);
if (rc != 0 && out[0]) fputs(out, stdout);
return rc;
}
static int child_dns_test(void *ctx) {
(void)ctx;
struct timespec t0, t1;
clock_gettime(CLOCK_MONOTONIC, &t0);
struct addrinfo hints;
memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
struct addrinfo *res = NULL;
int rc = getaddrinfo("dl-cdn.alpinelinux.org", NULL, &hints, &res);
clock_gettime(CLOCK_MONOTONIC, &t1);
long ms = (long)((t1.tv_sec - t0.tv_sec) * 1000L + (t1.tv_nsec - t0.tv_nsec) / 1000000L);
if (rc != 0 || !res) {
printf("DNS failed (%ld ms): %s\n", ms, gai_strerror(rc));
return 1;
}
char host[64] = {0};
getnameinfo(res->ai_addr, res->ai_addrlen, host, sizeof(host), NULL, 0, NI_NUMERICHOST);
freeaddrinfo(res);
printf("DNS OK: alpinelinux -> %s (%ld ms)\n", host[0] ? host : "resolved", ms);
return 0;
}
typedef struct { typedef struct {
char mac[24]; char mac[24];
bool enable; bool enable;
@@ -668,6 +921,50 @@ static void connect_selected_wifi(net_state_t *st) {
memset(&job, 0, sizeof(job)); memset(&job, 0, sizeof(job));
} }
static void disconnect_wifi(net_state_t *st) {
if (!st->wifi_connected) {
gemui_show_toast(st->app, "Wi-Fi is not connected", 1600);
return;
}
start_worker(st, WORK_WIFI_DISC, "Disconnecting Wi-Fi...", 10000, child_wifi_disconnect, NULL);
}
static void apply_dns_mode(net_state_t *st, int mode) {
if (mode < 0 || mode >= GEMINUX_DNS_COUNT) {
gemui_show_toast(st->app, "Select a DNS profile first", 1600);
return;
}
dns_job_t job;
memset(&job, 0, sizeof(job));
job.mode = mode;
if (mode == GEMINUX_DNS_CUSTOM) {
char v4[GEMINUX_DNS_MAX_SERVERS][16];
char v6[GEMINUX_DNS_MAX_SERVERS][46];
int n4 = 0, n6 = 0;
char norm[192] = {0};
if (geminux_parse_dns_servers(st->custom_dns, v4, &n4, GEMINUX_DNS_MAX_SERVERS,
v6, &n6, GEMINUX_DNS_MAX_SERVERS,
norm, sizeof(norm)) <= 0) {
gemui_show_toast(st->app, "Enter valid comma/space IPv4 or IPv6 nameservers", 2600);
st->focus_dns = true;
st->sel_row = GEMINUX_DNS_CUSTOM;
gemui_request_redraw(st->app);
return;
}
snprintf(st->custom_dns, sizeof(st->custom_dns), "%s", norm);
snprintf(job.custom, sizeof(job.custom), "%s", norm);
}
start_worker(st, WORK_DNS_APPLY, "Applying DNS configuration...", 10000, child_dns_apply, &job);
}
static void apply_selected_dns(net_state_t *st) {
int mode = st->focus_dns ? GEMINUX_DNS_CUSTOM : st->sel_row;
apply_dns_mode(st, mode);
}
static void start_bt_dev_action(net_state_t *st, int kind) { static void start_bt_dev_action(net_state_t *st, int kind) {
if (st->sel_row < 0 || st->sel_row >= st->num_rows) { if (st->sel_row < 0 || st->sel_row >= st->num_rows) {
gemui_show_toast(st->app, "Select a Bluetooth device first", 1600); gemui_show_toast(st->app, "Select a Bluetooth device first", 1600);
@@ -701,9 +998,9 @@ static void on_draw(gemui_app_t *app, cairo_t *cr, int w, int h, void *ud) {
int pad = 20; int pad = 20;
int top = 92; int top = 92;
int tab_w = (w - pad * 2 - 3 * 12) / 4; int tab_w = (w - pad * 2 - 4 * 12) / 5;
static const char *tabs[4] = {"Wi-Fi", "4G / CCCI", "Bluetooth", "USB & HDMI"}; static const char *tabs[5] = {"Wi-Fi", "DNS", "4G / CCCI", "Bluetooth", "USB & HDMI"};
for (int i = 0; i < 4; i++) { for (int i = 0; i < 5; i++) {
gemui_draw_button(app, cr, (gemui_rect_t){pad + i * (tab_w + 12), top, tab_w, 66}, gemui_draw_button(app, cr, (gemui_rect_t){pad + i * (tab_w + 12), top, tab_w, 66},
tabs[i], HIT_TAB, i, false, st->tab == i, false); tabs[i], HIT_TAB, i, false, st->tab == i, false);
} }
@@ -717,31 +1014,38 @@ static void on_draw(gemui_app_t *app, cairo_t *cr, int w, int h, void *ud) {
gemui_draw_button(app, cr, (gemui_rect_t){pad + ctrl_w + 12, cy, ctrl_w, 72}, gemui_draw_button(app, cr, (gemui_rect_t){pad + ctrl_w + 12, cy, ctrl_w, 72},
act_lbl, HIT_ACTION, 0, st->worker_pid == 0, st->worker_pid > 0, false); act_lbl, HIT_ACTION, 0, st->worker_pid == 0, st->worker_pid > 0, false);
} else if (st->tab == 1) { } else if (st->tab == 1) {
gemui_draw_toggle(app, cr, (gemui_rect_t){pad, cy, ctrl_w, 72}, gemui_draw_button(app, cr, (gemui_rect_t){pad, cy, ctrl_w, 72},
"MT6797 Modem Active", st->cellular_on, HIT_TOGGLE, 1, false); "Reset to Router DNS", HIT_TOGGLE, 1,
false, st->dns_mode == GEMINUX_DNS_DEFAULT, false);
const char *dns_act = (st->worker_pid > 0) ? "Cancel Operation" : "Test DNS Lookup";
gemui_draw_button(app, cr, (gemui_rect_t){pad + ctrl_w + 12, cy, ctrl_w, 72}, gemui_draw_button(app, cr, (gemui_rect_t){pad + ctrl_w + 12, cy, ctrl_w, 72},
"Reset CCCI Modem", HIT_ACTION, 1, false, false, false); dns_act, HIT_ACTION, 1, st->worker_pid == 0, st->worker_pid > 0, false);
} else if (st->tab == 2) { } else if (st->tab == 2) {
gemui_draw_toggle(app, cr, (gemui_rect_t){pad, cy, ctrl_w, 72}, gemui_draw_toggle(app, cr, (gemui_rect_t){pad, cy, ctrl_w, 72},
"Bluetooth Radio", st->bt_on, HIT_TOGGLE, 2, false); "MT6797 Modem Active", st->cellular_on, HIT_TOGGLE, 2, false);
gemui_draw_button(app, cr, (gemui_rect_t){pad + ctrl_w + 12, cy, ctrl_w, 72},
"Reset CCCI Modem", HIT_ACTION, 2, false, false, false);
} else if (st->tab == 3) {
gemui_draw_toggle(app, cr, (gemui_rect_t){pad, cy, ctrl_w, 72},
"Bluetooth Radio", st->bt_on, HIT_TOGGLE, 3, false);
const char *bt_lbl = (st->worker_kind == WORK_BT_SCAN) ? "Stop Scan" const char *bt_lbl = (st->worker_kind == WORK_BT_SCAN) ? "Stop Scan"
: (st->worker_pid > 0) ? "Cancel Operation" : "Scan 12s"; : (st->worker_pid > 0) ? "Cancel Operation" : "Scan 12s";
gemui_draw_button(app, cr, (gemui_rect_t){pad + ctrl_w + 12, cy, ctrl_w, 72}, gemui_draw_button(app, cr, (gemui_rect_t){pad + ctrl_w + 12, cy, ctrl_w, 72},
bt_lbl, HIT_ACTION, 2, st->worker_pid == 0, st->worker_pid > 0, false); bt_lbl, HIT_ACTION, 3, st->worker_pid == 0, st->worker_pid > 0, false);
} else { } else {
gemui_draw_toggle(app, cr, (gemui_rect_t){pad, cy, ctrl_w, 72}, gemui_draw_toggle(app, cr, (gemui_rect_t){pad, cy, ctrl_w, 72},
"SiI9024 HDMI Extend", st->hdmi_on, HIT_TOGGLE, 3, false); "SiI9024 HDMI Extend", st->hdmi_on, HIT_TOGGLE, 4, false);
gemui_draw_button(app, cr, (gemui_rect_t){pad + ctrl_w + 12, cy, ctrl_w, 72}, gemui_draw_button(app, cr, (gemui_rect_t){pad + ctrl_w + 12, cy, ctrl_w, 72},
"Mirror Primary Display", HIT_ACTION, 3, true, false, false); "Mirror Primary Display", HIT_ACTION, 4, true, false, false);
} }
int foot_h = (st->tab == 0 || st->tab == 2) ? 94 : 0; int foot_h = (st->tab == 0 || st->tab == 1 || st->tab == 3) ? 94 : 0;
gemui_rect_t box = {pad, cy + 88, w - pad * 2, h - (cy + 88) - pad - foot_h}; gemui_rect_t box = {pad, cy + 88, w - pad * 2, h - (cy + 88) - pad - foot_h};
gemui_fill_round(cr, box, 12, t->bg_bar); gemui_fill_round(cr, box, 12, t->bg_bar);
gemui_stroke_round(cr, box, 12, 1.5, t->border); gemui_stroke_round(cr, box, 12, 1.5, t->border);
if (st->num_rows == 0) { if (st->num_rows == 0) {
const char *empty_msg = (st->tab == 2 && st->bt_svc_up) const char *empty_msg = (st->tab == 3 && st->bt_svc_up)
? "No Bluetooth devices found — press Scan 12s" ? "No Bluetooth devices found — press Scan 12s"
: "No interfaces or scan results available"; : "No interfaces or scan results available";
gemui_draw_text(cr, t, box, empty_msg, 0, false, GEMUI_ALIGN_CENTER, t->fg_muted); gemui_draw_text(cr, t, box, empty_msg, 0, false, GEMUI_ALIGN_CENTER, t->fg_muted);
@@ -767,18 +1071,29 @@ static void on_draw(gemui_app_t *app, cairo_t *cr, int w, int h, void *ud) {
} }
if (st->tab == 0) { if (st->tab == 0) {
int cw = 260; int cw = 250;
int sw = 200; int dw = 210;
int iw = w - pad * 2 - cw - sw - 24; int sw = 180;
int iw = w - pad * 2 - cw - dw - sw - 36;
gemui_draw_input(app, cr, (gemui_rect_t){pad, h - 92, iw, 72}, gemui_draw_input(app, cr, (gemui_rect_t){pad, h - 92, iw, 72},
"Wi-Fi passphrase (if connecting to secured SSID)...", "Wi-Fi passphrase (if connecting to secured SSID)...",
st->psk, !st->show_psk, st->focus_psk, HIT_PSK, 0); st->psk, !st->show_psk, st->focus_psk, HIT_PSK, 0);
gemui_draw_button(app, cr, (gemui_rect_t){pad + iw + 12, h - 92, sw, 72}, gemui_draw_button(app, cr, (gemui_rect_t){pad + iw + 12, h - 92, sw, 72},
st->show_psk ? "Hide PW" : "Show PW", HIT_SHOW_PSK, 0, st->show_psk ? "Hide PW" : "Show PW", HIT_SHOW_PSK, 0,
false, st->show_psk, false); false, st->show_psk, false);
gemui_draw_button(app, cr, (gemui_rect_t){pad + iw + sw + 24, h - 92, dw, 72},
"Disconnect", HIT_WIFI_DISC, 0, false, false, false);
gemui_draw_button(app, cr, (gemui_rect_t){w - pad - cw, h - 92, cw, 72}, gemui_draw_button(app, cr, (gemui_rect_t){w - pad - cw, h - 92, cw, 72},
"Connect Wi-Fi", HIT_CONNECT, 0, true, false, false); "Connect Wi-Fi", HIT_CONNECT, 0, true, false, false);
} else if (st->tab == 2) { } else if (st->tab == 1) {
int aw = 290;
int iw = w - pad * 2 - aw - 12;
gemui_draw_input(app, cr, (gemui_rect_t){pad, h - 92, iw, 72},
"Custom nameservers (e.g. 88.198.92.222, 1.1.1.1)...",
st->custom_dns, false, st->focus_dns, HIT_DNS_CUSTOM, 0);
gemui_draw_button(app, cr, (gemui_rect_t){w - pad - aw, h - 92, aw, 72},
"Apply DNS Profile", HIT_DNS_APPLY, 0, true, false, false);
} else if (st->tab == 3) {
int bw = (w - pad * 2 - 3 * 12) / 4; int bw = (w - pad * 2 - 3 * 12) / 4;
gemui_draw_button(app, cr, (gemui_rect_t){pad, h - 92, bw, 72}, gemui_draw_button(app, cr, (gemui_rect_t){pad, h - 92, bw, 72},
"Pair & Connect", HIT_BT_CONN, 0, true, false, false); "Pair & Connect", HIT_BT_CONN, 0, true, false, false);
@@ -796,29 +1111,43 @@ static void on_key(gemui_app_t *app, KeySym ks, unsigned int state, const char *
if (ks == XK_Escape) { if (ks == XK_Escape) {
gemui_quit(app, 0); gemui_quit(app, 0);
} else if (ks == XK_Tab) { } else if (ks == XK_Tab) {
st->tab = (st->tab + 1) % 4; st->tab = (st->tab + 1) % 5;
st->focus_psk = false; st->focus_psk = false;
st->focus_dns = false;
refresh_tab(st); refresh_tab(st);
gemui_request_redraw(app); gemui_request_redraw(app);
} else if (ks == XK_Up && st->num_rows > 0) { } else if (ks == XK_Up && st->num_rows > 0) {
st->sel_row = (st->sel_row > 0) ? st->sel_row - 1 : 0; st->sel_row = (st->sel_row > 0) ? st->sel_row - 1 : 0;
if (st->tab == 1) st->focus_dns = (st->sel_row == GEMINUX_DNS_CUSTOM);
net_clamp_scroll(st); net_clamp_scroll(st);
gemui_request_redraw(app); gemui_request_redraw(app);
} else if (ks == XK_Down && st->num_rows > 0) { } else if (ks == XK_Down && st->num_rows > 0) {
st->sel_row = (st->sel_row + 1 < st->num_rows) ? st->sel_row + 1 : st->num_rows - 1; st->sel_row = (st->sel_row + 1 < st->num_rows) ? st->sel_row + 1 : st->num_rows - 1;
if (st->tab == 1) st->focus_dns = (st->sel_row == GEMINUX_DNS_CUSTOM);
net_clamp_scroll(st); net_clamp_scroll(st);
gemui_request_redraw(app); gemui_request_redraw(app);
} else if (ks == XK_Return || ks == XK_KP_Enter) { } else if (ks == XK_Return || ks == XK_KP_Enter) {
if (st->tab == 0) connect_selected_wifi(st); if (st->tab == 0) connect_selected_wifi(st);
else if (st->tab == 2) start_bt_dev_action(st, WORK_BT_CONN); else if (st->tab == 1) apply_selected_dns(st);
else if (st->tab == 3) start_bt_dev_action(st, WORK_BT_CONN);
} else if ((ks == XK_BackSpace || ks == XK_Delete) && st->tab == 0 && (st->focus_psk || st->sel_row >= 0)) { } else if ((ks == XK_BackSpace || ks == XK_Delete) && st->tab == 0 && (st->focus_psk || st->sel_row >= 0)) {
st->focus_psk = true; st->focus_psk = true;
gemui_utf8_pop_char(st->psk); gemui_utf8_pop_char(st->psk);
gemui_request_redraw(app); gemui_request_redraw(app);
} else if ((ks == XK_BackSpace || ks == XK_Delete) && st->tab == 1 && (st->focus_dns || st->sel_row == GEMINUX_DNS_CUSTOM)) {
st->focus_dns = true;
st->sel_row = GEMINUX_DNS_CUSTOM;
gemui_utf8_pop_char(st->custom_dns);
gemui_request_redraw(app);
} else if ((state & ControlMask) && (ks == XK_u || ks == XK_U) && st->tab == 0) { } else if ((state & ControlMask) && (ks == XK_u || ks == XK_U) && st->tab == 0) {
st->focus_psk = true; st->focus_psk = true;
memset(st->psk, 0, sizeof(st->psk)); memset(st->psk, 0, sizeof(st->psk));
gemui_request_redraw(app); gemui_request_redraw(app);
} else if ((state & ControlMask) && (ks == XK_u || ks == XK_U) && st->tab == 1) {
st->focus_dns = true;
st->sel_row = GEMINUX_DNS_CUSTOM;
memset(st->custom_dns, 0, sizeof(st->custom_dns));
gemui_request_redraw(app);
} else if (st->tab == 0 && (st->focus_psk || st->sel_row >= 0) && utf8 && utf8[0]) { } else if (st->tab == 0 && (st->focus_psk || st->sel_row >= 0) && utf8 && utf8[0]) {
st->focus_psk = true; st->focus_psk = true;
size_t cur = strlen(st->psk), add = strlen(utf8); size_t cur = strlen(st->psk), add = strlen(utf8);
@@ -826,6 +1155,14 @@ static void on_key(gemui_app_t *app, KeySym ks, unsigned int state, const char *
memcpy(st->psk + cur, utf8, add + 1); memcpy(st->psk + cur, utf8, add + 1);
gemui_request_redraw(app); gemui_request_redraw(app);
} }
} else if (st->tab == 1 && (st->focus_dns || st->sel_row == GEMINUX_DNS_CUSTOM) && utf8 && utf8[0]) {
st->focus_dns = true;
st->sel_row = GEMINUX_DNS_CUSTOM;
size_t cur = strlen(st->custom_dns), add = strlen(utf8);
if (cur + add < sizeof(st->custom_dns)) {
memcpy(st->custom_dns + cur, utf8, add + 1);
gemui_request_redraw(app);
}
} }
} }
@@ -852,18 +1189,29 @@ static void on_ptr(gemui_app_t *app, int type, int x, int y, unsigned int btn, v
if (hit->id == HIT_TAB) { if (hit->id == HIT_TAB) {
st->tab = hit->val; st->tab = hit->val;
st->focus_psk = false; st->focus_psk = false;
st->focus_dns = false;
refresh_tab(st); refresh_tab(st);
} else if (hit->id == HIT_ROW) { } else if (hit->id == HIT_ROW) {
st->sel_row = hit->val; st->sel_row = hit->val;
if (st->tab == 0) st->focus_psk = true; if (st->tab == 0) st->focus_psk = true;
else if (st->tab == 1) st->focus_dns = (hit->val == GEMINUX_DNS_CUSTOM);
} else if (hit->id == HIT_PSK) { } else if (hit->id == HIT_PSK) {
st->focus_psk = true; st->focus_psk = true;
} else if (hit->id == HIT_SHOW_PSK) { } else if (hit->id == HIT_SHOW_PSK) {
st->show_psk = !st->show_psk; st->show_psk = !st->show_psk;
st->focus_psk = true; st->focus_psk = true;
} else if (hit->id == HIT_WIFI_DISC) {
disconnect_wifi(st);
return;
} else if (hit->id == HIT_CONNECT) { } else if (hit->id == HIT_CONNECT) {
connect_selected_wifi(st); connect_selected_wifi(st);
return; return;
} else if (hit->id == HIT_DNS_CUSTOM) {
st->focus_dns = true;
st->sel_row = GEMINUX_DNS_CUSTOM;
} else if (hit->id == HIT_DNS_APPLY) {
apply_selected_dns(st);
return;
} else if (hit->id == HIT_BT_CONN) { } else if (hit->id == HIT_BT_CONN) {
start_bt_dev_action(st, WORK_BT_CONN); start_bt_dev_action(st, WORK_BT_CONN);
return; return;
@@ -883,10 +1231,13 @@ static void on_ptr(gemui_app_t *app, int type, int x, int y, unsigned int btn, v
gemui_run_cmd_timeout(argv, NULL, 0, 2000); gemui_run_cmd_timeout(argv, NULL, 0, 2000);
refresh_tab(st); refresh_tab(st);
} else if (hit->val == 1) { } else if (hit->val == 1) {
apply_dns_mode(st, GEMINUX_DNS_DEFAULT);
return;
} else if (hit->val == 2) {
gemui_unix_cmd("/run/geminux/ccci.sock", gemui_unix_cmd("/run/geminux/ccci.sock",
st->cellular_on ? "flight on" : "flight off", NULL, 0); st->cellular_on ? "flight on" : "flight off", NULL, 0);
refresh_tab(st); refresh_tab(st);
} else if (hit->val == 2) { } else if (hit->val == 3) {
bt_job_t job; bt_job_t job;
memset(&job, 0, sizeof(job)); memset(&job, 0, sizeof(job));
job.enable = !st->bt_on; job.enable = !st->bt_on;
@@ -894,7 +1245,7 @@ static void on_ptr(gemui_app_t *app, int type, int x, int y, unsigned int btn, v
job.enable ? "Enabling Bluetooth..." : "Disabling Bluetooth...", job.enable ? "Enabling Bluetooth..." : "Disabling Bluetooth...",
10000, child_bt_power, &job); 10000, child_bt_power, &job);
return; return;
} else if (hit->val == 3) { } else if (hit->val == 4) {
const char *argv[] = {"xrandr", "--output", "HDMI-1", st->hdmi_on ? "--off" : "--auto", NULL}; const char *argv[] = {"xrandr", "--output", "HDMI-1", st->hdmi_on ? "--off" : "--auto", NULL};
gemui_run_cmd_timeout(argv, NULL, 0, 2000); gemui_run_cmd_timeout(argv, NULL, 0, 2000);
st->hdmi_on = !st->hdmi_on; st->hdmi_on = !st->hdmi_on;
@@ -909,17 +1260,24 @@ static void on_ptr(gemui_app_t *app, int type, int x, int y, unsigned int btn, v
} }
return; return;
} else if (hit->val == 1) { } else if (hit->val == 1) {
if (st->worker_pid > 0) {
cancel_worker(st, "Cancelled operation");
} else {
start_worker(st, WORK_DNS_TEST, "Testing DNS lookup...", 8000, child_dns_test, NULL);
}
return;
} else if (hit->val == 2) {
gemui_unix_cmd("/run/geminux/ccci.sock", "reset", NULL, 0); gemui_unix_cmd("/run/geminux/ccci.sock", "reset", NULL, 0);
gemui_show_toast(app, "Sent CCCI reset request", 1600); gemui_show_toast(app, "Sent CCCI reset request", 1600);
refresh_tab(st); refresh_tab(st);
} else if (hit->val == 2) { } else if (hit->val == 3) {
if (st->worker_pid > 0) { if (st->worker_pid > 0) {
cancel_worker(st, st->worker_kind == WORK_BT_SCAN ? "Bluetooth scan stopped" : "Cancelled"); cancel_worker(st, st->worker_kind == WORK_BT_SCAN ? "Bluetooth scan stopped" : "Cancelled");
} else { } else {
start_worker(st, WORK_BT_SCAN, "Scanning Bluetooth (12s)...", 15000, child_bt_scan, NULL); start_worker(st, WORK_BT_SCAN, "Scanning Bluetooth (12s)...", 15000, child_bt_scan, NULL);
} }
return; return;
} else if (hit->val == 3) { } else if (hit->val == 4) {
const char *argv[] = {"xrandr", "--output", "HDMI-1", "--same-as", "DSI-1", NULL}; const char *argv[] = {"xrandr", "--output", "HDMI-1", "--same-as", "DSI-1", NULL};
gemui_run_cmd_timeout(argv, NULL, 0, 2000); gemui_run_cmd_timeout(argv, NULL, 0, 2000);
refresh_tab(st); refresh_tab(st);
+118
View File
@@ -141,4 +141,122 @@ static inline int geminux_parse_wifi_scan(const char *nmcli_out,
return n; return n;
} }
static inline int geminux_wifi_freq_to_chan(int mhz) {
if (mhz == 2484) return 14;
if (mhz >= 2412 && mhz <= 2472) return (mhz - 2407) / 5;
if (mhz >= 5000 && mhz <= 5895) return (mhz - 5000) / 5;
return 0;
}
static inline bool geminux_parse_iw_link(const char *iw_out,
char *bssid, size_t bssid_sz,
char *ssid, size_t ssid_sz,
int *chan_out, int *sig_pct_out) {
if (bssid && bssid_sz > 0) bssid[0] = '\0';
if (ssid && ssid_sz > 0) ssid[0] = '\0';
if (chan_out) *chan_out = 0;
if (sig_pct_out) *sig_pct_out = 0;
if (!iw_out || !iw_out[0]) return false;
bool connected = false;
const char *cur = iw_out;
while (*cur) {
const char *nl = strchr(cur, '\n');
size_t raw_len = nl ? (size_t)(nl - cur) : strlen(cur);
char ln[256];
size_t l = raw_len < sizeof(ln) - 1 ? raw_len : sizeof(ln) - 1;
memcpy(ln, cur, l);
ln[l] = '\0';
cur = nl ? nl + 1 : cur + raw_len;
while (l > 0 && ln[l - 1] == '\r') ln[--l] = '\0';
const char *p = ln;
while (*p == ' ' || *p == '\t') p++;
if (strncmp(p, "Not connected", 13) == 0) return false;
if (strncmp(p, "Connected to ", 13) == 0) {
connected = true;
p += 13;
if (bssid && bssid_sz > 0) {
size_t i = 0;
while (p[i] && p[i] != ' ' && p[i] != '\t' && i + 1 < bssid_sz) {
bssid[i] = p[i];
i++;
}
bssid[i] = '\0';
}
} else if (strncmp(p, "SSID: ", 6) == 0) {
if (ssid && ssid_sz > 0) snprintf(ssid, ssid_sz, "%s", p + 6);
} else if (strncmp(p, "freq: ", 6) == 0) {
int ch = geminux_wifi_freq_to_chan(atoi(p + 6));
if (chan_out && ch > 0) *chan_out = ch;
} else if (strncmp(p, "signal: ", 8) == 0) {
int dbm = atoi(p + 8);
int pct = 2 * (dbm + 100);
if (pct < 5) pct = 5;
if (pct > 100) pct = 100;
if (sig_pct_out) *sig_pct_out = pct;
}
}
return connected;
}
static inline int geminux_merge_active_wifi(geminux_wifi_group_t *groups,
int count,
int max_groups,
const char *active_ssid,
const char *active_bssid,
int active_chan,
int active_signal,
const char *active_security) {
if (!groups || max_groups <= 0) return 0;
if (count < 0) count = 0;
if (count > max_groups) count = max_groups;
if (!active_ssid || !active_ssid[0]) return count;
int idx = -1;
for (int i = 0; i < count; i++) {
if (strcmp(groups[i].ssid, active_ssid) == 0) {
groups[i].in_use = true;
idx = i;
} else {
groups[i].in_use = false;
}
}
if (idx >= 0) {
geminux_wifi_group_t *g = &groups[idx];
if (g->best_signal <= 0 && active_signal > 0) g->best_signal = active_signal;
if (g->best_chan <= 0 && active_chan > 0) {
g->best_chan = active_chan;
g->best_joinable = geminux_wifi_chan_joinable(active_chan);
}
if (!g->best_bssid[0] && active_bssid && active_bssid[0]) {
snprintf(g->best_bssid, sizeof(g->best_bssid), "%s", active_bssid);
}
if ((!g->security[0] || strcmp(g->security, "--") == 0) &&
active_security && active_security[0]) {
snprintf(g->security, sizeof(g->security), "%s", active_security);
}
} else {
int pos = (count < max_groups) ? count++ : max_groups - 1;
geminux_wifi_group_t *g = &groups[pos];
memset(g, 0, sizeof(*g));
snprintf(g->ssid, sizeof(g->ssid), "%s", active_ssid);
if (active_bssid && active_bssid[0]) {
snprintf(g->best_bssid, sizeof(g->best_bssid), "%s", active_bssid);
}
snprintf(g->security, sizeof(g->security), "%s",
(active_security && active_security[0]) ? active_security : "Connected");
g->best_signal = (active_signal > 0) ? active_signal : 0;
g->best_chan = active_chan;
g->best_joinable = geminux_wifi_chan_joinable(active_chan);
g->ap_count = 1;
g->in_use = true;
}
if (count > 1) qsort(groups, (size_t)count, sizeof(groups[0]), geminux_wifi_group_cmp);
return count;
}
#endif /* GEMINUX_WIFI_LIST_H */ #endif /* GEMINUX_WIFI_LIST_H */
+6 -2
View File
@@ -24,7 +24,8 @@ BINS = \
geminux-power-audit \ geminux-power-audit \
geminux-checkpw \ geminux-checkpw \
geminux-wifi-nvram \ geminux-wifi-nvram \
geminux-tzctl geminux-tzctl \
geminux-dnsctl
all: $(BINS) all: $(BINS)
@@ -61,6 +62,9 @@ geminux-checkpw: geminux-checkpw.c
geminux-tzctl: geminux-tzctl.c geminux-tz-valid.h geminux-tzctl: geminux-tzctl.c geminux-tz-valid.h
$(CC) $(CFLAGS) -o $@ geminux-tzctl.c $(CC) $(CFLAGS) -o $@ geminux-tzctl.c
geminux-dnsctl: geminux-dnsctl.c geminux-dns-valid.h
$(CC) $(CFLAGS) -o $@ geminux-dnsctl.c
geminux-wifi-nvram: geminux-wifi-nvram.c geminux-wifi-nvram-core.c geminux-wifi-nvram-core.h geminux-wifi-nvram: geminux-wifi-nvram.c geminux-wifi-nvram-core.c geminux-wifi-nvram-core.h
$(CC) $(CFLAGS) -o $@ geminux-wifi-nvram.c geminux-wifi-nvram-core.c $(CC) $(CFLAGS) -o $@ geminux-wifi-nvram.c geminux-wifi-nvram-core.c
@@ -69,7 +73,7 @@ install: all
cp -f geminux-power-ctl geminux-statusd geminux-touchd geminux-modem-ctl \ cp -f geminux-power-ctl geminux-statusd geminux-touchd geminux-modem-ctl \
geminux-bt-obex geminux-power-audit $(DESTDIR)$(PREFIX)/bin/ geminux-bt-obex geminux-power-audit $(DESTDIR)$(PREFIX)/bin/
cp -f geminux-powerd geminux-ccci-daemon geminux-leds \ cp -f geminux-powerd geminux-ccci-daemon geminux-leds \
geminux-checkpw geminux-wifi-nvram geminux-tzctl $(DESTDIR)$(PREFIX)/sbin/ geminux-checkpw geminux-wifi-nvram geminux-tzctl geminux-dnsctl $(DESTDIR)$(PREFIX)/sbin/
chmod 0755 $(DESTDIR)$(PREFIX)/bin/geminux-* $(DESTDIR)$(PREFIX)/sbin/geminux-* chmod 0755 $(DESTDIR)$(PREFIX)/bin/geminux-* $(DESTDIR)$(PREFIX)/sbin/geminux-*
clean: clean:
+213
View File
@@ -0,0 +1,213 @@
/*
* Header-only C11 helpers for validating DNS resolver presets and custom nameservers.
*/
#ifndef GEMINUX_DNS_VALID_H
#define GEMINUX_DNS_VALID_H
#include <arpa/inet.h>
#include <netinet/in.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#define GEMINUX_DNS_DEFAULT 0
#define GEMINUX_DNS_CLOUDFLARE 1
#define GEMINUX_DNS_GOOGLE 2
#define GEMINUX_DNS_RADICAL 3
#define GEMINUX_DNS_QUAD9 4
#define GEMINUX_DNS_CUSTOM 5
#define GEMINUX_DNS_COUNT 6
#define GEMINUX_DNS_MAX_SERVERS 6
typedef struct {
const char *mode;
const char *label;
const char *v4_csv;
const char *v6_csv;
} geminux_dns_preset_t;
static const geminux_dns_preset_t GEMINUX_DNS_PRESETS[GEMINUX_DNS_COUNT] = {
{"default", "Default (Router / DHCP)", "", ""},
{"cloudflare", "Cloudflare DNS", "1.1.1.1,1.0.0.1", "2606:4700:4700::1111"},
{"google", "Google Public DNS", "8.8.8.8,8.8.4.4", "2001:4860:4860::8888"},
{"radicaldns", "RadicalDNS", "88.198.92.222,192.71.166.92", "2a01:4f8:1c0c:82c0::1"},
{"quad9", "Quad9 (Filtered)", "9.9.9.9,149.112.112.112", "2620:fe::fe"},
{"custom", "Custom Nameservers", "", ""},
};
static inline int geminux_dns_mode_index(const char *mode) {
if (!mode || !mode[0]) return -1;
for (int i = 0; i < GEMINUX_DNS_COUNT; i++) {
if (strcmp(mode, GEMINUX_DNS_PRESETS[i].mode) == 0) return i;
}
return -1;
}
static inline bool geminux_dns_mode_valid(const char *mode) {
return geminux_dns_mode_index(mode) >= 0;
}
static inline bool geminux_dns_token_chars_ok(const char *tok) {
if (!tok || !tok[0]) return false;
for (const unsigned char *p = (const unsigned char *)tok; *p; p++) {
bool ok = (*p >= '0' && *p <= '9') ||
(*p >= 'a' && *p <= 'f') ||
(*p >= 'A' && *p <= 'F') ||
*p == '.' || *p == ':';
if (!ok) return false;
}
return true;
}
static inline bool geminux_dns_v4_valid(const struct in_addr *a) {
uint32_t ip = ntohl(a->s_addr);
if (ip == 0x00000000U || ip == 0xffffffffU) return false;
if ((ip >> 24) == 0U) return false; /* 0.0.0.0/8 unspecified */
if ((ip & 0xf0000000U) == 0xe0000000U) return false; /* 224.0.0.0/4 multicast */
return true;
}
static inline bool geminux_dns_v6_valid(const struct in6_addr *a) {
static const uint8_t z[16] = {0};
if (memcmp(a->s6_addr, z, 16) == 0) return false; /* :: unspecified */
if (a->s6_addr[0] == 0xff) return false; /* ff00::/8 multicast */
return true;
}
/*
* Parse comma/whitespace-separated IPv4/IPv6 DNS addresses into separate IPv4 and IPv6
* arrays plus a canonical comma-separated list ordered IPv4-first (for musl's MAXNS=3
* resolver reliability). Returns total server count (1..GEMINUX_DNS_MAX_SERVERS), or -1 on error.
*/
static inline int geminux_parse_dns_servers(const char *raw,
char v4[][16], int *n_v4, int max_v4,
char v6[][46], int *n_v6, int max_v6,
char *norm_csv, size_t norm_sz) {
int c4 = 0, c6 = 0;
char loc_v4[GEMINUX_DNS_MAX_SERVERS][16];
char loc_v6[GEMINUX_DNS_MAX_SERVERS][46];
if (n_v4) *n_v4 = 0;
if (n_v6) *n_v6 = 0;
if (norm_csv && norm_sz > 0) norm_csv[0] = '\0';
if (!raw || !raw[0]) return -1;
const char *p = raw;
while (*p) {
while (*p == ',' || *p == ' ' || *p == '\t' || *p == '\r' || *p == '\n') p++;
if (!*p) break;
const char *start = p;
while (*p && *p != ',' && *p != ' ' && *p != '\t' && *p != '\r' && *p != '\n') p++;
size_t len = (size_t)(p - start);
if (len == 0 || len >= 46) return -1;
char tok[48];
memcpy(tok, start, len);
tok[len] = '\0';
if (!geminux_dns_token_chars_ok(tok)) return -1;
struct in_addr a4;
struct in6_addr a6;
if (inet_pton(AF_INET, tok, &a4) == 1) {
if (!geminux_dns_v4_valid(&a4)) return -1;
char canon[16];
if (!inet_ntop(AF_INET, &a4, canon, sizeof(canon))) return -1;
bool dup = false;
for (int i = 0; i < c4; i++) {
if (strcmp(loc_v4[i], canon) == 0) {
dup = true;
break;
}
}
if (!dup) {
if (c4 + c6 >= GEMINUX_DNS_MAX_SERVERS) return -1;
snprintf(loc_v4[c4], sizeof(loc_v4[c4]), "%s", canon);
if (v4 && c4 < max_v4) snprintf(v4[c4], 16, "%s", canon);
c4++;
}
} else if (inet_pton(AF_INET6, tok, &a6) == 1) {
if (!geminux_dns_v6_valid(&a6)) return -1;
char canon[46];
if (!inet_ntop(AF_INET6, &a6, canon, sizeof(canon))) return -1;
bool dup = false;
for (int i = 0; i < c6; i++) {
if (strcmp(loc_v6[i], canon) == 0) {
dup = true;
break;
}
}
if (!dup) {
if (c4 + c6 >= GEMINUX_DNS_MAX_SERVERS) return -1;
snprintf(loc_v6[c6], sizeof(loc_v6[c6]), "%s", canon);
if (v6 && c6 < max_v6) snprintf(v6[c6], 46, "%s", canon);
c6++;
}
} else {
return -1;
}
}
int total = c4 + c6;
if (total <= 0) return -1;
if (n_v4) *n_v4 = c4;
if (n_v6) *n_v6 = c6;
if (norm_csv && norm_sz > 0) {
size_t pos = 0;
for (int i = 0; i < c4; i++) {
int w = snprintf(norm_csv + pos, norm_sz - pos, "%s%s", pos ? "," : "", loc_v4[i]);
if (w < 0 || (size_t)w >= norm_sz - pos) return -1;
pos += (size_t)w;
}
for (int i = 0; i < c6; i++) {
int w = snprintf(norm_csv + pos, norm_sz - pos, "%s%s", pos ? "," : "", loc_v6[i]);
if (w < 0 || (size_t)w >= norm_sz - pos) return -1;
pos += (size_t)w;
}
}
return total;
}
static inline int geminux_parse_resolv_conf(const char *text, char *summary, size_t summary_sz) {
if (summary && summary_sz > 0) summary[0] = '\0';
if (!text || !text[0]) return 0;
int count = 0;
size_t pos = 0;
const char *cur = text;
while (*cur && count < 3) {
const char *nl = strchr(cur, '\n');
size_t raw_len = nl ? (size_t)(nl - cur) : strlen(cur);
char ln[256];
size_t cp = raw_len < sizeof(ln) - 1 ? raw_len : sizeof(ln) - 1;
memcpy(ln, cur, cp);
ln[cp] = '\0';
cur = nl ? nl + 1 : cur + raw_len;
char *p = ln;
while (*p == ' ' || *p == '\t') p++;
if (strncmp(p, "nameserver", 10) != 0) continue;
p += 10;
if (*p != ' ' && *p != '\t') continue;
while (*p == ' ' || *p == '\t') p++;
char *end = p;
while (*end && *end != ' ' && *end != '\t' && *end != '\r' && *end != '#') end++;
*end = '\0';
if (!geminux_dns_token_chars_ok(p)) continue;
struct in_addr a4;
struct in6_addr a6;
if (inet_pton(AF_INET, p, &a4) != 1 && inet_pton(AF_INET6, p, &a6) != 1) continue;
if (summary && pos + 2 < summary_sz) {
int w = snprintf(summary + pos, summary_sz - pos, "%s%s", count ? ", " : "", p);
if (w > 0 && (size_t)w < summary_sz - pos) pos += (size_t)w;
}
count++;
}
return count;
}
#endif /* GEMINUX_DNS_VALID_H */
+384
View File
@@ -0,0 +1,384 @@
#define _POSIX_C_SOURCE 200809L
#include "geminux-dns-valid.h"
#include <errno.h>
#include <fcntl.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <unistd.h>
#define GEMINUX_DNS_CONF_DIR "/etc/geminux"
#define GEMINUX_DNS_CONF_PATH "/etc/geminux/dns.conf"
#define GEMINUX_NM_DNS_DROPIN "/etc/NetworkManager/conf.d/30-geminux-dns.conf"
static int run_argv(const char *const argv[], char *out, size_t out_sz, bool quiet) {
int pfd[2] = {-1, -1};
if (out && out_sz > 0) {
out[0] = '\0';
if (pipe(pfd) < 0) return -1;
}
pid_t pid = fork();
if (pid < 0) {
if (pfd[0] >= 0) {
close(pfd[0]);
close(pfd[1]);
}
return -1;
}
if (pid == 0) {
if (pfd[1] >= 0) {
close(pfd[0]);
dup2(pfd[1], STDOUT_FILENO);
if (pfd[1] > 2) close(pfd[1]);
}
if (quiet || pfd[1] >= 0) {
int devnull = open("/dev/null", O_RDWR);
if (devnull >= 0) {
if (quiet && pfd[1] < 0) dup2(devnull, STDOUT_FILENO);
if (quiet) dup2(devnull, STDERR_FILENO);
if (devnull > 2) close(devnull);
}
}
execvp(argv[0], (char *const *)argv);
_exit(127);
}
if (pfd[1] >= 0) close(pfd[1]);
if (pfd[0] >= 0) {
size_t pos = 0;
while (pos + 1 < out_sz) {
ssize_t n = read(pfd[0], out + pos, out_sz - 1 - pos);
if (n > 0) pos += (size_t)n;
else if (n < 0 && errno == EINTR) continue;
else break;
}
out[pos] = '\0';
close(pfd[0]);
}
int status = 0;
while (waitpid(pid, &status, 0) < 0) {
if (errno != EINTR) return -1;
}
if (WIFEXITED(status)) return WEXITSTATUS(status);
return 1;
}
static int write_file_atomic(const char *path, const char *content, mode_t mode) {
char tmp[512];
snprintf(tmp, sizeof(tmp), "%s.tmp", path);
int fd = open(tmp, O_WRONLY | O_CREAT | O_TRUNC, mode);
if (fd < 0) return -1;
size_t len = strlen(content);
size_t off = 0;
while (off < len) {
ssize_t w = write(fd, content + off, len - off);
if (w < 0) {
if (errno == EINTR) continue;
close(fd);
unlink(tmp);
return -1;
}
off += (size_t)w;
}
close(fd);
chmod(tmp, mode);
if (rename(tmp, path) != 0) {
unlink(tmp);
return -1;
}
return 0;
}
static void read_saved_conf(char *mode_out, size_t mode_sz,
char *custom_out, size_t custom_sz) {
snprintf(mode_out, mode_sz, "default");
custom_out[0] = '\0';
FILE *f = fopen(GEMINUX_DNS_CONF_PATH, "r");
if (!f) return;
char line[256];
while (fgets(line, sizeof(line), f)) {
size_t n = strlen(line);
while (n > 0 && (line[n - 1] == '\n' || line[n - 1] == '\r')) line[--n] = '\0';
if (strncmp(line, "mode=", 5) == 0 && geminux_dns_mode_valid(line + 5)) {
snprintf(mode_out, mode_sz, "%s", line + 5);
} else if (strncmp(line, "custom=", 7) == 0) {
snprintf(custom_out, custom_sz, "%s", line + 7);
}
}
fclose(f);
}
static bool ipv6_default_route_present(void) {
FILE *f = fopen("/proc/net/ipv6_route", "r");
if (!f) return false;
char line[512];
bool found = false;
while (fgets(line, sizeof(line), f)) {
char dst[64], plen[16], src[64], splen[16], nh[64];
unsigned int metric, refcnt, use, flags;
char iface[32];
if (sscanf(line, "%63s %15s %63s %15s %63s %x %x %x %x %31s",
dst, plen, src, splen, nh, &metric, &refcnt, &use, &flags, iface) == 10) {
if (strcmp(dst, "00000000000000000000000000000000") == 0 &&
strcmp(plen, "00") == 0 &&
strcmp(iface, "lo") != 0 &&
(flags & 1U)) {
found = true;
break;
}
}
}
fclose(f);
return found;
}
static void join_space(char *dst, size_t dst_sz, char arr[][16], int n) {
dst[0] = '\0';
size_t pos = 0;
for (int i = 0; i < n; i++) {
int w = snprintf(dst + pos, dst_sz - pos, "%s%s", i ? " " : "", arr[i]);
if (w > 0 && (size_t)w < dst_sz - pos) pos += (size_t)w;
}
}
static void join_space_v6(char *dst, size_t dst_sz, char arr[][46], int n) {
dst[0] = '\0';
size_t pos = 0;
for (int i = 0; i < n; i++) {
int w = snprintf(dst + pos, dst_sz - pos, "%s%s", i ? " " : "", arr[i]);
if (w > 0 && (size_t)w < dst_sz - pos) pos += (size_t)w;
}
}
static bool nm_type_managed_dns(const char *type) {
return strcmp(type, "802-11-wireless") == 0 ||
strcmp(type, "gsm") == 0 ||
strcmp(type, "802-3-ethernet") == 0;
}
static void update_nm_profiles(const char *v4_space, const char *v6_space, bool reset_default) {
char list[8192];
const char *show[] = {"nmcli", "-t", "-f", "UUID,TYPE", "connection", "show", NULL};
if (run_argv(show, list, sizeof(list), true) != 0) return;
char *save = NULL;
for (char *ln = strtok_r(list, "\n", &save); ln; ln = strtok_r(NULL, "\n", &save)) {
char *sep = strchr(ln, ':');
if (!sep) continue;
*sep = '\0';
const char *uuid = ln;
const char *type = sep + 1;
if (!uuid[0] || !nm_type_managed_dns(type)) continue;
if (reset_default) {
const char *mod[] = {
"nmcli", "connection", "modify", "uuid", uuid,
"ipv4.dns", "", "ipv4.ignore-auto-dns", "no",
"ipv6.dns", "", "ipv6.ignore-auto-dns", "no", NULL
};
run_argv(mod, NULL, 0, true);
} else {
const char *mod[] = {
"nmcli", "connection", "modify", "uuid", uuid,
"ipv4.dns", v4_space ? v4_space : "",
"ipv4.ignore-auto-dns", "yes",
"ipv6.dns", v6_space ? v6_space : "",
"ipv6.ignore-auto-dns", "yes", NULL
};
run_argv(mod, NULL, 0, true);
}
}
}
static void write_resolv_fallback(char v4[][16], int n_v4, char v6[][46], int n_v6, bool use_v6) {
char buf[512];
size_t pos = 0;
int written = 0;
int w = snprintf(buf + pos, sizeof(buf) - pos, "# Managed by geminux-dnsctl\n");
if (w > 0 && (size_t)w < sizeof(buf) - pos) pos += (size_t)w;
for (int i = 0; i < n_v4 && written < 3; i++) {
w = snprintf(buf + pos, sizeof(buf) - pos, "nameserver %s\n", v4[i]);
if (w > 0 && (size_t)w < sizeof(buf) - pos) pos += (size_t)w;
written++;
}
if (use_v6) {
for (int i = 0; i < n_v6 && written < 3; i++) {
w = snprintf(buf + pos, sizeof(buf) - pos, "nameserver %s\n", v6[i]);
if (w > 0 && (size_t)w < sizeof(buf) - pos) pos += (size_t)w;
written++;
}
}
w = snprintf(buf + pos, sizeof(buf) - pos, "options timeout:2 attempts:2\n");
if (w > 0 && (size_t)w < sizeof(buf) - pos) pos += (size_t)w;
write_file_atomic("/etc/resolv.conf", buf, 0644);
}
static bool resolv_has_first_expected(const char *expected_first) {
if (!expected_first || !expected_first[0]) return false;
FILE *f = fopen("/etc/resolv.conf", "r");
if (!f) return false;
char line[256];
bool found = false;
while (fgets(line, sizeof(line), f)) {
char ns[64];
if (sscanf(line, "nameserver %63s", ns) == 1) {
if (strcmp(ns, expected_first) == 0) found = true;
break;
}
}
fclose(f);
return found;
}
static int apply_dns(const char *mode, const char *custom_arg, bool save_conf) {
int idx = geminux_dns_mode_index(mode);
if (idx < 0) {
fprintf(stderr, "geminux-dnsctl: invalid DNS mode '%s'\n", mode ? mode : "");
return 1;
}
char prev_mode[32], prev_custom[256];
read_saved_conf(prev_mode, sizeof(prev_mode), prev_custom, sizeof(prev_custom));
char saved_custom[256];
snprintf(saved_custom, sizeof(saved_custom), "%s", prev_custom);
if (idx == GEMINUX_DNS_DEFAULT) {
unlink(GEMINUX_NM_DNS_DROPIN);
if (save_conf) {
mkdir(GEMINUX_DNS_CONF_DIR, 0755);
char cfg[384];
snprintf(cfg, sizeof(cfg), "mode=default\ncustom=%s\n", saved_custom);
if (write_file_atomic(GEMINUX_DNS_CONF_PATH, cfg, 0644) != 0) {
perror("geminux-dnsctl: write dns.conf");
return 1;
}
}
update_nm_profiles("", "", true);
const char *rel[] = {"nmcli", "general", "reload", NULL};
run_argv(rel, NULL, 0, true);
const char *reapp[] = {"nmcli", "device", "reapply", "wlan0", NULL};
run_argv(reapp, NULL, 0, true);
return 0;
}
const char *raw_servers = NULL;
char combined_preset[192];
if (idx == GEMINUX_DNS_CUSTOM) {
raw_servers = (custom_arg && custom_arg[0]) ? custom_arg : prev_custom;
} else {
const geminux_dns_preset_t *p = &GEMINUX_DNS_PRESETS[idx];
if (p->v6_csv[0]) {
snprintf(combined_preset, sizeof(combined_preset), "%s,%s", p->v4_csv, p->v6_csv);
raw_servers = combined_preset;
} else {
raw_servers = p->v4_csv;
}
}
char v4[GEMINUX_DNS_MAX_SERVERS][16];
char v6[GEMINUX_DNS_MAX_SERVERS][46];
int n_v4 = 0, n_v6 = 0;
char norm_csv[256];
if (geminux_parse_dns_servers(raw_servers, v4, &n_v4, GEMINUX_DNS_MAX_SERVERS,
v6, &n_v6, GEMINUX_DNS_MAX_SERVERS,
norm_csv, sizeof(norm_csv)) <= 0) {
fprintf(stderr, "geminux-dnsctl: invalid nameserver list '%s'\n",
raw_servers ? raw_servers : "");
return 1;
}
if (idx == GEMINUX_DNS_CUSTOM) {
snprintf(saved_custom, sizeof(saved_custom), "%s", norm_csv);
}
bool has_v6_route = ipv6_default_route_present();
bool include_v6_global = (idx == GEMINUX_DNS_CUSTOM) ? (n_v6 > 0 && (n_v4 == 0 || has_v6_route))
: (n_v6 > 0 && has_v6_route);
char global_servers[256] = {0};
size_t gpos = 0;
for (int i = 0; i < n_v4; i++) {
int w = snprintf(global_servers + gpos, sizeof(global_servers) - gpos,
"%s%s", gpos ? "," : "", v4[i]);
if (w > 0 && (size_t)w < sizeof(global_servers) - gpos) gpos += (size_t)w;
}
if (include_v6_global) {
for (int i = 0; i < n_v6; i++) {
int w = snprintf(global_servers + gpos, sizeof(global_servers) - gpos,
"%s%s", gpos ? "," : "", v6[i]);
if (w > 0 && (size_t)w < sizeof(global_servers) - gpos) gpos += (size_t)w;
}
}
if (save_conf) {
mkdir(GEMINUX_DNS_CONF_DIR, 0755);
char cfg[384];
snprintf(cfg, sizeof(cfg), "mode=%s\ncustom=%s\n", mode, saved_custom);
if (write_file_atomic(GEMINUX_DNS_CONF_PATH, cfg, 0644) != 0) {
perror("geminux-dnsctl: write dns.conf");
return 1;
}
}
mkdir("/etc/NetworkManager", 0755);
mkdir("/etc/NetworkManager/conf.d", 0755);
char dropin[512];
snprintf(dropin, sizeof(dropin),
"# Managed by geminux-dnsctl\n"
"[main]\n"
"dns=default\n\n"
"[global-dns]\n"
"options=timeout:2,attempts:2\n\n"
"[global-dns-domain-*]\n"
"servers=%s\n",
global_servers);
if (write_file_atomic(GEMINUX_NM_DNS_DROPIN, dropin, 0644) != 0) {
perror("geminux-dnsctl: write NM dropin");
return 1;
}
char v4_space[128], v6_space[256];
join_space(v4_space, sizeof(v4_space), v4, n_v4);
join_space_v6(v6_space, sizeof(v6_space), v6, include_v6_global ? n_v6 : 0);
update_nm_profiles(v4_space, v6_space, false);
const char *rel[] = {"nmcli", "general", "reload", NULL};
run_argv(rel, NULL, 0, true);
const char *reapp[] = {"nmcli", "device", "reapply", "wlan0", NULL};
run_argv(reapp, NULL, 0, true);
const char *first_expected = (n_v4 > 0) ? v4[0] : (n_v6 > 0 ? v6[0] : "");
if (first_expected[0] && !resolv_has_first_expected(first_expected)) {
write_resolv_fallback(v4, n_v4, v6, n_v6, include_v6_global);
}
return 0;
}
int main(int argc, char **argv) {
if (argc >= 3 && strcmp(argv[1], "set") == 0) {
const char *mode = argv[2];
const char *custom = (argc >= 4) ? argv[3] : "";
if (argc > 4) {
fprintf(stderr, "Usage: %s <set MODE [SERVERS] | apply>\n", argv[0]);
return 1;
}
return apply_dns(mode, custom, true);
}
if (argc == 2 && strcmp(argv[1], "apply") == 0) {
char mode[32], custom[256];
read_saved_conf(mode, sizeof(mode), custom, sizeof(custom));
if (strcmp(mode, "default") == 0) return 0;
return apply_dns(mode, custom, false);
}
fprintf(stderr, "Usage: %s <set MODE [SERVERS] | apply>\n", argv[0]);
return 1;
}
+33
View File
@@ -66,6 +66,8 @@ struct gemui_app {
char toast_msg[256]; char toast_msg[256];
uint64_t toast_until_ms; uint64_t toast_until_ms;
bool ptr_down; bool ptr_down;
Window prev_focus_win;
int prev_focus_revert;
}; };
static int g_sig_pipe[2] = {-1, -1}; static int g_sig_pipe[2] = {-1, -1};
@@ -302,6 +304,33 @@ static void gemui_ensure_backbuf(gemui_app_t *app) {
app->bh = app->h; app->bh = app->h;
} }
static int gemui_ignore_xerror(Display *dpy, XErrorEvent *ev) {
(void)dpy;
(void)ev;
return 0;
}
static void gemui_save_prev_focus(gemui_app_t *app) {
if (!app || app->prev_focus_win != None) return;
Window cur = None;
int rev = RevertToPointerRoot;
XGetInputFocus(app->dpy, &cur, &rev);
if (cur != None && cur != app->win) {
app->prev_focus_win = cur;
app->prev_focus_revert = rev;
}
}
static void gemui_restore_prev_focus(gemui_app_t *app) {
if (!app || app->prev_focus_win == None || app->prev_focus_win == app->win) return;
XSync(app->dpy, False);
int (*old_handler)(Display *, XErrorEvent *) = XSetErrorHandler(gemui_ignore_xerror);
XSetInputFocus(app->dpy, app->prev_focus_win, app->prev_focus_revert, CurrentTime);
XSync(app->dpy, False);
XSetErrorHandler(old_handler);
app->prev_focus_win = None;
}
gemui_app_t *gemui_create(const char *res_name, const char *title, gemui_app_t *gemui_create(const char *res_name, const char *title,
int w, int h, bool fullscreen_override) { int w, int h, bool fullscreen_override) {
setlocale(LC_CTYPE, ""); setlocale(LC_CTYPE, "");
@@ -386,6 +415,7 @@ gemui_app_t *gemui_create(const char *res_name, const char *title,
XMapRaised(dpy, app->win); XMapRaised(dpy, app->win);
if (fullscreen_override) { if (fullscreen_override) {
XMoveResizeWindow(dpy, app->win, 0, 0, (unsigned int)sw, (unsigned int)sh); XMoveResizeWindow(dpy, app->win, 0, 0, (unsigned int)sw, (unsigned int)sh);
gemui_save_prev_focus(app);
XSetInputFocus(dpy, app->win, RevertToPointerRoot, CurrentTime); XSetInputFocus(dpy, app->win, RevertToPointerRoot, CurrentTime);
} }
XFlush(dpy); XFlush(dpy);
@@ -395,6 +425,7 @@ gemui_app_t *gemui_create(const char *res_name, const char *title,
void gemui_destroy(gemui_app_t *app) { void gemui_destroy(gemui_app_t *app) {
if (!app) return; if (!app) return;
gemui_restore_prev_focus(app);
if (app->xic) XDestroyIC(app->xic); if (app->xic) XDestroyIC(app->xic);
if (app->xim) XCloseIM(app->xim); if (app->xim) XCloseIM(app->xim);
if (app->backbuf) XFreePixmap(app->dpy, app->backbuf); if (app->backbuf) XFreePixmap(app->dpy, app->backbuf);
@@ -492,6 +523,7 @@ bool gemui_grab_input(gemui_app_t *app) {
XGrabPointer(app->dpy, app->win, True, XGrabPointer(app->dpy, app->win, True,
ButtonPressMask | ButtonReleaseMask | PointerMotionMask, ButtonPressMask | ButtonReleaseMask | PointerMotionMask,
GrabModeAsync, GrabModeAsync, app->win, None, CurrentTime); GrabModeAsync, GrabModeAsync, app->win, None, CurrentTime);
gemui_save_prev_focus(app);
XSetInputFocus(app->dpy, app->win, RevertToPointerRoot, CurrentTime); XSetInputFocus(app->dpy, app->win, RevertToPointerRoot, CurrentTime);
XFlush(app->dpy); XFlush(app->dpy);
return ok_kbd; return ok_kbd;
@@ -501,6 +533,7 @@ void gemui_ungrab_input(gemui_app_t *app) {
if (!app) return; if (!app) return;
XUngrabKeyboard(app->dpy, CurrentTime); XUngrabKeyboard(app->dpy, CurrentTime);
XUngrabPointer(app->dpy, CurrentTime); XUngrabPointer(app->dpy, CurrentTime);
gemui_restore_prev_focus(app);
XFlush(app->dpy); XFlush(app->dpy);
} }
+2
View File
@@ -1901,6 +1901,7 @@ focus(XEvent *ev)
xseturgency(0); xseturgency(0);
if (IS_SET(MODE_FOCUS)) if (IS_SET(MODE_FOCUS))
ttywrite("\033[I", 3, 0); ttywrite("\033[I", 3, 0);
redraw();
} else { } else {
xshowpointer(); xshowpointer();
if (xw.ime.xic) if (xw.ime.xic)
@@ -1910,6 +1911,7 @@ focus(XEvent *ev)
win.mode &= ~MODE_FOCUSED; win.mode &= ~MODE_FOCUSED;
if (IS_SET(MODE_FOCUS)) if (IS_SET(MODE_FOCUS))
ttywrite("\033[O", 3, 0); ttywrite("\033[O", 3, 0);
redraw();
} }
} }
File diff suppressed because it is too large. Load diff