Skip to content

feat(window): add configurable opacity#84

Open
roramirez wants to merge 1 commit into
mainfrom
feat/config-window-opacity
Open

feat(window): add configurable opacity#84
roramirez wants to merge 1 commit 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).
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