@@ -0,0 +1,28 @@
+#![allow(clippy::disallowed_methods, reason = "build scripts are exempt")]
+
+fn main() {
+ println!("cargo::rustc-check-cfg=cfg(macos_sdk_26)");
+
+ #[cfg(target_os = "macos")]
+ {
+ use std::process::Command;
+
+ let output = Command::new("xcrun")
+ .args(["--sdk", "macosx", "--show-sdk-version"])
+ .output()
+ .unwrap();
+
+ let sdk_version = String::from_utf8(output.stdout).unwrap();
+ let major_version: Option<u32> = sdk_version
+ .trim()
+ .split('.')
+ .next()
+ .and_then(|v| v.parse().ok());
+
+ if let Some(major) = major_version
+ && major >= 26
+ {
+ println!("cargo:rustc-cfg=macos_sdk_26");
+ }
+ }
+}
@@ -1,6 +1,10 @@
-/// Use pixels here instead of a rem-based size because the macOS traffic
-/// lights are a static size, and don't scale with the rest of the UI.
-///
-/// Magic number: There is one extra pixel of padding on the left side due to
-/// the 1px border around the window on macOS apps.
+// Use pixels here instead of a rem-based size because the macOS traffic
+// lights are a static size, and don't scale with the rest of the UI.
+//
+// Magic number: There is one extra pixel of padding on the left side due to
+// the 1px border around the window on macOS apps.
+#[cfg(macos_sdk_26)]
+pub const TRAFFIC_LIGHT_PADDING: f32 = 78.;
+
+#[cfg(not(macos_sdk_26))]
pub const TRAFFIC_LIGHT_PADDING: f32 = 71.;
@@ -447,34 +447,38 @@ impl TitleBar {
return None;
}
- Some(
- Button::new("restricted_mode_trigger", "Restricted Mode")
- .style(ButtonStyle::Tinted(TintColor::Warning))
- .label_size(LabelSize::Small)
- .color(Color::Warning)
- .icon(IconName::Warning)
- .icon_color(Color::Warning)
- .icon_size(IconSize::Small)
- .icon_position(IconPosition::Start)
- .tooltip(|_, cx| {
- Tooltip::with_meta(
- "You're in Restricted Mode",
- Some(&ToggleWorktreeSecurity),
- "Mark this project as trusted and unlock all features",
- cx,
- )
- })
- .on_click({
- cx.listener(move |this, _, window, cx| {
- this.workspace
- .update(cx, |workspace, cx| {
- workspace.show_worktree_trust_security_modal(true, window, cx)
- })
- .log_err();
- })
+ let button = Button::new("restricted_mode_trigger", "Restricted Mode")
+ .style(ButtonStyle::Tinted(TintColor::Warning))
+ .label_size(LabelSize::Small)
+ .color(Color::Warning)
+ .icon(IconName::Warning)
+ .icon_color(Color::Warning)
+ .icon_size(IconSize::Small)
+ .icon_position(IconPosition::Start)
+ .tooltip(|_, cx| {
+ Tooltip::with_meta(
+ "You're in Restricted Mode",
+ Some(&ToggleWorktreeSecurity),
+ "Mark this project as trusted and unlock all features",
+ cx,
+ )
+ })
+ .on_click({
+ cx.listener(move |this, _, window, cx| {
+ this.workspace
+ .update(cx, |workspace, cx| {
+ workspace.show_worktree_trust_security_modal(true, window, cx)
+ })
+ .log_err();
})
- .into_any_element(),
- )
+ });
+
+ if cfg!(macos_sdk_26) {
+ // Make up for Tahoe's traffic light buttons having less spacing around them
+ Some(div().child(button).ml_0p5().into_any_element())
+ } else {
+ Some(button.into_any_element())
+ }
}
pub fn render_project_host(&self, cx: &mut Context<Self>) -> Option<AnyElement> {