Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ hyprburst/
- **OS** — Linux with [Hyprland](https://hyprland.org/) (a Wayland session). Hyprburst opens its own GPU window and dispatches launches through `hyprctl`, so it expects a running Hyprland session.
- **OpenGL** — the launcher window is rendered with OpenGL via your GPU driver (Mesa or vendor). Virtually every Hyprland-capable machine already has this.
- **Hyprland 0.55+ recommended** — use the Lua bind snippet and configure placement/opacity in `~/.config/hyprburst/config.toml`. Legacy Hyprland 0.48–0.54 / `hyprland.conf` setups can use the shipped hyprlang `hyprburst.conf` with unified `windowrule` syntax.
- **Nerd Font** — hyprburst renders entry icons as Nerd Font glyphs in the private-use Unicode area. It auto-picks an installed [Nerd Font](https://www.nerdfonts.com/) (a *Mono* variant preferred); if none is installed, the icons show as tofu squares — install one (e.g. `JetBrainsMono Nerd Font`) or set `[font] path` / `[font] family` / `$HYPRBURST_FONT` to one.
- **Nerd Font (optional)** — hyprburst renders entry icons as [Nerd Font](https://www.nerdfonts.com/) glyphs. Both GPU frontends keep your requested text font and use an installed Nerd Font for missing icons (a *Mono* variant preferred). Icons fit within the text cell; when no font provides an icon, a generic four-tile app symbol appears instead. `hyprburst tui` uses the hosting terminal's font and fallback settings.

## Install

Expand Down Expand Up @@ -228,7 +228,7 @@ The launcher window and cell font are configured under `[window]` and `[font]` i

| Key | Type | Default | Notes |
|-----|------|---------|-------|
| `font.path` | string | unset | Explicit `.ttf`/`.otf` path for the cell font. Wins over `$HYPRBURST_FONT`, `[font] family`, and fontconfig. If icons show as tofu, point this at a *Nerd Font Mono* file. |
| `font.path` | string | unset | Explicit `.ttf`/`.otf` path for the primary text font. Wins over `$HYPRBURST_FONT`, `[font] family`, and fontconfig; missing icons still use fallback fonts. |
| `font.family` | string | unset | fontconfig family used after `path` and `$HYPRBURST_FONT`. A shared Swatches theme fills this when unset. Ignored by `hyprburst tui` (the hosting terminal owns that font). |
| `font.size` | float | `20.0` | Logical font height in pixels (before DPI scaling). The cell size is derived from the font's metrics at this size. Bump it up if text looks too small. |

Expand All @@ -255,7 +255,7 @@ Two sections cover everything about how hyprburst renders on screen: `[layout]`
| `ui.banner` | string | built-in ASCII "hyprburst" | Banner content, used when `show_banner = true`. Multi-line TOML string (`"""..."""`). An empty string also hides the banner. |
| `ui.prompt` | string | `"> "` | Printed before the search cursor. |
| `ui.page_size` | integer | `10` | Entries per page (PageUp/PageDown step). Must be `>= 1`. |
| `ui.show_icons` | bool | `true` | Draw a Nerd Font glyph before each app. Disable if your font lacks Nerd glyphs. |
| `ui.show_icons` | bool | `true` | Draw an icon before each app. GPU frontends use font fallback or a generic app symbol when the text font lacks Nerd glyphs. |
| `ui.selected_marker` | string | `"> "` | Prefix drawn on the selected row. Empty string falls back to the default. |
| `ui.cursor_char` | string | `"█"` | Single-character cursor glyph after the prompt. Non-single-grapheme values fall back to the default. |
| `ui.show_cursor` | bool | `true` | Draw the cursor glyph at all. |
Expand Down Expand Up @@ -405,7 +405,7 @@ Compare first presentation with `hyprburst --measure` (Rio default) and `hyprbur

## Troubleshooting

**Icons show as tofu squares (□).** No Nerd Font is installed for hyprburst to auto-pick. Install a [Nerd Font](https://www.nerdfonts.com/) such as `JetBrainsMono Nerd Font` (the *Mono* variant keeps icons one cell wide), or point `[font] path` / `[font] family` (or `$HYPRBURST_FONT`) at one, or set `ui.show_icons = false` to drop icons entirely. `hyprburst tui` uses the terminal's font, so a theme family will not fix tofu there.
**Icons look generic.** Both GPU frontends use a four-tile app symbol when no resolved font provides the requested icon. Install a [Nerd Font](https://www.nerdfonts.com/) such as `JetBrainsMono Nerd Font` and reopen hyprburst to get application-specific icons; your configured text family can stay unchanged. Set `ui.show_icons = false` to hide icons entirely. If **icons show as tofu squares (□)** in `hyprburst tui`, configure a Nerd Font or font fallback in the hosting terminal; a shared theme family does not control its font.

**Text is too small.** Raise `[font] size` (default `20.0`).

Expand Down
10 changes: 5 additions & 5 deletions config.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@
# with `override`; hyprburst also uses it for the transparent background panel.
# opacity = 0.85

# The cell font the window rasterizes glyphs from.
# The primary text font used by both GPU frontends.
[font]
# Explicit .ttf/.otf path. When unset, hyprburst auto-picks an installed Nerd
# Font (so the entry icons render), then falls back to the system monospace.
# Resolution order: path, $HYPRBURST_FONT, family (config or shared theme),
# fontconfig, hardcoded paths. If your icons show as tofu squares, set this to a
# *Nerd Font Mono* file (the "Mono" variant keeps icons one cell wide).
# fontconfig, hardcoded paths. Missing icons use fallback fonts without changing
# the text family; if none provides the icon, a generic four-tile symbol is drawn.
# path = "/usr/share/fonts/TTF/JetBrainsMonoNerdFont-Regular.ttf"

# fontconfig family name, used after path and $HYPRBURST_FONT. A shared theme
Expand Down Expand Up @@ -138,8 +138,8 @@
# Number of entries shown per page (PageUp/PageDown step size). Must be >= 1.
# page_size = 10

# Show Nerd Font icons before each app name. Set to false if your font lacks
# Nerd glyphs to avoid tofu squares.
# Show icons before each app name. GPU frontends fall back to an icon font or a
# generic app symbol; the external TUI depends on its hosting terminal's font.
# show_icons = true

# Prefix drawn on the selected row. Unselected rows get matching spaces so
Expand Down
70 changes: 70 additions & 0 deletions docs/icon-font-fallback.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# GPU icon font fallback

Both the native and Rio frontends resolve an immutable font set at startup.
The first parseable font retains the existing precedence: explicit path,
`HYPRBURST_FONT`, configured/shared family, fontconfig candidates, hardcoded
paths. Only this primary font determines text-cell width, height, and baseline.
Remaining candidates supply missing glyphs; duplicate paths are loaded once.

Private-use icons use aspect-preserving ink-bound fitting and centering within
one primary text cell, regardless of the selected face's advance or line metrics.
When no face provides an icon, the renderer draws a font-independent four-tile
app badge. Text keeps its original scale and baseline. The external `tui`
continues to use its hosting terminal's font configuration.

The font set and rasterization size are fixed for a renderer's lifetime, so the
atlas remains keyed by the original character, not the fallback glyph ID. A
cache hit reuses the same tile without another rasterization/upload. Different
characters cannot collide merely because their font-local glyph IDs match.

## Deterministic regression coverage

Run `cargo test --all`. `src/gpu/font.rs` tests cover:

- A primary font missing the launcher's actual Firefox character U+F269 and a
fallback containing it; supported primary text and icons still win.
- Visible, centered, unclipped icon coverage and atlas reuse at 1×, 1.5×, and 2×
cell sizes, including oversized/negative-bearing and undersized outlines.
- Generic badges when no icon face exists, including supplementary private-use
characters, and unchanged space/text rendering.
- First-parseable loading, duplicate paths, and path/environment/family ordering.

`tests/fixtures/fonts/*.ttf` are original geometric fixtures, not system fonts.
Their generator documents provenance and can be run with
`uv run --with fonttools python tests/fixtures/fonts/generate.py`.
Tests consume the checked-in fonts and do not require Python or fonttools.

## Live smoke record — 2026-09-13

Environment: Hyprland 0.56.2, Wayland, eDP-1 at 2880×1800 and display scale 1.5.
Test binary: `target/debug/hyprburst`, built with `cargo build --all-targets`.

An isolated `XDG_CONFIG_HOME` selected a Swatches v1 theme with
`[font] family = "DejaVu Sans Mono"`. Config used `font.size = 20.0`,
`ui.show_icons = true`, and an opaque window. No explicit font path or
`HYPRBURST_FONT` override was set. Isolated XDG data directories contained
three harmless desktop entries: Files (`files`), Firefox (`firefox`), and
Terminal (`terminal`), each with `Exec=true`. No entry was launched.
`HYPRBURST_CHILD=1` bypassed compositor redispatch without altering user config.

| Case | Native (`hyprburst native`) | Rio (`hyprburst`) |
| --- | --- | --- |
| Shared ordinary text family, installed Nerd Fonts | Pass: text retained; folder, Firefox, terminal icons visible and aligned | Pass: same text and icon rendering |
| Same theme, fontconfig restricted to DejaVu Sans Mono only | Pass: all three icons become four-tile app badges, no tofu | Pass: same generic badges, no tofu |

For the second case, `FONTCONFIG_FILE` pointed to an isolated configuration
whose only font directory contained DejaVu Sans Mono; `fc-list` confirmed that
no Nerd Font was exposed. No hardcoded Nerd Font path existed on this host.

Each window was allowed to render for one second after mapping, captured with
`grim`, and visually inspected. All four runs had empty stdout/stderr logs.
Test processes were terminated after capture; this smoke did not test app
launching or graceful close. An initial capture script's legacy Hyprland close
command was rejected by the Lua dispatcher; subsequent runs used targeted
process termination instead. No compositor settings were changed.

Local captures and the reproduction script are under
`/tmp/hyprburst-font-smoke.wct1Ka/` (`native.png`, `rio.png`,
`native-no-icons.png`, `rio-no-icons.png`, `smoke.py`). These are temporary local
artifacts, not packaged assets. Normal and fractional/scaled raster sizes are
also covered by the deterministic tests above; the live display stayed at 1.5×.
Loading
Loading