Disable mic and screenshare buttons on non-macOS platforms (#12994)

Release Notes:

- N/A
This commit is contained in:
Mikayla Maki 2024-06-13 10:16:10 -07:00 committed by GitHub
parent 85acc2be44
commit 284559742d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 16 additions and 5 deletions

View file

@ -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"

View file

@ -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) {