Skip to content

Read the system accent from the Ubuntu theme name - #18

Merged
FacuM merged 1 commit into
mainfrom
fix/ubuntu-theme-accent
Nov 17, 2026
Merged

FacuM merged 1 commit into
mainfrom
fix/ubuntu-theme-accent

Conversation

@FacuM

@FacuM FacuM commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

"Use the system accent colour" did nothing on Ubuntu 24.04. GNOME before 47 has no accent setting, so the desktop portal reports no accent-color. Ubuntu encodes the accent chosen in its settings in the GTK theme name (Yaru-purple-dark), so the window now reads org.gnome.desktop.interface gtk-theme from the portal when the portal has no accent colour, and maps the theme's accent names to the theme's own colours.

Testing

  • cargo clippy -p ezd-tray --all-targets -- -D warnings and the system_accent tests pass.
  • The portal read was checked by hand on a desktop with another theme (it returns the theme name). Not verified on Ubuntu 24.04.

Summary by CodeRabbit

  • Bug Fixes
    • Improved accent color detection on Linux. If the desktop portal does not provide an accent color, supported Yaru theme variants—including dark variants—can now supply one, with KDE settings used as a fallback when no Yaru accent is identified.

GNOME before 47 has no accent setting, so the desktop portal reports none and the window stayed in its own colour on Ubuntu 24.04. Ubuntu encodes the accent chosen in its settings in the GTK theme name; read it from the portal when the portal has no accent colour.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-17T16:25:43.018267Z 9d1d97a PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Linux accent lookup now checks the desktop portal, then the GTK theme for supported Yaru colors, and then kdeglobals. Portal setting reads and timeout handling use shared helpers.

Changes: Linux accent lookup

Layer / File(s) Summary
Portal settings and timeout handling
crates/ezd-tray/src/ui/system_accent.rs
Portal setting reads use a shared read_setting helper. Portal calls use shared timeout handling through with_timeout.
Yaru theme mapping and fallback
crates/ezd-tray/src/ui/system_accent.rs
Supported Yaru theme names, including -dark variants, map to RGB values. If the portal lookup does not return a color, read checks the GTK theme before falling back to kdeglobals. Tests cover supported mappings and None results.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant Read as system_accent::read
  participant Portal as Desktop portal
  participant KDE as kdeglobals
  Read->>Portal: Read appearance accent
  Portal-->>Read: No color or error
  Read->>Portal: Read GNOME gtk-theme
  Portal-->>Read: Theme name or error
  alt Theme maps to a supported Yaru color
    Read-->>Read: Return mapped RGB
  else Theme is unknown or lookup fails
    Read->>KDE: Look up accent color
    KDE-->>Read: Return fallback result
  end
Loading
Merge Risk: Minimal · up to 9d1d9

The change adds a fallback so that the Ubuntu accent colour is picked up from the GTK theme name when the portal reports none. No actionable merge-blocking risk was found; the only gap is that it has not been tested on a real Ubuntu desktop.

Architecture risk: Medium · up to 9d1d9

The change affects 1 system.

Changed systems: crates

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — crates (ui) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in crates/ezd-tray/src/ui/system_accent.rs: Adds yaru_accent, which recognizes Yaru theme names with an optional -dark suffix and maps the supported base and named variants to fixed RGB values; other names return None.
  • observed — Modified behavior in crates/ezd-tray/src/ui/system_accent.rs: The Linux module now imports yaru_accent for its GTK-theme fallback.
  • observed — Modified behavior in crates/ezd-tray/src/ui/system_accent.rs: After the portal accent lookup yields no color or an error, read queries the GTK theme through the timeout helper and returns a recognized Yaru color; an unrecognized theme or lookup error is logged before falling back to kdeglobals.
  • observed — Modified behavior in crates/ezd-tray/src/ui/system_accent.rs: Adds generic with_timeout to run a portal call on a thread, return its result through a channel, and report "timed out" when it does not complete within PORTAL_TIMEOUT.

Reliability and maintainability

  • inferred — Risk-relevant change factors for crates: blast_radius_1; blast_radius_2; direct_dependents_1; direct_dependents_2
Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: the system accent is now read from the Ubuntu (Yaru) GTK theme name as a fallback. The raw summary confirms the Yaru theme-name mapping in system_accent.rs, and the ob…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: the system accent is now read from the Ubuntu (Yaru) GTK theme name as a fallback. The raw summary confirms the Yaru theme-name mapping in system_accent.rs, and the objectives describe the same fallback. The title is specific and matches the changeset, so it passes.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b81f53e0-7b25-416f-aa59-733707252650
Commits

Reviewing files that changed from the base of the PR and between 8971288 and 9d1d97a.

Files selected for processing: 1

  • crates/ezd-tray/src/ui/system_accent.rs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.

@FacuM
FacuM merged commit 5d7a29f into main Nov 17, 2026
10 checks passed
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