Skip to content

feat(appearance): load an optional user stylesheet - #1758

Merged
l0gicgate merged 2 commits into
lgse:mainfrom
Cha1000000:feat/1710-user-stylesheet
Oct 18, 2026
Merged

l0gicgate merged 2 commits into
lgse:mainfrom
Cha1000000:feat/1710-user-stylesheet

Conversation

@Cha1000000

Copy link
Copy Markdown
Contributor

Description

Adds an opt-in user stylesheet, as discussed in #1710. When ~/.config/strata/style.css exists, Strata loads it through its own CSS provider above every stylesheet Strata ships, so user rules have the final word and can use the active theme's @strata_* colors. Without the file the provider stays empty and nothing changes.

The file is watched the same way as custom themes: edits apply to open windows after a short debounce, deleting the file restores the default look, and rules GTK cannot parse are skipped and logged as warnings. ~/.config/gtk-4.0/gtk.css remains ignored, as before. docs/themes.md documents the file and notes that class names are not a stable interface.

The implementation was written with the help of an AI coding assistant; I reviewed and tested it and the commit is my own.

Visual evidence

N/A. This adds an opt-in file and changes nothing by default. With the file present, the rules in it restyle the interface: for example, .sidebar-shell { margin: 8px; border-radius: 16px; } turns the sidebar into a floating rounded card, as described in #1710.

How to test

  1. Start Strata, then create ~/.config/strata/style.css with .sidebar-shell { margin: 8px; border-radius: 16px; background: alpha(@strata_accent, 0.25); }.
  2. Without restarting, change the alpha to 0.5, then add an invalid rule such as .sidebar { color: nope; } and save again.
  3. Delete the file.

Expected result: the sidebar turns into a rounded, accent-tinted card as soon as the file is saved and follows each edit; the invalid rule is skipped with a invalid rule in user stylesheet warning in the log while the valid rules keep applying; after deleting the file the sidebar returns to the default appearance. Switching themes keeps the override and updates its @strata_* colors.

Related issue

Closes #1710

Cha1000000 and others added 2 commits October 18, 2026 18:39
Strata pins its own appearance and deliberately ignores
~/.config/gtk-4.0/gtk.css, which leaves no supported way to tweak the
interface beyond the color tokens. Load ~/.config/strata/style.css,
when present, through a provider above every Strata stylesheet, so its
rules win and the active theme's @strata_* colors are available.

The file is watched like custom themes: edits apply to open windows
after a short debounce, deleting it restores the default appearance,
and rules GTK cannot parse are logged as warnings.

Refs lgse#1710
…the user stylesheet

Hoist the color comparison used by the user-stylesheet test into a test
helper, name the GTK isolation test after gtk.css now that Strata has a
user stylesheet of its own, and link the new docs section from the
README.
@l0gicgate
l0gicgate merged commit dbb14c5 into lgse:main Oct 18, 2026
9 checks passed
@l0gicgate

Copy link
Copy Markdown
Contributor

Review of the diff against main (e8dbc7ae, which the branch already sits on, so the merge was a no-op).

Verdict: no merge blockers. The provider sits one priority step above the token provider, so user rules win over Strata's own and still see the active theme's @strata_* colors; a missing or unreadable file clears the provider, and the file monitor reuses the custom-themes debounce pattern. The gtk_test harness runs under a throwaway XDG_CONFIG_HOME, so the new test never touches a real ~/.config/strata/style.css.

Pushed in 4c36e7c8:

  • Hoisted the label color comparison into a has_color test helper, shared with the existing GTK isolation test instead of duplicating it.
  • Renamed desktop_gtk_theme_and_user_stylesheet_do_not_restyle_widgets to ..._and_gtk_css_..., since "user stylesheet" now names Strata's own file.
  • Trimmed the USER_STYLE_PRIORITY doc comment to the rationale only.
  • Linked the new docs section from the README's Custom themes section.

Test audit: user_stylesheet_overrides_strata_and_reloads_live is retained; it covers creation after startup, a live edit, an invalid rule being skipped while valid ones apply, and deletion restoring the theme text color, all through computed widget colors.

Local verification (review worktree): cargo fmt --all --check, cargo clippy --all-targets --all-features -- -D warnings, and ./scripts/test-headless.py -- ui::theme::tests:: (28 passed, including the new test). Scoped per AGENTS.md: the change is confined to the theme manager and its docs; CI runs the full suite.

CI: the fork's workflow run needed maintainer approval; approved after review.

l0gicgate added a commit that referenced this pull request Oct 20, 2026
…ompat-followups

Resolves the catalog, services, preview test, context menu, theme and
typed-navigation conflicts, and adapts what main added since the fork to
this branch's rules:

- The user stylesheet (#1758) is watched through the monitors worker and
  re-read off the UI thread.
- The Diagnostics page (#1735) and the Integrations page (#1748) detect
  the package manager and resolve the terminal off the UI thread; the
  Run-in-terminal button spawns through the reaper closure.
- Connect to server (#1726) waits for a native path's asynchronous
  validation instead of pinning and closing at once.
- The pinned-places tests read the GTK bookmarks file through
  adapters::bookmarks after the settings writer settles.
- Traditional Chinese (#1745) gets the strings this branch adds.
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.

feat(appearance): opt-in user stylesheet (or a floating sidebar option)

2 participants