Skip to content

Add terminal opacity to generated themes - #8407

Open
OldJobobo wants to merge 4 commits into
omacom:quattrofrom
OldJobobo:feat/terminal-opacity-theme-token
Open

OldJobobo wants to merge 4 commits into
omacom:quattrofrom
OldJobobo:feat/terminal-opacity-theme-token

Conversation

@OldJobobo

@OldJobobo OldJobobo commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Add terminal opacity to generated themes

Before Omarchy 4.0.1, themes could set terminal background transparency by shipping terminal config files. Omarchy 4.0.1 blocks those files in Git-installed themes because they can contain executable hooks, leaving installed themes without a safe way to set opacity. This PR adds a validated, data-only terminal_opacity value to colors.toml and uses it when generating terminal configs.

What Is the Value of This?

Terminal background opacity lets wallpaper and blur show through without reducing the opacity of foreground text. Combined with Hyprland's blur settings, it gives theme authors finer control over the terminal's appearance, from a subtle haze to a more pronounced glass effect. That range helps themes develop a distinct visual character while keeping terminal text readable.

The Quickshell-based Omarchy Shell offers detailed surface controls, and Glassy windows already supply a default terminal background opacity. This optional token lets a theme explicitly choose its own terminal background opacity without fading foreground text or suppressing Glassy's fallback when the theme declares nothing.

Event Horizon terminal opacity comparison

The Event Horizon comparison shows the practical difference:

  • Left: terminal background alpha 0.45 with Hyprland window opacity 1.0; foreground text remains opaque.
  • Right: terminal background alpha 1.0 with Hyprland window opacity 0.45; foreground text fades with the entire surface.
  • Both captures use Foot 1.27.0 with the same text, palette, wallpaper, and window geometry.
Individual VM captures

Opaque baseline

Opaque Event Horizon terminal

Terminal background opacity

Event Horizon terminal with background opacity

Hyprland whole-window opacity

Event Horizon terminal with whole-window opacity

Initial implementation evidence

An initial VM pass compared generated Foot configs using the compatibility default and the new token:

Default opacity 1.0 compared with generated opacity 0.78

These initial captures predate current Glassy and live Foot-alpha support. At that earlier base, the 0.78 capture was byte-identical before and after the then color-only OSC sequence. Current Foot behavior is described below.

Summary

  • add an optional, validated terminal_opacity theme token from 0.0 through 1.0
  • emit stock terminal opacity settings only for valid explicit declarations; warn and ignore invalid overrides
  • preserve Glassy's 0.65 fallback and user terminal settings when opacity is undeclared
  • keep trusted hand-written terminal configs authoritative and continue filtering terminal configs from Git-installed themes
  • document the difference from Hyprland whole-window opacity and current live Foot-alpha updates

Behavior

Themes can now set:

terminal_opacity = "0.78"

Stock templates emit no opacity directive when the token is omitted or invalid, leaving the terminal's own settings and selected window mode intact. Glassy can therefore supply its usual 0.65 background opacity. A valid explicit theme value, including 1.0, takes precedence over that fallback, consistent with authored terminal configs. The scalar {{ terminal_opacity }} still falls back to 1.0 for custom templates that opt into it. This controls the terminal emulator's background rather than applying compositor opacity to text and the rest of the window.

Running Foot windows receive the generated theme's last alpha over OSC on theme and window-opacity changes; reopening is not required. Other terminals follow their normal configuration-reload behavior.

Validation

Current update at 60d76856: CLI, theme-staging, template-rendering, window-transparency, and install-guard checks pass. The new stock-template regression fails on the prior implementation and passes for missing, invalid, explicit translucent, explicit opaque, and commented values with Glassy selected. Extraction, shell syntax, and feature-diff whitespace checks pass. Isolated generated Foot windows were visually checked at Glassy's fallback alpha=0.65 and an explicit theme alpha=0.85; live configuration was not changed.

Original implementation validation

The checks and VM evidence below were recorded against the original base, before the current update. Passed:

  • ./test/cli
  • bash test/shell.d/theme-staging-test.sh
  • bash -n bin/omarchy-theme-color bin/omarchy-theme-set-templates
  • foot --config=<generated-foot.ini> --check-config
  • ghostty +validate-config --config-file=<generated-ghostty.conf>
  • alacritty migrate --dry-run --silent --skip-imports --config-file <generated-alacritty.toml>
  • git diff --check
  • VM visual comparison using Event Horizon installed through omarchy theme install
  • Existing color-only OSC updates left terminal opacity unchanged

./test/shell ran all 206 shell test files. Five unrelated failures reproduce unchanged on a clean origin/quattro worktree at 0ae16948:

  • config-test.sh, snapper-test.sh, and unowned-system-paths-test.sh: local omarchy-pkgs checkout unavailable
  • copy-url-shortcut-migration-test.sh: existing mid-repair browser-start race assertion
  • runtime-smoke-test.sh: existing duplicate IPC-handler count assertion

The VM comparison used Event Horizon installed from its Git repository through omarchy theme install. After adding terminal_opacity = "0.45" to the installed theme, Omarchy filtered its supplied terminal configs and regenerated Foot with the new value.

--[ Pi :: gpt-6.1-sol ]--
--- on behalf of: @OldJobobo

Copilot AI balanced review requested due to automatic review settings August 26, 2026 15:25

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8a82ded18f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/theming.md Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 8 changed files in this pull request and generated no new comments.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 8 changed files in this pull request and generated no new comments.

@omarchybot omarchybot added the enhancement New feature or request label Sep 27, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed at ff66ddd against current quattro. The change is careful and the validation is sound, but quattro has moved underneath it since August, and as it stands it would switch off the new Glassy windows for every theme. Nothing pushed, because how a theme's terminal opacity should compose with the user's window-transparency choice is a design decision rather than a defect fix.

What was checked. I read the diff against quattro and the surrounding code, merged the head into current origin/quattro (it merges cleanly), and ran on an Omarchy worker VM: ./test/cli on the merge result and on plain quattro (both pass), and theme-staging-test.sh, hyprland-window-transparency-test.sh and toggle-test.sh through the compositor-backed runner (all pass on both). I also ran a probe that chooses Glassy windows and renders a stock-style theme with no terminal_opacity key:

plain quattro quattro + this PR
alacritty opacity = 0.65 opacity = 1.0
foot alpha=0.65 alpha=1.0
kitty background_opacity 0.65 background_opacity 1.0
ghostty background-opacity = 0.65 background-opacity = 1.0

Why. Appearance > Window Transparency (#14991) landed after this PR was opened. With Glassy chosen, omarchy-theme-set-templates ends by running omarchy-theme-set-glass, which adds a see-through background to each generated terminal file but deliberately skips any setting the theme file already has, so a theme that sets its own opacity keeps it. This PR writes the opacity line into every generated terminal file, defaulting it to 1.0 when the theme says nothing. So every theme now looks as if it chose to be opaque, and Glassy terminals stay solid. The suite stays green because no test renders the templates with Glassy on.

The same question comes up the other way round: with Opaque windows chosen, a theme with terminal_opacity = "0.45" keeps a see-through terminal, because window-opaque.lua only resets Hyprland's window opacity. Whether the user's choice or the theme's value should win is the maintainer's call. If the theme's value should only apply when it is set, the opacity line would need to be left out of the generated files when the key is absent, rather than emitted as 1.0.

Docs. On quattro, omarchy-theme-set-foot now pushes the last alpha in the theme's foot.ini into running Foot terminals on every theme switch, so the new sentence in docs/theming.md saying running Foot windows keep the opacity they started with is no longer accurate.

Smaller notes. The 0–1 validation and the fallback to 1.0 with a warning hold, and the value can only reach a config as digits and a dot, so it cannot inject anything. An unquoted value with an inline comment (terminal_opacity = 0.8 # glass) is rejected and falls back to 1.0 with a warning; the parser treats every key that way, and the documented example is quoted.

Earlier bot reviews. chatgpt-codex-connector's one finding (hard-wrapped prose in docs/theming.md) is fixed in ff66ddd. Copilot reviewed ff66ddd and raised nothing. Greptile has not commented on this PR.

Overlap with #8720. #8720, also yours, adds the same terminal_opacity key with the same validation regex, the same 1.0 fallback and warning, and the same four template lines, plus terminal_blur, terminal_blur_radius, inline-comment stripping for those keys, and a hyprland.toml schema. It covers everything this PR does. Landing both would conflict on the same template and omarchy-theme-color lines. Its base is from 5 October, before #14991, so it emits opacity and blur unconditionally too and has the same Glassy interaction. On current quattro its unconditional blur=no in foot.ini would also sit beside the blur=yes the template now ships.

Second opinion. None ran. Codex Medium answers a ping on the review machine, but omabot's daily review budget was spent, so nothing here was checked by a second model.

Waiting on. The maintainer, to decide how theme opacity should compose with Appearance > Window Transparency and which of this PR and #8720 to carry forward. Then the author, to rebase onto quattro and update the Foot sentence in the docs.

@OldJobobo

Copy link
Copy Markdown
Contributor Author

Addressed the Glassy regression in 60d76856 after merging current quattro. Stock templates now emit opacity directives only for valid explicit declarations, using the same declaration-only approach as #8720. Missing or invalid declarations no longer silently force opacity to 1.0. The scalar fallback remains available to custom templates, and explicit theme values still take precedence over Glassy fallback behavior.

Added a real stock-template/Glassy regression, confirmed red on the prior implementation and green for omitted, invalid, explicit translucent, explicit opaque, and commented values. CLI, staging, template, window-transparency, and install-guard checks pass. Updated the Foot documentation and PR behavior section to match current OSC alpha updates. Also inspected isolated generated Foot windows at fallback alpha 0.65 and declared alpha 0.85 without changing live configuration.

The overlap with #8720 remains a maintainer choice; neither PR was closed or combined.

--[ Pi :: gpt-6.1-sol ]--
--- on behalf of: @OldJobobo

@greptile-apps

greptile-apps Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge, with no new actionable issues found.

Summary

Adds optional terminal_opacity settings to generated terminal themes.

  • Themes can set terminal background opacity across four terminals.

Reviews (2) · Last reviewed commit: "Validate full quoted terminal opacity va..." · Reviewed by Greptile

Comment thread bin/omarchy-theme-color Resolved
@OldJobobo

Copy link
Copy Markdown
Contributor Author

Fixed in 3bc4c095: opacity validation now receives the complete quoted value. Comment removal happens only for unquoted declarations, before the shared parser removes quotes; whitespace or a hash inside a quoted value is never discarded to salvage a valid prefix.

Extended the existing stock-template/Glassy regression with quoted junk, quoted hashes, unquoted junk, quoted scalars with comments, and comments containing quotes. The quoted-junk case fails before the fix; all template and theme-staging checks pass after it. Invalid declarations preserve Glassy fallback rather than silently enabling the prefix opacity.

--[ Pi :: gpt-6.1-sol ]--
--- on behalf of: @OldJobobo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants