Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Disable mic and screenshare buttons on non-macOS platforms (#12994)
Mikayla Maki284559742d94
diff --git a/crates/collab_ui/src/collab_titlebar_item.rs b/crates/collab_ui/src/collab_titlebar_item.rsindex 3c95bc66ab7..2167fc88cfe 100644--- a/crates/collab_ui/src/collab_titlebar_item.rs+++ b/crates/collab_ui/src/collab_titlebar_item.rs@@ -58,6 +58,8 @@ impl Render for CollabTitlebarItem {let project_id = self.project.read(cx).remote_id();let workspace = self.workspace.upgrade();+ let platform_supported = cfg!(target_os = "macos");+TitleBar::new("collab-titlebar", Box::new(workspace::CloseWindow))// note: on windows titlebar behaviour is handled by the platform implementation.when(cfg!(not(windows)), |this| {@@ -243,7 +245,9 @@ impl Render for CollabTitlebarItem {).tooltip(move |cx| {Tooltip::text(- if is_muted {+ if !platform_supported {+ "Cannot share microphone"+ } else if is_muted {"Unmute microphone"} else {"Mute microphone"@@ -253,7 +257,8 @@ impl Render for CollabTitlebarItem {}).style(ButtonStyle::Subtle).icon_size(IconSize::Small)- .selected(is_muted)+ .selected(platform_supported && is_muted)+ .disabled(!platform_supported).selected_style(ButtonStyle::Tinted(TintColor::Negative)).on_click(move |_, cx| crate::toggle_mute(&Default::default(), cx)),)@@ -271,8 +276,11 @@ impl Render for CollabTitlebarItem {.selected_style(ButtonStyle::Tinted(TintColor::Negative)).icon_size(IconSize::Small).selected(is_deafened)+ .disabled(cfg!(not(target_os = "linux"))).tooltip(move |cx| {- if can_use_microphone {+ if !platform_supported {+ Tooltip::text("Cannot share microphone", cx)+ } else if can_use_microphone {Tooltip::with_meta("Deafen Audio",None,@@ -291,10 +299,13 @@ impl Render for CollabTitlebarItem {.style(ButtonStyle::Subtle).icon_size(IconSize::Small).selected(is_screen_sharing)+ .disabled(cfg!(not(target_os = "linux"))).selected_style(ButtonStyle::Tinted(TintColor::Accent)).tooltip(move |cx| {Tooltip::text(- if is_screen_sharing {+ if !platform_supported {+ "Cannot share screen"+ } else if is_screen_sharing {"Stop Sharing Screen"} else {"Share Screen"diff --git a/script/zed-local b/script/zed-localindex ab0f119bf49..81d8abbc22d 100755--- a/script/zed-local+++ b/script/zed-local@@ -72,6 +72,7 @@ const os = require("os");const platform = os.platform();let screenWidth, screenHeight;+const titleBarHeight = 24;if (platform === "darwin") {// macOS@@ -103,7 +104,6 @@ if (platform === "darwin") {}}-const titleBarHeight = 24;screenHeight -= titleBarHeight;if (isTop) {