Disable mic and screenshare buttons on non-macOS platforms (#12994)
Release Notes: - N/A
This commit is contained in:
parent
85acc2be44
commit
284559742d
2 changed files with 16 additions and 5 deletions
|
@ -58,6 +58,8 @@ impl Render for CollabTitlebarItem {
|
||||||
let project_id = self.project.read(cx).remote_id();
|
let project_id = self.project.read(cx).remote_id();
|
||||||
let workspace = self.workspace.upgrade();
|
let workspace = self.workspace.upgrade();
|
||||||
|
|
||||||
|
let platform_supported = cfg!(target_os = "macos");
|
||||||
|
|
||||||
TitleBar::new("collab-titlebar", Box::new(workspace::CloseWindow))
|
TitleBar::new("collab-titlebar", Box::new(workspace::CloseWindow))
|
||||||
// note: on windows titlebar behaviour is handled by the platform implementation
|
// note: on windows titlebar behaviour is handled by the platform implementation
|
||||||
.when(cfg!(not(windows)), |this| {
|
.when(cfg!(not(windows)), |this| {
|
||||||
|
@ -243,7 +245,9 @@ impl Render for CollabTitlebarItem {
|
||||||
)
|
)
|
||||||
.tooltip(move |cx| {
|
.tooltip(move |cx| {
|
||||||
Tooltip::text(
|
Tooltip::text(
|
||||||
if is_muted {
|
if !platform_supported {
|
||||||
|
"Cannot share microphone"
|
||||||
|
} else if is_muted {
|
||||||
"Unmute microphone"
|
"Unmute microphone"
|
||||||
} else {
|
} else {
|
||||||
"Mute microphone"
|
"Mute microphone"
|
||||||
|
@ -253,7 +257,8 @@ impl Render for CollabTitlebarItem {
|
||||||
})
|
})
|
||||||
.style(ButtonStyle::Subtle)
|
.style(ButtonStyle::Subtle)
|
||||||
.icon_size(IconSize::Small)
|
.icon_size(IconSize::Small)
|
||||||
.selected(is_muted)
|
.selected(platform_supported && is_muted)
|
||||||
|
.disabled(!platform_supported)
|
||||||
.selected_style(ButtonStyle::Tinted(TintColor::Negative))
|
.selected_style(ButtonStyle::Tinted(TintColor::Negative))
|
||||||
.on_click(move |_, cx| crate::toggle_mute(&Default::default(), cx)),
|
.on_click(move |_, cx| crate::toggle_mute(&Default::default(), cx)),
|
||||||
)
|
)
|
||||||
|
@ -271,8 +276,11 @@ impl Render for CollabTitlebarItem {
|
||||||
.selected_style(ButtonStyle::Tinted(TintColor::Negative))
|
.selected_style(ButtonStyle::Tinted(TintColor::Negative))
|
||||||
.icon_size(IconSize::Small)
|
.icon_size(IconSize::Small)
|
||||||
.selected(is_deafened)
|
.selected(is_deafened)
|
||||||
|
.disabled(cfg!(not(target_os = "linux")))
|
||||||
.tooltip(move |cx| {
|
.tooltip(move |cx| {
|
||||||
if can_use_microphone {
|
if !platform_supported {
|
||||||
|
Tooltip::text("Cannot share microphone", cx)
|
||||||
|
} else if can_use_microphone {
|
||||||
Tooltip::with_meta(
|
Tooltip::with_meta(
|
||||||
"Deafen Audio",
|
"Deafen Audio",
|
||||||
None,
|
None,
|
||||||
|
@ -291,10 +299,13 @@ impl Render for CollabTitlebarItem {
|
||||||
.style(ButtonStyle::Subtle)
|
.style(ButtonStyle::Subtle)
|
||||||
.icon_size(IconSize::Small)
|
.icon_size(IconSize::Small)
|
||||||
.selected(is_screen_sharing)
|
.selected(is_screen_sharing)
|
||||||
|
.disabled(cfg!(not(target_os = "linux")))
|
||||||
.selected_style(ButtonStyle::Tinted(TintColor::Accent))
|
.selected_style(ButtonStyle::Tinted(TintColor::Accent))
|
||||||
.tooltip(move |cx| {
|
.tooltip(move |cx| {
|
||||||
Tooltip::text(
|
Tooltip::text(
|
||||||
if is_screen_sharing {
|
if !platform_supported {
|
||||||
|
"Cannot share screen"
|
||||||
|
} else if is_screen_sharing {
|
||||||
"Stop Sharing Screen"
|
"Stop Sharing Screen"
|
||||||
} else {
|
} else {
|
||||||
"Share Screen"
|
"Share Screen"
|
||||||
|
|
|
@ -72,6 +72,7 @@ const os = require("os");
|
||||||
const platform = os.platform();
|
const platform = os.platform();
|
||||||
|
|
||||||
let screenWidth, screenHeight;
|
let screenWidth, screenHeight;
|
||||||
|
const titleBarHeight = 24;
|
||||||
|
|
||||||
if (platform === "darwin") {
|
if (platform === "darwin") {
|
||||||
// macOS
|
// macOS
|
||||||
|
@ -103,7 +104,6 @@ if (platform === "darwin") {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const titleBarHeight = 24;
|
|
||||||
screenHeight -= titleBarHeight;
|
screenHeight -= titleBarHeight;
|
||||||
|
|
||||||
if (isTop) {
|
if (isTop) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue