-
Notifications
You must be signed in to change notification settings - Fork 6.1k
title_bar: Add configurable window controls position #38834
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
title_bar: Add configurable window controls position #38834
Conversation
…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]
|
We require contributors to sign our Contributor License Agreement, and we don't have @sousaakira on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'. |
|
@cla-bot check |
|
The cla-bot has been summoned, and re-checked this pull request! |
|
Hey, thanks for the PR! Can we get some screenshots of how this affects the UI? I don't have a Linux machine easy with me so I can experiment with it. |
- 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.
Hi! 👋 Thanks for the review. I’ve added a GIF to show how the change affects the UI: the window controls can now be positioned on the left or right as configured in the settings. This PR addresses the issue #14120 Let me know if you need additional screenshots or testing instructions — happy to provide them! |
danilo-leal
left a comment
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.
Thanks for the screenshots! Looks good to me.
|
@sousaakira There's a CI error there with the tests import; can you verify? |
| /// Position of window control buttons on Linux. | ||
| /// | ||
| /// Valid values: "left" or "right" | ||
| /// - "left": Window controls on the left side (macOS style) | ||
| /// - "right": Window controls on the right side (Windows style) | ||
| #[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema, MergeFrom, PartialEq, Eq, Default)] | ||
| #[serde(rename_all = "snake_case")] | ||
| pub enum WindowControlsPosition { | ||
| /// Window controls on the left side (macOS style) | ||
| Left, | ||
| /// Window controls on the right side (Windows style) | ||
| #[default] | ||
| Right, | ||
| } | ||
|
|
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.
Instead of making the user manually configure this in Zed's settings.json, this could be handled automatically by querying dconf.
I can make a pull request implementing this.
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.
I have implemented this in #39395.
|
Ended up resolving the merge conflicts so we can get this out the door; could you @sousaakira or @Be-ing test it out to see if it is properly working on Linux? I'd appreciate that before we merge. |
|
Shoot, this merged automatically given I had enabled auto-merge for it three weeks ago 🤦 Still appreciate a quick test here, and in case anything breaks, we just revert. |
|
I recommend reverting this ASAP before users start using it. Adding settings to Zed for this is not a good way to do it. Zed should read the system's settings, not add its own that would have to be manually configured to match the system. I started implementing that in #39395, though my focus is currently on #28754. |
…ustries#38834)" This reverts commit b479d1e. This PR was accidentally merged prematurely. zed-industries#38834 (comment)
#40839) This reverts commit b479d1e. This PR was accidentally merged prematurely. #38834 (comment) cc @danilo-leal Release Notes: - N/A
Release Notes:
🎯 Description
Adds configurable window control buttons (minimize, maximize, close) positioning for Linux, allowing users to choose between macOS-style (left side) or Windows-style (right side) placement.
✨ Features
title_bar.window_controls_positionsetting with"left"and"right"options🔧 Technical Changes
Settings System
WindowControlsPositionenum insettings_content.rsTitleBarSettingsContentwithwindow_controls_positionfieldTitleBarSettingsto include the new configurationTitle Bar Layout
platform_title_bar.rsto use setting for layout positioningjustify_start()vsjustify_between()based on positionbg(titlebar_color)Window Controls
platform_linux.rsto reorder buttons based on position settingghost_element_backgroundtotitle_bar_background🧪 How to Test
{ "title_bar": { "window_controls_position": "left" } }{ "title_bar": { "window_controls_position": "right" } }�� Expected Behavior
🔍 Files Changed
crates/settings/src/settings_content.rs- Added enum and settingcrates/title_bar/src/title_bar_settings.rs- Updated settings structcrates/title_bar/src/platform_title_bar.rs- Modified layout logiccrates/title_bar/src/platforms/platform_linux.rs- Updated button ordering and styling🎨 Design Rationale
This feature provides Linux users with the flexibility to choose their preferred window control button layout, improving the user experience by allowing them to match their desktop environment's conventions or personal preferences.
✅ Checklist
🔗 Related
This addresses the need for customizable window control positioning on Linux, providing consistency with user expectations from different desktop environments.