From cf1544eb0c17ffeca5504962d1150962fb2c1824 Mon Sep 17 00:00:00 2001 From: Luxferre Date: Thu, 26 Nov 2026 17:10:08 +0200 Subject: [PATCH] Keep dunst, libgemui dialogs, and anode-vkbd on Fira Code --- README.md | 4 ++-- docs/ARCHITECTURE.md | 4 ++-- scripts/anode-sync-dunst-theme | 31 +------------------------------ src/apps/anode-themes.c | 4 ++-- src/apps/anode-vkbd.c | 3 --- src/libgemui/gemui.c | 33 +++++---------------------------- src/libgemui/gemui.h | 3 --- tests/test_theme_scale.py | 7 +++---- tests/test_x11_xvfb.py | 2 +- 9 files changed, 16 insertions(+), 75 deletions(-) diff --git a/README.md b/README.md index dad4b2a..02b8aae 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,8 @@ ANODE is a lightweight, keyboard-first, cross-Unix X11 desktop environment for * - **dmenu (`5.3-anode`)**: Pango/HarfBuzz rendering, fuzzy matching, touch/pointer navigation, XFixes/XI2 pointer auto-hiding, dynamic `.Xresources` & fractional scale sizing (`-l 0` full-height row fill and exact `-l N` row height), and `anode-launcher` XDG + Flatpak desktop entry integration (`--list`, symlinks, `[Desktop Action ...]` sub-entries, localization, `TryExec`, `Path=`, `Terminal=`, and `DBusActivatable=`). - **st (`0.9.2-anode`)**: HarfBuzz programming ligatures (`Fira Code`, defaulting to `size=13` scaled via live `Xft.dpi`), dirty-cell rendering cache, focus-gated cursor blink, explicit `St.font` override precedence with `~/.config/anode/Xresources.local`, `SIGUSR1` live reload, and portable Linux/BSD PTY handling. - **Unified `.xth` theme & fractional DPI scaling engine**: - - 22 normalized 96-DPI `.xth` themes (`data/themes/*.xth`) pairing `Fira Code` monospace (`theme.fontFace`) with `Roboto` non-monospace UI typography (`theme.uiFontFace`, automatically falling back to `Noto Sans` when `Roboto` is unavailable). - - `anode-apply-scale` & `anode-apply-theme` treat `scale.conf` as authoritative over stale session environment variables and synchronize `.Xresources`, `xrdb`, `dwm`, `dmenu`, `st` (`Fira Code` monospace), `libgemui`, `anode-vkbd`, `dunst` (`scale = 1` + `Roboto`/`Noto Sans` pixel font sizing), GTK-2, GTK-3, GTK-4 / `libadwaita` (built-in Adwaita/Default `resource:///...` inheritance with color-only overrides and dark/light auto-detection), `xsettingsd` (with discrete Xcursor size tiers), Fontconfig `60-anode-fonts.conf` (`sans-serif` -> `Roboto`/`Noto Sans`, `monospace` -> `Fira Code`), `gsettings`, Qt5 & Qt6 (`QT_QPA_PLATFORMTHEME=gtk3:qt6ct:qt5ct` following GTK-3 with synced `qt5ct`/`qt6ct` `general=` UI / `fixed=` monospace fonts & palettes), Kvantum, and Tk (`gtkTtk`) without double-scaling. + - 22 normalized 96-DPI `.xth` themes (`data/themes/*.xth`) pairing `Fira Code` monospace (`theme.fontFace` for ANODE-native components and third-party monospace slots) with `Roboto` non-monospace UI typography (`theme.uiFontFace` for third-party toolkits, automatically falling back to `Noto Sans` when `Roboto` is unavailable). + - `anode-apply-scale` & `anode-apply-theme` treat `scale.conf` as authoritative over stale session environment variables and synchronize `.Xresources`, `xrdb`, `dwm`, `dmenu`, `st`, `libgemui` dialogs, `anode-vkbd`, `dunst` (`scale = 1` + `Fira Code` pixel font sizing) — keeping ANODE-native components on `Fira Code` — alongside third-party toolkits using `Roboto` / `Noto Sans` UI fonts and `Fira Code` monospace slots: GTK-2, GTK-3, GTK-4 / `libadwaita` (built-in Adwaita/Default `resource:///...` inheritance with color-only overrides and dark/light auto-detection), `xsettingsd` (with discrete Xcursor size tiers), Fontconfig `60-anode-fonts.conf` (`sans-serif` -> `Roboto`/`Noto Sans`, `monospace` -> `Fira Code`), `gsettings`, Qt5 & Qt6 (`QT_QPA_PLATFORMTHEME=gtk3:qt6ct:qt5ct` following GTK-3 with synced `qt5ct`/`qt6ct` `general=` UI / `fixed=` monospace fonts & palettes), Kvantum, and Tk (`gtkTtk`) without double-scaling. - **GemUI toolkit (`libgemui`) & desktop utilities**: - `anode-net`: Wi-Fi (`nmcli` / `wpa_cli` / BSD `ifconfig`), POSIX `getifaddrs` interfaces, Bluetooth (`bluetoothctl`), and DNS presets/custom nameservers (`anode-dnsctl`). - `anode-audio`: PipeWire (`wpctl`), PulseAudio (`pactl`), ALSA (`amixer`), OpenBSD `sndioctl`, and OSS audio mixer & profile/stream control. diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index 662bc3d..532b317 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -5,7 +5,7 @@ - `Makefile` & `scripts/detect-env.sh`: Strict `.POSIX:` single build orchestration probing OS headers, `-lcrypt` vs ``, `-lrt`, `-lutil`, `XScrnSaver`, and optional `gtk+-2.0`/`tcl`/`tk` headers cleanly into `build/flags.sh`. - `src/common/`: Cross-Unix platform layer (`anode_plat.c`, `anode_plat.h`), `.Xresources` / EDID fractional scale helpers (`anode_scale.h`), CPU/memory parsers (`anode_sys_parse.h`), input validators (`anode_dns_valid.h`, `anode_tz_valid.h`), XKB layout parser (`anode_xkb_parse.h`), CLI output parsers (`anode_audio_parse.h`, `anode_wifi_list.h`, `anode_bt_list.h`), and power policy (`anode_power_policy.h`). - `src/dwm/`, `src/dmenu/`, `src/st/`: Patched suckless X11 core using Pango/HarfBuzz (`Fira Code` ligatures), vector 3-bar hamburger launcher button in `dwm`, full-height `-l 0` mode in `dmenu`, `St.font` + live `Xft.dpi` Fontconfig resolution in `st`, `.Xresources` + `SIGUSR1` live reload, `anode_scale.h`, ICCCM `WM_S` `--replace` handoff (`exit 75` when yielded so `anode-session` holds the session), and `ANODE WM` EWMH identity. -- `src/libgemui/`: Shared library `libgemui.so` + `gemui.pc` providing double-buffered Cairo + Pango rendering (using `theme.uiFontFace` `Roboto` / `Noto Sans` for standard UI text and `gemui_draw_mono_text()` `Fira Code` for monospace slots), workarea-clamped responsive window sizing, `fullscreen_override` stacking guard (`VisibilityNotify`/`MapNotify`/`ConfigureNotify`) keeping `anode-lock` above the systray/bar while permitting `anode-vkbd`, hit tracking, touch-mode sizing (`gemui_touch_row_px`), self-pipe `SIGUSR1` + root `XA_RESOURCE_MANAGER` live reload, and non-blocking `poll()` loops. +- `src/libgemui/`: Shared library `libgemui.so` + `gemui.pc` providing double-buffered Cairo + Pango rendering (`theme.fontFace` `Fira Code` + `theme.iconFontFace` Nerd Font fallback), workarea-clamped responsive window sizing, `fullscreen_override` stacking guard (`VisibilityNotify`/`MapNotify`/`ConfigureNotify`) keeping `anode-lock` above the systray/bar while permitting `anode-vkbd`, hit tracking, touch-mode sizing (`gemui_touch_row_px`), self-pipe `SIGUSR1` + root `XA_RESOURCE_MANAGER` live reload, and non-blocking `poll()` loops. - `src/apps/`: Desktop control panels and optional dock virtual keyboard (`anode-vkbd`) + multimedia dispatcher (`anode-media-key`). - `src/daemons/`: Event-driven `poll()` + signal self-pipe daemons (`anode-statusd`, `anode-touchd`, `anode-powerd` with `power.conf` idle overrides) and narrowly-scoped privilege helpers (`anode-power-ctl`, `anode-dnsctl`, `anode-tzctl`, `anode-checkpw` with `/sbin/unix_chkpwd` fallback). - `src/gtkTtk/`: Tk/Ttk native GTK-2 bridge (`libgtkTtk0.9.so` + `gtkTtk.tcl`) supporting full `[0.5, 4.0]` fractional scaling. @@ -18,7 +18,7 @@ For a user or EDID-detected scale `S` clamped to `[0.50, 4.00]`: - `Xft.dpi = round(96 * S)` (`anode-apply-scale auto` honors explicit `xdpyinfo` server DPI outside `[94, 98]` before falling back to physical XRandR EDID dimensions) - `ANODE_SCALE = S`, `theme.baseFontSize = round(15 * S)`, and discrete standard Xcursor sizes (`16`, `24`, `32`, `48`, `64` mapped from `24 * S`); `~/.config/anode/scale.conf` takes precedence over stale session environment variables during live updates, while `anode-apply-scale` and `dwm` propagate updated scaling environment variables across `X11`, `D-Bus`, and newly spawned child processes. - **GTK-2 / GTK-3 / GTK-4 / xsettingsd / Fontconfig**: `GDK_SCALE = (S < 1.75) ? 1 : round(S)`, `GDK_DPI_SCALE = 1 / GDK_SCALE`, `ADW_DISABLE_PORTAL=1`, unscaled logical non-monospace UI point sizes (`theme.uiFontFace`, `Roboto` with automatic `Noto Sans` fallback, `round((baseFontSize / S) * 0.65)`, e.g. `10pt`) because `Xft.dpi` is active (`Xft/DPI` remains omitted from `xsettingsd.conf` to avoid double-scaling), generated `~/.themes/ANODE-/gtk-{3.0,4.0}/gtk.css` themes inherit GTK's built-in Adwaita/Default stylesheets via `resource:///...` `@import` (auto-detecting dark vs light from `theme.isDark` or `theme.bgMain` luminance) with color-only overrides so native widget/menu spacing and borders stay intact, color-only `@define-color` overrides in `~/.config/gtk-{3.0,4.0}/gtk.css`, Fontconfig `$XDG_CONFIG_HOME/fontconfig/conf.d/60-anode-fonts.conf` aliasing `sans-serif` to `Roboto`/`Noto Sans` and `monospace` to `Fira Code`, `gsettings` synchronization (`org.gnome.desktop.interface`) when active, `gtk-cursor-theme-size = Xcursor.size` for GTK-2, and `Gtk/CursorThemeSize` / `gtk-cursor-theme-size = round(Xcursor.size / GDK_SCALE)` for `xsettingsd` and GTK-3/4. -- **Dunst notifications**: `anode-sync-dunst-theme` pins `scale = 1`, pre-scales geometry by `S`, and uses pixel font sizing (`Roboto px`, or `Noto Sans` when `Roboto` is unavailable) so `Xft.dpi` never double-scales notifications. +- **Dunst notifications**: `anode-sync-dunst-theme` pins `scale = 1`, pre-scales geometry by `S`, and uses pixel font sizing (`Fira Code px`) so `Xft.dpi` never double-scales notifications. - **User `.Xresources` & terminal overrides**: `anode-apply-theme` sets `st.font` to `Fira Code:size=13`, preserves explicit `St.*` resource lines across theme switches, and appends `$XDG_CONFIG_HOME/anode/Xresources.local`, while `st` defaults to `Fira Code:size=13`, honors explicit `St.font` overrides over `st.font`, and resolves `size=` fonts against live `Xft.dpi`. - **Qt5 / Qt6**: `QT_QPA_PLATFORMTHEME=gtk3:qt6ct:qt5ct` (Qt follows ANODE's active GTK-3 theme first, with synced palettes and `general=Roboto,10` / `fixed=Fira Code,10` typography in `~/.config/qt5ct/` and `~/.config/qt6ct/` as fallback), `QT_AUTO_SCREEN_SCALE_FACTOR=0`, `QT_ENABLE_HIGHDPI_SCALING=1`, `QT_SCALE_FACTOR_ROUNDING_POLICY=PassThrough`, `QT_SCALE_FACTOR=S`, and `QT_FONT_DPI=96`. - **Tk / Tkinter (`gtkTtk`)**: `*TkTheme: gtkTtk`, Tk scaling normalized against `ANODE_SCALE` / `Xft.dpi`, using `Roboto` (or `Noto Sans` fallback) for standard UI fonts (`TkDefaultFont`, `TkTextFont`, `TkMenuFont`, `TkHeadingFont`) and `Fira Code` for `TkFixedFont`. diff --git a/scripts/anode-sync-dunst-theme b/scripts/anode-sync-dunst-theme index d7a2bd4..d5c141f 100755 --- a/scripts/anode-sync-dunst-theme +++ b/scripts/anode-sync-dunst-theme @@ -39,36 +39,7 @@ if [ ! -r "$XRES" ]; then exit 0 fi -resolve_ui_font() { - _req="$1" - [ -n "$_req" ] || _req="Roboto" - if [ "$_req" = "Roboto" ] && command -v fc-list >/dev/null 2>&1; then - _resolved="$(fc-list : family 2>/dev/null | awk ' - { - n = split($0, a, ",") - for (i = 1; i <= n; i++) { - s = a[i] - gsub(/^[ \t\r\n]+|[ \t\r\n]+$/, "", s) - ls = tolower(s) - if (ls == "roboto") has_rob = 1 - else if (ls == "noto sans") has_noto = 1 - } - } - END { - if (has_rob) print "Roboto" - else if (has_noto) print "Noto Sans" - else print "Roboto" - } - ' || true)" - if [ -n "$_resolved" ]; then - printf '%s\n' "$_resolved" - return 0 - fi - fi - printf '%s\n' "$_req" -} - -FONT_FACE="$(resolve_ui_font "$(xres_get theme.uiFontFace "Roboto")")" +FONT_FACE="$(xres_get theme.fontFace "Fira Code")" SCALE="$(xres_get theme.scale "1.00")" BASE_SZ="$(xres_get theme.baseFontSize "15")" diff --git a/src/apps/anode-themes.c b/src/apps/anode-themes.c index 9ced7f3..a786bdd 100644 --- a/src/apps/anode-themes.c +++ b/src/apps/anode-themes.c @@ -172,8 +172,8 @@ static void on_draw(gemui_app_t *app, cairo_t *cr, int w, int h, void *ud) { st->themes[st->sel].name, 1, true, GEMUI_ALIGN_LEFT, p->fg_bright); iy += line_h + pad; - gemui_draw_mono_text(cr, t, (gemui_rect_t){prev_r.x + pad, iy, prev_r.w - pad * 2, line_h}, - "Fira Code Ligatures: -> => != === <= >= ::", -1, false, GEMUI_ALIGN_LEFT, p->fg_main); + gemui_draw_text(cr, t, (gemui_rect_t){prev_r.x + pad, iy, prev_r.w - pad * 2, line_h}, + "Fira Code Ligatures: -> => != === <= >= ::", -1, false, GEMUI_ALIGN_LEFT, p->fg_main); iy += line_h + pad / 2; const gemui_color_t sw_cols[6] = { diff --git a/src/apps/anode-vkbd.c b/src/apps/anode-vkbd.c index 43a9a0a..6b7eee8 100644 --- a/src/apps/anode-vkbd.c +++ b/src/apps/anode-vkbd.c @@ -233,9 +233,6 @@ static void load_theme_and_geom(vkbd_t *v) { if (XrmGetResource(db, "theme.fontFace", "*", &type, &val) && val.addr) { snprintf(v->theme.font_face, sizeof(v->theme.font_face), "%s", val.addr); } - if (XrmGetResource(db, "theme.uiFontFace", "*", &type, &val) && val.addr) { - snprintf(v->theme.ui_font_face, sizeof(v->theme.ui_font_face), "%s", val.addr); - } XrmDestroyDatabase(db); } v->scale = sc; diff --git a/src/libgemui/gemui.c b/src/libgemui/gemui.c index 440e1d7..c5bb06f 100644 --- a/src/libgemui/gemui.c +++ b/src/libgemui/gemui.c @@ -159,7 +159,6 @@ void gemui_theme_defaults(gemui_theme_t *t) { memset(t, 0, sizeof(*t)); snprintf(t->name, sizeof(t->name), "AnodeDefault"); snprintf(t->font_face, sizeof(t->font_face), "Fira Code"); - snprintf(t->ui_font_face, sizeof(t->ui_font_face), "Roboto"); snprintf(t->icon_font_face, sizeof(t->icon_font_face), "DejaVuSansM Nerd Font"); t->base_font_size = 15; t->dpi = 96; @@ -247,9 +246,6 @@ static void gemui_apply_xrm_db(XrmDatabase db, gemui_theme_t *t) { if (XrmGetResource(db, "theme.fontFace", "Theme.FontFace", &type, &val) && val.addr) { snprintf(t->font_face, sizeof(t->font_face), "%s", val.addr); } - if (XrmGetResource(db, "theme.uiFontFace", "Theme.UiFontFace", &type, &val) && val.addr) { - snprintf(t->ui_font_face, sizeof(t->ui_font_face), "%s", val.addr); - } if (XrmGetResource(db, "theme.iconFontFace", "Theme.IconFontFace", &type, &val) && val.addr) { snprintf(t->icon_font_face, sizeof(t->icon_font_face), "%s", val.addr); } @@ -1091,7 +1087,7 @@ static int gemui_draw_pango(cairo_t *cr, const char *face, int px_size, PangoLayout *layout = g_active_layout ? g_active_layout : pango_cairo_create_layout(cr); char desc_str[288]; snprintf(desc_str, sizeof(desc_str), "%s%s %dpx", - face && face[0] ? face : "Roboto, Noto Sans", + face && face[0] ? face : "Fira Code", bold ? " Bold" : "", px_size > 8 ? px_size : 14); PangoFontDescription *desc = pango_font_description_from_string(desc_str); @@ -1121,39 +1117,20 @@ static int gemui_draw_pango(cairo_t *cr, const char *face, int px_size, return tw; } -static int gemui_draw_text_with_face(cairo_t *cr, const gemui_theme_t *t, gemui_rect_t r, - const char *face, const char *text, int pt_delta, - bool bold, int align, gemui_color_t c) { +int gemui_draw_text(cairo_t *cr, const gemui_theme_t *t, gemui_rect_t r, + const char *text, int pt_delta, bool bold, int align, gemui_color_t c) { double sc = (t && t->scale > 0.0) ? t->scale : 1.0; int base_px = (t && t->base_font_size > 0) ? t->base_font_size : anode_scale_px(15, sc); int delta_px = (int)llround((double)pt_delta * sc); int px = base_px + delta_px; if (px < 8) px = 8; - char fam[256]; + char fam[224]; snprintf(fam, sizeof(fam), "%s, %s", - (face && face[0]) ? face : "Roboto, Noto Sans", + (t && t->font_face[0]) ? t->font_face : "Fira Code", (t && t->icon_font_face[0]) ? t->icon_font_face : "DejaVuSansM Nerd Font"); return gemui_draw_pango(cr, fam, px, r, text, bold, align, c); } -int gemui_draw_text(cairo_t *cr, const gemui_theme_t *t, gemui_rect_t r, - const char *text, int pt_delta, bool bold, int align, gemui_color_t c) { - const char *uface = (t && t->ui_font_face[0]) ? t->ui_font_face : "Roboto"; - char ui_with_fallback[128]; - if (strcmp(uface, "Noto Sans") == 0) { - snprintf(ui_with_fallback, sizeof(ui_with_fallback), "Noto Sans"); - } else { - snprintf(ui_with_fallback, sizeof(ui_with_fallback), "%s, Noto Sans", uface); - } - return gemui_draw_text_with_face(cr, t, r, ui_with_fallback, text, pt_delta, bold, align, c); -} - -int gemui_draw_mono_text(cairo_t *cr, const gemui_theme_t *t, gemui_rect_t r, - const char *text, int pt_delta, bool bold, int align, gemui_color_t c) { - const char *mface = (t && t->font_face[0]) ? t->font_face : "Fira Code"; - return gemui_draw_text_with_face(cr, t, r, mface, text, pt_delta, bold, align, c); -} - int gemui_draw_icon(cairo_t *cr, const gemui_theme_t *t, gemui_rect_t r, const char *icon_utf8, int pt_delta, int align, gemui_color_t c) { double sc = (t && t->scale > 0.0) ? t->scale : 1.0; diff --git a/src/libgemui/gemui.h b/src/libgemui/gemui.h index 092fd4c..c254ae8 100644 --- a/src/libgemui/gemui.h +++ b/src/libgemui/gemui.h @@ -53,7 +53,6 @@ typedef struct { typedef struct { char name[64]; char font_face[96]; - char ui_font_face[96]; char icon_font_face[96]; int base_font_size; int dpi; @@ -145,8 +144,6 @@ void gemui_fill_round(cairo_t *cr, gemui_rect_t r, double radius, gemui_color_t void gemui_stroke_round(cairo_t *cr, gemui_rect_t r, double radius, double lw, gemui_color_t c); int gemui_draw_text(cairo_t *cr, const gemui_theme_t *t, gemui_rect_t r, const char *text, int pt_delta, bool bold, int align, gemui_color_t c); -int gemui_draw_mono_text(cairo_t *cr, const gemui_theme_t *t, gemui_rect_t r, - const char *text, int pt_delta, bool bold, int align, gemui_color_t c); int gemui_draw_icon(cairo_t *cr, const gemui_theme_t *t, gemui_rect_t r, const char *icon_utf8, int pt_delta, int align, gemui_color_t c); void gemui_draw_header(gemui_app_t *app, cairo_t *cr, const char *icon, diff --git a/tests/test_theme_scale.py b/tests/test_theme_scale.py index 04b21d7..d9d1439 100755 --- a/tests/test_theme_scale.py +++ b/tests/test_theme_scale.py @@ -167,7 +167,7 @@ def test_fractional_scales(): with open(os.path.join(tmp, ".config", "dunst", "dunstrc"), "r", encoding="utf-8") as f: drc = f.read() assert "scale = 1" in drc, drc - assert f"font = {exp_ui} {exp_px}px" in drc, drc + assert f"font = Fira Code {exp_px}px" in drc, drc # Verify Fontconfig + Qt5 + Qt6 + Kvantum + Dunst + GTK2/3/4 files for p in [ @@ -333,9 +333,8 @@ def test_stale_env_does_not_override_scale_conf(): assert xres["Xft.dpi"] == "120", xres["Xft.dpi"] assert xres["theme.touchMode"] == "0", xres["theme.touchMode"] - exp_ui = detect_expected_ui_font() with open(os.path.join(tmp, ".config", "dunst", "dunstrc"), "r", encoding="utf-8") as f: - assert f"font = {exp_ui} 19px" in f.read() + assert "font = Fira Code 19px" in f.read() with open(os.path.join(tmp, ".config", "gtk-3.0", "settings.ini"), "r", encoding="utf-8") as f: assert "gtk-cursor-theme-size=24" in f.read() @@ -457,7 +456,7 @@ def test_ui_font_fallback_roboto_to_noto_sans(): assert 'general="Noto Sans,10,' in qc, qc assert 'fixed="Fira Code,10,' in qc, qc with open(os.path.join(tmp, ".config", "dunst", "dunstrc"), "r", encoding="utf-8") as f: - assert "font = Noto Sans 19px" in f.read() + assert "font = Fira Code 19px" in f.read() import xml.etree.ElementTree as ET fc_root = ET.parse(os.path.join(tmp, ".config", "fontconfig", "conf.d", "60-anode-fonts.conf")).getroot() diff --git a/tests/test_x11_xvfb.py b/tests/test_x11_xvfb.py index 69553e7..2bca6ce 100755 --- a/tests/test_x11_xvfb.py +++ b/tests/test_x11_xvfb.py @@ -495,7 +495,7 @@ def test_st_font_override_and_dunst(): dout, derr = dp.communicate(timeout=3) combined = dout + "\n" + derr assert "Trying to set scale to 1" in combined, combined - assert ("Roboto 23px" in combined or "Noto Sans 23px" in combined), combined + assert "Fira Code 23px" in combined, combined finally: for p in reversed(procs): terminate(p)