From 8c2ff695155c3dc4a19d8e48cb6e54edb8c956ae Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Mon, 24 Oct 2022 09:42:59 -0600 Subject: [PATCH] Render a tooltip on toggle screen sharing button Co-Authored-By: Antonio Scandurra --- crates/collab_ui/src/collab_titlebar_item.rs | 21 ++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/crates/collab_ui/src/collab_titlebar_item.rs b/crates/collab_ui/src/collab_titlebar_item.rs index 9027a0937b..2a8870fe66 100644 --- a/crates/collab_ui/src/collab_titlebar_item.rs +++ b/crates/collab_ui/src/collab_titlebar_item.rs @@ -259,11 +259,17 @@ impl CollabTitlebarItem { ) -> Option { let active_call = ActiveCall::global(cx); let room = active_call.read(cx).room().cloned()?; - let icon = if room.read(cx).is_screen_sharing() { - "icons/disable_screen_sharing_12.svg" + let icon; + let tooltip; + + if room.read(cx).is_screen_sharing() { + icon = "icons/disable_screen_sharing_12.svg"; + tooltip = "Stop Sharing Screen" } else { - "icons/enable_screen_sharing_12.svg" - }; + icon = "icons/enable_screen_sharing_12.svg"; + tooltip = "Share Screen"; + } + let titlebar = &theme.workspace.titlebar; Some( MouseEventHandler::::new(0, cx, |state, _| { @@ -284,6 +290,13 @@ impl CollabTitlebarItem { .on_click(MouseButton::Left, move |_, cx| { cx.dispatch_action(ToggleScreenSharing); }) + .with_tooltip::( + 0, + tooltip.into(), + Some(Box::new(ToggleScreenSharing)), + theme.tooltip.clone(), + cx, + ) .aligned() .boxed(), )