Skip to content

feat(window): add configurable opacity - #84

Merged
roramirez merged 2 commits into
mainfrom
feat/config-window-opacity
Aug 9, 2026
Merged

feat(window): add configurable opacity#84
roramirez merged 2 commits into
mainfrom
feat/config-window-opacity

Conversation

@roramirez

Copy link
Copy Markdown
Owner

Summary

Adds a window.opacity config option (float, 0.01.0, default 1.0). When set below 1.0, the window is created transparent and the terminal background is rendered with that alpha, while text, glyphs, and UI chrome (tab bar, status bar, separators) stay fully opaque.

Note: alpha handling in softbuffer is platform/compositor-dependent (X11 vs Wayland vs macOS/CoreGraphics), so this is best-effort and requires a compositor that supports transparency.

Changes

  • config: add opacity: f32 to WindowConfig with #[serde(default = "default_opacity")] (default 1.0); add opacity = 1.0 to assets/config.toml.
  • config (TUI): add F_OPACITY field (FieldKind::Float, "Opacity", hint "0.0–1.0 window background opacity"); parse and clamp to 0.0..=1.0 in build_config.
  • renderer: add color_u32_with_alpha(c, a) packing alpha into the high byte (0xAARRGGBB); thread opacity through Renderer::draw and draw_pane, applying it to the frame background clear and per-pane background fills only.
  • winit_handler: request .with_transparent(true) when opacity < 1.0.
  • Tests: alpha-packing unit test, config default/round-trip/clamp tests, TUI build/clamp tests, and a renderer draw-with-opacity no-panic test; updated field-count and draw call-site asserts.
  • Docs: doc/SPEC.md config table + prose, README.md [window] block, CHANGELOG.md.

How to test

  • cargo test — full suite passes (1225 tests).
  • cargo clippy --locked -- -D warnings — clean.
  • Manual: set opacity = 0.8 under [window] in config.toml and launch under a compositor that supports transparency; the terminal background is translucent while text stays readable.

Add a window.opacity config (0.0-1.0, default 1.0). When below 1.0 the
window is created transparent and the terminal background is filled with
that alpha while text and UI chrome stay opaque. Alpha handling is
compositor/platform-dependent (best-effort).
@roramirez
roramirez force-pushed the feat/config-window-opacity branch from f4ef0f8 to 3bf93c0 Compare August 9, 2026 17:40
The alpha only reached the global buffer fill and the pane background,
so every cell repainted itself opaque and the transparency was visible
only in the pane padding at the window edges.

Thread a BgAlpha (alpha + default background) down to resolve_bg_color
and pack the alpha into cells still on the default background. Cells
with an application-set background, the cursor, the selection, and
search highlights stay opaque; glyph blending already forces full alpha.
@roramirez
roramirez force-pushed the feat/config-window-opacity branch from 3bf93c0 to a3d9028 Compare August 9, 2026 17:42
@roramirez
roramirez merged commit a842791 into main Aug 9, 2026
2 checks passed
@roramirez
roramirez deleted the feat/config-window-opacity branch August 9, 2026 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant