Repository navigation
feat: Use system-themed titlebar icons for frameless windows with WCO on Linux - #52461
Merged
jkleinsc merged 4 commits intoJul 29, 2026
Merged
Conversation
deepak1556
reviewed
Jul 27, 2026
mitchchn
force-pushed
the
mitch/freedesktop-nav-buttons-wco
branch
2 times, most recently
from
July 27, 2026 22:44
6592f24 to
fd2a632
Compare
deepak1556
approved these changes
Jul 27, 2026
deepak1556
left a comment
Member
There was a problem hiding this comment.
LGTM on proposed design, thanks!
ckerr
approved these changes
Jul 28, 2026
|
Release Notes Persisted
|
Contributor
|
I have automatically backported this PR to "43-x-y", please check out #52530 |
Contributor
|
I have automatically backported this PR to "44-x-y", please check out #52531 |
Contributor
|
What about button position? Mine are supposed to be on the left. |
Member
Author
|
@flying-sheep button position was addressed by #51161. That change is in Electron 43, but most apps haven't updated yet. |
This was referenced Jul 31, 2026
1 task done
Merged
4 of 7 tasks
DeJeune
added a commit
to CherryHQ/cherry-studio
that referenced
this pull request
Oct 9, 2026
…21416) <!-- Template from https://github.com/kubevirt/kubevirt/blob/main/.github/PULL_REQUEST_TEMPLATE.md?--> <!-- Thanks for sending a pull request! Here are some tips for you: 1. Consider creating this PR as draft: https://github.com/CherryHQ/cherry-studio/blob/main/CONTRIBUTING.md --> > ### Branch strategy > > - Active development targets `main`. ### What this PR does Before this PR: - On Linux with "Use system title bar" off, the main window and sub-windows are frameless (`frame: false`). React draws its own min/max/close buttons and drives them over IPC. - Sub-windows ignore `app.use_system_title_bar`, so they stay frameless even when it is on. In that case `useHasWindowControls()` returns false, and the sub-window ends up with **no window controls at all**. - With the system title bar on, the native bar sits above Cherry's own 44px top bar, giving two stacked bars. After this PR: - **Main window (Linux):** - "Use system title bar" off → `titleBarStyle: 'hidden'` plus `titleBarOverlay` (44px, matching `AppShellTabBar`'s `h-11`). Electron draws the controls with the system's Freedesktop icon theme (Electron 44, electron/electron#52461). - "Use system title bar" on → native frame, unchanged. - **Sub-windows (Linux):** always use WCO (37px, matching `TITLE_BAR_HEIGHT_PX`). Pooled standbys are created from static registry options only, so they cannot read the preference. As a side effect, sub-windows now always have controls. - **Theme sync:** overlay `color` / `symbolColor` follow `nativeTheme` through `setTitleBarOverlay` (new `src/main/core/window/linuxTitleBarOverlay.ts`). It is only applied to windows created with an overlay, which avoids the #5571-style error. - **Renderer:** - On Linux, `WindowControls` renders a spacer the width of the overlay instead of buttons. The width comes from `env(titlebar-area-x/width)` rather than a hardcoded number, and is 0 when the window has no overlay. - The sub-window's `--window-controls-width` uses the same expression. - `useHasWindowControls()` is now Windows-only. - **Leading (left-side) controls:** when GNOME's `button-layout` puts the buttons on the left, the main window reuses the macOS traffic-light layout: a sidebar spacer plus a tab-strip inset. The sub-window title bar pads by `env(titlebar-area-x)`. A new `useLeadingWindowControlsOverlay` hook follows `geometrychange`, so the layout updates live when the button layout changes. - **MCP browser window (Linux):** now uses WCO (42px, theme-synced) instead of drawing its own buttons in `tabbarHtml.ts`. Its tab bar BrowserView can read `env(titlebar-area-*)` too, so it reserves the overlay on either side. - Windows and macOS behavior is unchanged. Refs #21413 (partial: see reviewer notes for remaining acceptance items) ### Why we need it and why it was done in this way The following tradeoffs were made: - The overlay `color` is fully transparent so Cherry's own top bar shows through. Its RGB is still chosen to contrast the glyph: Electron's Linux frame forces `color` opaque and uses it as the inverted glyph color on hover (Breeze style). A transparent black made hovered glyphs invisible on the dark hover pill. - Sub-windows do not read `app.use_system_title_bar`. Before this PR they did not honor it either. Supporting it would need WindowManager pool standbys to accept dynamic options, which is an upstream change left out of scope. The following alternatives were considered: - Removing the "Use system title bar" option entirely. It was kept as a fallback for desktops where WCO is unverified (e.g. KDE, which offers server-side decorations). Removal touches the preference classification, migration mappings, settings UI and i18n, so it belongs in a separate PR once WCO is validated. - Keeping the React-drawn buttons. That means continuing to maintain button styling, interaction and maximize-state sync per desktop. Links to places where the discussion took place: #21413. Approach mirrors t3code's desktop window (`titleBarStyle: 'hidden'` + transparent `titleBarOverlay` + `env(titlebar-area-*)` insets). ### Breaking changes None. The Linux custom title bar mode changes appearance: native-themed controls replace the React ones. The preference and its restart-to-apply flow are unchanged. ### Special notes for your reviewer Verified on Ubuntu GNOME, native Wayland, 1.333 fractional scale, Breeze GTK/icon theme, right-side buttons: - Through CDP, `navigator.windowControlsOverlay.visible` is true for both window types. The main window overlay is 72×44 on the right. - The `WindowControls` spacer occupies exactly x=888–960 (the overlay area), and no title-bar control overlaps it. - Hovering a control inverts its glyph (Breeze style) in the current build, confirmed by eye. The earlier `#01000000` overlay color showed no inversion. - Left-side buttons (`button-layout 'close,minimize,maximize:icon'`): - Before the fix: the overlay (x=0–72) covered the sidebar avatar and the start of the first tab. - After the fix: the avatar moves below the 44px spacer, and the first tab starts at x=74. In Settings (no sidebar), the strip pads by 74px. The sub-window title bar pads by 80px. - Switching back restores the original layout live. - MCP browser on Linux: the tab bar sees the overlay (safe area 1128 of 1200 wide). The tab row pads 80px on the side with the buttons, and the self-drawn controls are hidden. That the overlay is drawn above the tab bar BrowserView was confirmed by eye. Not yet verified / follow-ups: - X11/XWayland, KDE, and toggling the preference back and forth. - Blurriness of the native frame when the system title bar is on (fractional scaling) is a separate issue, not addressed here. ### Checklist This checklist is not enforcing, but it's a reminder of items that could be relevant to every PR. Approvers are expected to review this list. - [x] Branch: This PR targets `main` - [x] PR: The PR description is expressive enough and will help future contributors - [x] Code: [Write code that humans can understand](https://en.wikiquote.org/wiki/Martin_Fowler#code-for-humans) and [Keep it simple](https://en.wikipedia.org/wiki/KISS_principle) - [ ] Refactor: You have [left the code cleaner than you found it (Boy Scout Rule)](https://learning.oreilly.com/library/view/97-things-every/9780596809515/ch08.html) - [x] Upgrade: Impact of this change on upgrade flows was considered and addressed if required - [ ] Documentation: A [user-guide update](https://docs.cherry-ai.com) was considered and is present (link) or not required. Check this only when the PR introduces or changes a user-facing feature or behavior. - [ ] Self-review: I have reviewed my own code (e.g., via [`/gh-pr-review`](/.claude/skills/gh-pr-review/SKILL.md), `gh pr diff`, or GitHub UI) before requesting review from others ### Release note <!-- Write your release note: 1. Enter your extended release note in the below block. If the PR requires additional action from users switching to the new release, include the string "action required". 2. If no release note is required, just write "NONE". 3. Only include user-facing changes (new features, bug fixes visible to users, UI changes, behavior changes). For CI, maintenance, internal refactoring, build tooling, or other non-user-facing work, write "NONE". --> ```release-note Linux: with "Use system title bar" off, window controls are now drawn by the system icon theme (Electron Window Controls Overlay) in Cherry Studio's own title bar. Detached tab windows now always show minimize/maximize/close buttons. ``` 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: SuYao <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
This was referenced Oct 13, 2026
1 task done
7 tasks
4 tasks done
3 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of Change
Brings system-themed titlebar buttons to Linux when Window Controls Overlay (WCO) is enabled:
titlebarOverlayAPI (includingheight,color,symbolColor) and automatic contrast, like the current vector icons.The new look has been tested with a range of web content backgrounds and system configurations. (Examples below.) App developers should not need to make any changes to their app design or code to accommodate the different icons.
Resolves #44540.
Alternatives considered
Earlier in the year I looked into using GTK titlebar buttons directly for WCO. But there is too much variety in third-party GTK themes for them to be embedded automatically into web content. GTK buttons are designed to be placed inside controlled headerbar components, not arbitrary backgrounds, and the icons often use bitmap assets and cannot be tinted or switched between light/dark without changing the app's entire theme.
I also did not want to add new, hard dependencies on GTK to Electron, as it might not always link to GTK and we should build against XDG/Freedesktop standards rather than framework-specific libraries. The vector buttons in this PR are drawn entirely with Skia and do not depend on GTK. (The PR does introduce a GTK impl. for an abstract provider to load the icon glyph and theme name, but this can be upstreamed to
LinuxUi.)Upstreaming
While this feature did not require a Chromium patch, I intend to submit the new button provider and frame view changes in this PR upstream. If it is accepted, this entire implementation will be replaced with about 30 lines of code in Electron.
Examples
Breeze style on KDE (with mouse hovered over close button)
Adwaita style on GNOME (with Yaru glyphs supplied by Ubuntu)
A bunch of VS Code themes showing the effects of color and symbolColor
Assisted-By: Claude Fable 5
(Claude implemented the
FreedesktopNavButtonProviderbased on my architectural requirements. I reviewed the file and revised several times for maintainability and separation of concerns)Checklist
npm testpassesRelease Notes
Notes: Frameless windows on Linux now use system-themed titlebar icons for Window Controls Overlay (WCO).