Skip to content

Conversation

@Be-ing
Copy link
Contributor

@Be-ing Be-ing commented Oct 2, 2025

GNOME Tweaks has a setting for moving window control client-side decoration (CSD) buttons to the left:

image

This setting is read by libadwaita applications (as well as Firefox). This PR implements support for this system setting in Zed via dconf:

imageThanks to @sousaakira for starting this in #38834.

For comparison, here is Zed with CSD buttons on the right:
image

Closes #14120

Thanks to @sousaakira for starting this in #38834. In contrast to that PR, this one does not make the user configure a Zed setting; Zed automatically reads the system setting.

Release Notes:

  • Linux window min/max/close button position now follows left/right setting in GNOME Tweaks

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Oct 2, 2025
@Be-ing Be-ing changed the title Window buttons left right Linux: query dconf for CSD position (left/right) Oct 2, 2025
@Be-ing Be-ing force-pushed the window_buttons_left_right branch from 3f7334f to 6315621 Compare October 2, 2025 17:52
@maxdeviant maxdeviant changed the title Linux: query dconf for CSD position (left/right) title_bar: Query dconf for CSD position (left/right) on Linux Oct 2, 2025
@Be-ing Be-ing force-pushed the window_buttons_left_right branch 2 times, most recently from a8e62b4 to 515aa4c Compare October 2, 2025 20:36
@Be-ing
Copy link
Contributor Author

Be-ing commented Oct 2, 2025

Ha, so it turns out KDE has its own settings for this... there's an open PR to standardize this in the XDG Desktop Portal. I think for now it's fine to just use the dconf setting. Though there's more complexity than just determining left or right placement; which buttons are shown is also configurable...

@orowith2os
Copy link

Please query the setting via the Settings portal; the key is available, in the GNOME format and namespace, under there.

@Be-ing
Copy link
Contributor Author

Be-ing commented Oct 3, 2025

@orowith2os Ah, thanks for that tip. So the XDG Desktop Portal PR would standardize the DBus API that GNOME's portal implementation already has?

@orowith2os
Copy link

Correct. It will have some differences (dis)allowed in implementation, but overall, is the same. The settings portal exposes them, so as to support sandbox use cases, or allow desktops other than GNOME to expose the setting.

@Be-ing
Copy link
Contributor Author

Be-ing commented Oct 3, 2025

Okay great, I'll use zbus to get that instead of the dconf value. When the API is standardized, that code could be the basis for implementing support in ashpd, then the code directly using zbus downstream here could be removed.

Comment on lines +32 to +36
// GNOME Tweaks has settings to put the window buttons on left or right,
// as well as hide minimize/maximize buttons. Regardless of the state of
// the minimize/maximize toggles, whenever the buttons are on the left,
// the dconf value string ends with ":icon".
if value.ends_with(":icon") {
Copy link
Contributor Author

@Be-ing Be-ing Oct 3, 2025

Choose a reason for hiding this comment

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

Ha, GNOME Tweaks doesn't actually use this substring. That came from KDE's settings 🫠 https://bugs.kde.org/show_bug.cgi?id=478266#c3

Copy link
Contributor Author

Choose a reason for hiding this comment

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

And COSMIC writes just a : with neither icon nor appmenu 🫠 🫠

Choose a reason for hiding this comment

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

You need to parse the string as it is. Not try and assume things about it to make implementing it easier.

@orowith2os
Copy link

Ashpd can also read it, it just doesn't have as many convenience wrappers around it. I can't access those resources right now, but they do exist.

@Be-ing
Copy link
Contributor Author

Be-ing commented Oct 3, 2025

@orowith2os What namespace and key can I to pass to org.freedesktop.impl.portal.Settings' Read method to get GNOME's setting?

@orowith2os
Copy link

Query the Settings portal with namespace "org.gnome.desktop.wm.preferences" key "button-layout".

@Be-ing
Copy link
Contributor Author

Be-ing commented Oct 3, 2025

That doesn't return values like those described in flatpak/xdg-desktop-portal#1821. It's just another way to get the same string that dconf returns. So I guess I'll have to write more code parsing that string.

@orowith2os
Copy link

Just use the portal. It works the same inside and outside of a sandbox. Using dconf means breaking sandboxes or non-GNOME platforms that expose that gnome config via the Settings portal.

@Be-ing
Copy link
Contributor Author

Be-ing commented Oct 3, 2025

Zed's Flatpak currently uses an ugly hack to break out of the sandbox, but yeah, when that's fixed, this should still work. So I'll use dbus.

@Be-ing Be-ing marked this pull request as draft October 3, 2025 21:04
sousaakira and others added 7 commits October 6, 2025 13:42
…controle de janela

Modificações realizadas:
- Ajustada a justificação do layout no `PlatformTitleBar` para que utilize `justify_start` no estilo Linux, em vez de `justify_between`.
- Alterado o controle de janela no `LinuxWindowControls` para usar `WindowControl::new_close` para o botão de fechar e `WindowControl::new` para o botão de minimizar.

Release Notes:
- N/A
- Add WindowControlsPosition enum with Left/Right options
- Add window_controls_position setting to TitleBarSettingsContent
- Update TitleBarSettings to include new configuration
- Modify platform_title_bar.rs to use setting for layout positioning
- Update platform_linux.rs to reorder buttons based on position:
  * Left: Close -> Minimize -> Maximize (macOS style)
  * Right: Minimize -> Maximize -> Close (Windows style)
- Fix transparent background issues by using title_bar_background
- Ensure proper background for left-positioned controls container

Closes #[ISSUE_NUMBER]
- Change default position from 'left' to 'right' for better Windows compatibility
- Add comprehensive docstring explaining valid values ('left' and 'right')
- Implement Default trait for WindowControlsPosition enum
- Refactor LinuxWindowControls to reduce code duplication with build_controls helper
- Remove unnecessary unit tests to keep codebase clean

These improvements make the code more maintainable and user-friendly.
Instead of making users specify their preference for Zed in
settings.json, read the system preference.

Fixes zed-industries#14120
@arigit
Copy link

arigit commented Oct 31, 2025

any chance to have this merged? At the moment zed looks out of place in linux desktops with window controls set to the left. Also zed is not fully picking up the adwaita theme for some reason (I use zed flatpak, not sure if any connection)

Terminal: (focused)
image

Zed: (focused)
image

@Be-ing
Copy link
Contributor Author

Be-ing commented Oct 31, 2025

This is not ready to merge, hence the draft status.

@SomeoneToIgnore
Copy link
Contributor

image

Will close this PR for now to keep the queue cleaner, as more than 2 weeks had passed since the last activity and the conflicts had appeared.

@github-project-automation github-project-automation bot moved this from Community PRs to Done in Quality Week – December 2025 Nov 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

Projects

Development

Successfully merging this pull request may close these issues.

Add option for configuring left-side or right-side window control buttons on Linux

5 participants