-
Notifications
You must be signed in to change notification settings - Fork 6.1k
title_bar: Query dconf for CSD position (left/right) on Linux #39395
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
3f7334f to
6315621
Compare
a8e62b4 to
515aa4c
Compare
|
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... |
|
Please query the setting via the Settings portal; the key is available, in the GNOME format and namespace, under there. |
|
@orowith2os Ah, thanks for that tip. So the XDG Desktop Portal PR would standardize the DBus API that GNOME's portal implementation already has? |
|
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. |
|
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. |
| // 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") { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 🫠 🫠
There was a problem hiding this comment.
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.
|
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. |
|
@orowith2os What namespace and key can I to pass to org.freedesktop.impl.portal.Settings' |
|
Query the Settings portal with namespace |
|
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. |
|
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. |
|
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. |
…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
515aa4c to
be8c3ca
Compare
|
This is not ready to merge, hence the draft status. |



GNOME Tweaks has a setting for moving window control client-side decoration (CSD) buttons to the left:
This setting is read by libadwaita applications (as well as Firefox). This PR implements support for this system setting in Zed via dconf:
For comparison, here is Zed with CSD buttons on the right:

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: