Skip to content

Conversation

@sousaakira
Copy link
Contributor

@sousaakira sousaakira commented Sep 24, 2025

Release Notes:

  • Added the ability to customize in which side (left or right) the windows controls are rendered on Linux.

🎯 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

  • New title_bar.window_controls_position setting with "left" and "right" options
  • Left positioning: macOS style (Close → Minimize → Maximize)
  • Right positioning: Windows style (Minimize → Maximize → Close)
  • Fixed transparent background issues for window controls
  • Maintains consistent styling with Zed's theme

🔧 Technical Changes

Settings System

  • Added WindowControlsPosition enum in settings_content.rs
  • Extended TitleBarSettingsContent with window_controls_position field
  • Updated TitleBarSettings to include the new configuration

Title Bar Layout

  • Modified platform_title_bar.rs to use setting for layout positioning
  • Added conditional logic for justify_start() vs justify_between() based on position
  • Fixed transparent container background by adding bg(titlebar_color)

Window Controls

  • Updated platform_linux.rs to reorder buttons based on position setting
  • Changed button background from ghost_element_background to title_bar_background
  • Implemented proper button sequencing for both positions

🧪 How to Test

  1. Add to your Zed settings:
    {
      "title_bar": {
        "window_controls_position": "left"
      }
    }
    or
    {
      "title_bar": {
        "window_controls_position": "right"
      }
    }
  2. Restart Zed
  3. Verify buttons are positioned correctly
  4. Check that background is not transparent
  5. Test button functionality (minimize, maximize, close)

�� Expected Behavior

  • Left position: Buttons appear on the left side of the title bar in Close → Minimize → Maximize order
  • Right position: Buttons appear on the right side of the title bar in Minimize → Maximize → Close order
  • Background: Solid background matching Zed's theme (no transparency)

🔍 Files Changed

  • crates/settings/src/settings_content.rs - Added enum and setting
  • crates/title_bar/src/title_bar_settings.rs - Updated settings struct
  • crates/title_bar/src/platform_title_bar.rs - Modified layout logic
  • crates/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

  • Code compiles without errors
  • Settings are properly serialized/deserialized
  • Background transparency issues resolved
  • Button ordering works correctly for both positions
  • Layout adapts properly based on configuration
  • No breaking changes to existing functionality

🔗 Related

This addresses the need for customizable window control positioning on Linux, providing consistency with user expectations from different desktop environments.

demo2

…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]
@cla-bot
Copy link

cla-bot bot commented Sep 24, 2025

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'.

@maxdeviant maxdeviant changed the title Feature/configurable window controls position title_bar: Add configurable window controls position Sep 24, 2025
@sousaakira
Copy link
Contributor Author

@cla-bot check

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Sep 24, 2025
@cla-bot
Copy link

cla-bot bot commented Sep 24, 2025

The cla-bot has been summoned, and re-checked this pull request!

@danilo-leal
Copy link
Member

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.
@sousaakira
Copy link
Contributor Author

sousaakira commented Sep 25, 2025

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.

demo2

@sousaakira
Copy link
Contributor Author

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.

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
, allowing users to customize the title bar buttons placement.

Let me know if you need additional screenshots or testing instructions — happy to provide them!

Copy link
Member

@danilo-leal danilo-leal left a 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.

@danilo-leal danilo-leal enabled auto-merge (squash) September 26, 2025 14:59
@danilo-leal
Copy link
Member

@sousaakira There's a CI error there with the tests import; can you verify?

Comment on lines 237 to 251
/// 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,
}

Copy link
Contributor

@Be-ing Be-ing Oct 1, 2025

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.

Copy link
Contributor

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.

@danilo-leal
Copy link
Member

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.

@danilo-leal danilo-leal merged commit b479d1e into zed-industries:main Oct 21, 2025
21 checks passed
@danilo-leal
Copy link
Member

danilo-leal commented Oct 21, 2025

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.

@Be-ing
Copy link
Contributor

Be-ing commented Oct 21, 2025

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.

Be-ing added a commit to Be-ing/zed that referenced this pull request Oct 22, 2025
mikayla-maki pushed a commit that referenced this pull request Oct 22, 2025
#40839)

This reverts commit b479d1e.

This PR was accidentally merged prematurely.
#38834 (comment)

cc @danilo-leal

Release Notes:

- N/A
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

None yet

Development

Successfully merging this pull request may close these issues.

4 participants