feat(chat): pop out a chat into its own window
- Chat list menu "Pop out chat" and Ctrl+Enter (Teams PopoutSelectedItem) open the chat in a second window, title = chat name - Pop-out shows header with call buttons, timeline and composer; a second pop out focuses the open window - "Pop in back to the main window" button selects the chat in the main window and closes the pop-out; the title bar X only closes it, like Teams - Deviations: no "Start chat in new window" (Ctrl+Shift+N), no channel/thread/search pop out, no "Open chat in new window" setting, "Return to main window" is the header pop-in button instead of a header menu item, window size not remembered Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@@ -0,0 +1,133 @@
1
use std::collections::HashMap;
2
3
use app_ui_kit::layout::ISLAND_GAP;
4
use gpui_kit::component::v_flex;
5
use gpui_kit::*;
6
7
use super::conversation::ConversationView;
8
use super::shell::AppShell;
9
use crate::app_state::{AppState, Selection, selection_title};
10
use crate::theme;
11
12
pub const POP_OUT_CHAT_LABEL: &str = "Pop out chat";
13
pub const POP_IN_TOOLTIP: &str = "Pop in back to the main window";
14
const CHAT_WINDOW_SIZE: (f32, f32) = (760., 820.);
15
const CHAT_WINDOW_MIN_SIZE: (f32, f32) = (420., 480.);
16
17
#[derive(Default)]
18
struct ChatPopOuts {
19
windows: HashMap<String, AnyWindowHandle>,
20
opening: Vec<String>,
21
}
22
23
impl Global for ChatPopOuts {}
24
25
pub struct ChatPopOutView {
26
conversation: Entity<ConversationView>,
27
}
28
29
impl ChatPopOutView {
30
fn new(
31
app: Entity<AppState>,
32
chat_id: String,
33
window: &mut Window,
34
cx: &mut Context<Self>,
35
) -> Self {
36
let closing_chat_id = chat_id.clone();
37
window.on_window_should_close(cx, move |_, cx| {
38
forget(&closing_chat_id, cx);
39
true
40
});
41
let selection = Selection::Chat(chat_id);
42
let conversation =
43
cx.new(|cx| ConversationView::popped_out(app, selection, window, cx));
44
ChatPopOutView { conversation }
45
}
46
}
47
48
impl Render for ChatPopOutView {
49
fn render(&mut self, _window: &mut Window, _cx: &mut Context<Self>) -> impl IntoElement {
50
v_flex()
51
.id("chat-pop-out")
52
.size_full()
53
.p(px(ISLAND_GAP))
54
.bg(theme::background())
55
.child(self.conversation.clone())
56
}
57
}
58
59
fn forget(chat_id: &str, cx: &mut App) {
60
if cx.has_global::<ChatPopOuts>() {
61
cx.global_mut::<ChatPopOuts>().windows.remove(chat_id);
62
}
63
}
64
65
pub fn pop_out_chat(app: &Entity<AppState>, chat_id: &str, cx: &mut App) {
66
let pop_outs = cx.default_global::<ChatPopOuts>();
67
if pop_outs.opening.iter().any(|opening| opening == chat_id) {
68
return;
69
}
70
if let Some(handle) = pop_outs.windows.get(chat_id).copied() {
71
if handle
72
.update(cx, |_, window, _| window.activate_window())
73
.is_ok()
74
{
75
return;
76
}
77
cx.global_mut::<ChatPopOuts>().windows.remove(chat_id);
78
}
79
cx.global_mut::<ChatPopOuts>()
80
.opening
81
.push(chat_id.to_owned());
82
let title = selection_title(&app.read(cx).sidebar, &Selection::Chat(chat_id.to_owned()));
83
let options = WindowOptions {
84
window_bounds: Some(WindowBounds::Windowed(Bounds::centered(
85
None,
86
size(px(CHAT_WINDOW_SIZE.0), px(CHAT_WINDOW_SIZE.1)),
87
cx,
88
))),
89
window_min_size: Some(size(
90
px(CHAT_WINDOW_MIN_SIZE.0),
91
px(CHAT_WINDOW_MIN_SIZE.1),
92
)),
93
titlebar: Some(TitlebarOptions {
94
title: Some(title.into()),
95
..Default::default()
96
}),
97
..Default::default()
98
};
99
let (app, chat_id) = (app.clone(), chat_id.to_owned());
100
// open_window draws right away, and the conversation view reads the app entity while rendering.
101
cx.defer(move |cx| {
102
let window_chat_id = chat_id.clone();
103
let opened = gpui_kit::open_window(options, cx, move |window, cx| {
104
cx.new(|cx| ChatPopOutView::new(app, window_chat_id, window, cx))
105
});
106
let pop_outs = cx.global_mut::<ChatPopOuts>();
107
pop_outs.opening.retain(|opening| opening != &chat_id);
108
if let Ok((handle, _)) = opened {
109
pop_outs.windows.insert(chat_id, handle);
110
}
111
});
112
}
113
114
pub fn return_to_main_window(
115
app: &Entity<AppState>,
116
chat_id: &str,
117
window: &mut Window,
118
cx: &mut App,
119
) {
120
forget(chat_id, cx);
121
let selection = Selection::Chat(chat_id.to_owned());
122
app.update(cx, |state, cx| state.select(selection, cx));
123
let main_window = cx
124
.windows()
125
.into_iter()
126
.find(|handle| handle.downcast::<AppShell>().is_some());
127
if let Some(main_window) = main_window {
128
main_window
129
.update(cx, |_, window, _| window.activate_window())
130
.ok();
131
}
132
window.remove_window();
133
}
@@ -0,0 +1,133 @@1
use std::collections::HashMap;2
3
use app_ui_kit::layout::ISLAND_GAP;4
use gpui_kit::component::v_flex;5
use gpui_kit::*;6
7
use super::conversation::ConversationView;8
use super::shell::AppShell;9
use crate::app_state::{AppState, Selection, selection_title};10
use crate::theme;11
12
pub const POP_OUT_CHAT_LABEL: &str = "Pop out chat";13
pub const POP_IN_TOOLTIP: &str = "Pop in back to the main window";14
const CHAT_WINDOW_SIZE: (f32, f32) = (760., 820.);15
const CHAT_WINDOW_MIN_SIZE: (f32, f32) = (420., 480.);16
17
#[derive(Default)]18
struct ChatPopOuts {19
windows: HashMap<String, AnyWindowHandle>,20
opening: Vec<String>,21
}22
23
impl Global for ChatPopOuts {}24
25
pub struct ChatPopOutView {26
conversation: Entity<ConversationView>,27
}28
29
impl ChatPopOutView {30
fn new(31
app: Entity<AppState>,32
chat_id: String,33
window: &mut Window,34
cx: &mut Context<Self>,35
) -> Self {36
let closing_chat_id = chat_id.clone();37
window.on_window_should_close(cx, move |_, cx| {38
forget(&closing_chat_id, cx);39
true40
});41
let selection = Selection::Chat(chat_id);42
let conversation =43
cx.new(|cx| ConversationView::popped_out(app, selection, window, cx));44
ChatPopOutView { conversation }45
}46
}47
48
impl Render for ChatPopOutView {49
fn render(&mut self, _window: &mut Window, _cx: &mut Context<Self>) -> impl IntoElement {50
v_flex()51
.id("chat-pop-out")52
.size_full()53
.p(px(ISLAND_GAP))54
.bg(theme::background())55
.child(self.conversation.clone())56
}57
}58
59
fn forget(chat_id: &str, cx: &mut App) {60
if cx.has_global::<ChatPopOuts>() {61
cx.global_mut::<ChatPopOuts>().windows.remove(chat_id);62
}63
}64
65
pub fn pop_out_chat(app: &Entity<AppState>, chat_id: &str, cx: &mut App) {66
let pop_outs = cx.default_global::<ChatPopOuts>();67
if pop_outs.opening.iter().any(|opening| opening == chat_id) {68
return;69
}70
if let Some(handle) = pop_outs.windows.get(chat_id).copied() {71
if handle72
.update(cx, |_, window, _| window.activate_window())73
.is_ok()74
{75
return;76
}77
cx.global_mut::<ChatPopOuts>().windows.remove(chat_id);78
}79
cx.global_mut::<ChatPopOuts>()80
.opening81
.push(chat_id.to_owned());82
let title = selection_title(&app.read(cx).sidebar, &Selection::Chat(chat_id.to_owned()));83
let options = WindowOptions {84
window_bounds: Some(WindowBounds::Windowed(Bounds::centered(85
None,86
size(px(CHAT_WINDOW_SIZE.0), px(CHAT_WINDOW_SIZE.1)),87
cx,88
))),89
window_min_size: Some(size(90
px(CHAT_WINDOW_MIN_SIZE.0),91
px(CHAT_WINDOW_MIN_SIZE.1),92
)),93
titlebar: Some(TitlebarOptions {94
title: Some(title.into()),95
..Default::default()96
}),97
..Default::default()98
};99
let (app, chat_id) = (app.clone(), chat_id.to_owned());100
// open_window draws right away, and the conversation view reads the app entity while rendering.101
cx.defer(move |cx| {102
let window_chat_id = chat_id.clone();103
let opened = gpui_kit::open_window(options, cx, move |window, cx| {104
cx.new(|cx| ChatPopOutView::new(app, window_chat_id, window, cx))105
});106
let pop_outs = cx.global_mut::<ChatPopOuts>();107
pop_outs.opening.retain(|opening| opening != &chat_id);108
if let Ok((handle, _)) = opened {109
pop_outs.windows.insert(chat_id, handle);110
}111
});112
}113
114
pub fn return_to_main_window(115
app: &Entity<AppState>,116
chat_id: &str,117
window: &mut Window,118
cx: &mut App,119
) {120
forget(chat_id, cx);121
let selection = Selection::Chat(chat_id.to_owned());122
app.update(cx, |state, cx| state.select(selection, cx));123
let main_window = cx124
.windows()125
.into_iter()126
.find(|handle| handle.downcast::<AppShell>().is_some());127
if let Some(main_window) = main_window {128
main_window129
.update(cx, |_, window, _| window.activate_window())130
.ok();131
}132
window.remove_window();133
}@@ -51,6 +51,7 @@ use super::avatar::{
51
51
use super::call_controls::header_call_controls;
52
52
use super::channel_tabs::{ChannelPane, HEADER_TITLE_MAX_WIDTH};
53
53
use super::chat_members::members_popover;
54
use super::chat_pop_out;
54
55
use super::composer::{Composer, ComposerEvent, EditPreview, Outgoing, ReplyPreview};
55
56
use super::find_panel::{FIND_PANEL_WIDTH, FindPanel, FindPanelEvent};
56
57
use super::group_name::group_name_button;
@@ -110,6 +111,7 @@ pub const FEED_EDGE_TAG: &str = "shell/islands/main/timeline/divider-feed";
110
111
const HEADER_HEIGHT: f32 = 60.;
111
112
const HEADER_PADDING: f32 = 20.;
112
113
const HEADER_GAP: f32 = 12.;
114
const POP_IN_BUTTON_SIZE: f32 = 32.;
113
115
const HEADER_LEAD_SIZE: f32 = 36.;
114
116
const TABS_INLINE_MIN_WIDTH: f32 = 560.;
115
117
const FIND_MIN_TIMELINE_WIDTH: f32 = 360.;
@@ -198,6 +200,7 @@ enum ReactionAttempt {
198
200
pub struct ConversationView {
199
201
app: Entity<AppState>,
200
202
pinned: bool,
203
popped_out: bool,
201
204
scroller: Entity<MessageScrollerState>,
202
205
composer: Entity<Composer>,
203
206
subject: Entity<InputState>,
@@ -492,6 +495,17 @@ impl ConversationView {
492
495
Self::build(app, Some(selection), window, cx)
493
496
}
494
497
498
pub fn popped_out(
499
app: Entity<AppState>,
500
selection: Selection,
501
window: &mut Window,
502
cx: &mut Context<Self>,
503
) -> Self {
504
let mut view = Self::build(app, Some(selection), window, cx);
505
view.popped_out = true;
506
view
507
}
508
495
509
fn build(
496
510
app: Entity<AppState>,
497
511
pinned: Option<Selection>,
@@ -533,6 +547,7 @@ impl ConversationView {
533
547
let mut view = ConversationView {
534
548
app,
535
549
pinned: pinned.is_some(),
550
popped_out: false,
536
551
scroller,
537
552
composer,
538
553
subject,
@@ -3474,7 +3489,7 @@ impl ConversationView {
3474
3489
if let Some(note) = channel_note {
3475
3490
subline = note.to_owned();
3476
3491
}
3477
let call_controls = if self.pinned {
3492
let call_controls = if self.pinned && !self.popped_out {
3478
3493
Vec::new()
3479
3494
} else {
3480
3495
header_call_controls(&self.app, app, ¤t.selection)
@@ -3540,6 +3555,29 @@ impl ConversationView {
3540
3555
.children(stack)
3541
3556
.children(call_controls)
3542
3557
.children(self.channel_details_button(cx))
3558
.children(self.pop_in_button(current))
3559
}
3560
3561
fn pop_in_button(&self, current: &Current) -> Option<AnyElement> {
3562
let Selection::Chat(chat_id) = ¤t.selection else {
3563
return None;
3564
};
3565
if !self.popped_out {
3566
return None;
3567
}
3568
let (app, chat_id) = (self.app.clone(), chat_id.clone());
3569
Some(
3570
Button::new("chat-pop-in")
3571
.icon(IconName::SquareArrowDownLeft)
3572
.ghost()
3573
.size(px(POP_IN_BUTTON_SIZE))
3574
.rounded(px(8.))
3575
.tooltip(chat_pop_out::POP_IN_TOOLTIP)
3576
.on_click(move |_, window, cx| {
3577
chat_pop_out::return_to_main_window(&app, &chat_id, window, cx)
3578
})
3579
.into_any_element(),
3580
)
3543
3581
}
3544
3582
}
3545
3583
@@ -51,6 +51,7 @@ use super::avatar::{51
use super::call_controls::header_call_controls;51
use super::call_controls::header_call_controls;52
use super::channel_tabs::{ChannelPane, HEADER_TITLE_MAX_WIDTH};52
use super::channel_tabs::{ChannelPane, HEADER_TITLE_MAX_WIDTH};53
use super::chat_members::members_popover;53
use super::chat_members::members_popover;54
use super::chat_pop_out;54
use super::composer::{Composer, ComposerEvent, EditPreview, Outgoing, ReplyPreview};55
use super::composer::{Composer, ComposerEvent, EditPreview, Outgoing, ReplyPreview};55
use super::find_panel::{FIND_PANEL_WIDTH, FindPanel, FindPanelEvent};56
use super::find_panel::{FIND_PANEL_WIDTH, FindPanel, FindPanelEvent};56
use super::group_name::group_name_button;57
use super::group_name::group_name_button;@@ -110,6 +111,7 @@ pub const FEED_EDGE_TAG: &str = "shell/islands/main/timeline/divider-feed";110
const HEADER_HEIGHT: f32 = 60.;111
const HEADER_HEIGHT: f32 = 60.;111
const HEADER_PADDING: f32 = 20.;112
const HEADER_PADDING: f32 = 20.;112
const HEADER_GAP: f32 = 12.;113
const HEADER_GAP: f32 = 12.;114
const POP_IN_BUTTON_SIZE: f32 = 32.;113
const HEADER_LEAD_SIZE: f32 = 36.;115
const HEADER_LEAD_SIZE: f32 = 36.;114
const TABS_INLINE_MIN_WIDTH: f32 = 560.;116
const TABS_INLINE_MIN_WIDTH: f32 = 560.;115
const FIND_MIN_TIMELINE_WIDTH: f32 = 360.;117
const FIND_MIN_TIMELINE_WIDTH: f32 = 360.;@@ -198,6 +200,7 @@ enum ReactionAttempt {198
pub struct ConversationView {200
pub struct ConversationView {199
app: Entity<AppState>,201
app: Entity<AppState>,200
pinned: bool,202
pinned: bool,203
popped_out: bool,201
scroller: Entity<MessageScrollerState>,204
scroller: Entity<MessageScrollerState>,202
composer: Entity<Composer>,205
composer: Entity<Composer>,203
subject: Entity<InputState>,206
subject: Entity<InputState>,@@ -492,6 +495,17 @@ impl ConversationView {492
Self::build(app, Some(selection), window, cx)495
Self::build(app, Some(selection), window, cx)493
}496
}494
497
498
pub fn popped_out(499
app: Entity<AppState>,500
selection: Selection,501
window: &mut Window,502
cx: &mut Context<Self>,503
) -> Self {504
let mut view = Self::build(app, Some(selection), window, cx);505
view.popped_out = true;506
view507
}508
495
fn build(509
fn build(496
app: Entity<AppState>,510
app: Entity<AppState>,497
pinned: Option<Selection>,511
pinned: Option<Selection>,@@ -533,6 +547,7 @@ impl ConversationView {533
let mut view = ConversationView {547
let mut view = ConversationView {534
app,548
app,535
pinned: pinned.is_some(),549
pinned: pinned.is_some(),550
popped_out: false,536
scroller,551
scroller,537
composer,552
composer,538
subject,553
subject,@@ -3474,7 +3489,7 @@ impl ConversationView {3474
if let Some(note) = channel_note {3489
if let Some(note) = channel_note {3475
subline = note.to_owned();3490
subline = note.to_owned();3476
}3491
}3477
let call_controls = if self.pinned {3492
let call_controls = if self.pinned && !self.popped_out {3478
Vec::new()3493
Vec::new()3479
} else {3494
} else {3480
header_call_controls(&self.app, app, ¤t.selection)3495
header_call_controls(&self.app, app, ¤t.selection)@@ -3540,6 +3555,29 @@ impl ConversationView {3540
.children(stack)3555
.children(stack)3541
.children(call_controls)3556
.children(call_controls)3542
.children(self.channel_details_button(cx))3557
.children(self.channel_details_button(cx))3558
.children(self.pop_in_button(current))3559
}3560
3561
fn pop_in_button(&self, current: &Current) -> Option<AnyElement> {3562
let Selection::Chat(chat_id) = ¤t.selection else {3563
return None;3564
};3565
if !self.popped_out {3566
return None;3567
}3568
let (app, chat_id) = (self.app.clone(), chat_id.clone());3569
Some(3570
Button::new("chat-pop-in")3571
.icon(IconName::SquareArrowDownLeft)3572
.ghost()3573
.size(px(POP_IN_BUTTON_SIZE))3574
.rounded(px(8.))3575
.tooltip(chat_pop_out::POP_IN_TOOLTIP)3576
.on_click(move |_, window, cx| {3577
chat_pop_out::return_to_main_window(&app, &chat_id, window, cx)3578
})3579
.into_any_element(),3580
)3543
}3581
}3544
}3582
}3545
3583
@@ -35,6 +35,7 @@ pub mod card_media;
35
35
pub mod card_table;
36
36
pub mod card_widgets;
37
37
pub mod chat_members;
38
pub mod chat_pop_out;
38
39
pub mod composer;
39
40
pub mod connection_banner;
40
41
pub mod conversation;
@@ -35,6 +35,7 @@ pub mod card_media;35
pub mod card_table;35
pub mod card_table;36
pub mod card_widgets;36
pub mod card_widgets;37
pub mod chat_members;37
pub mod chat_members;38
pub mod chat_pop_out;38
pub mod composer;39
pub mod composer;39
pub mod connection_banner;40
pub mod connection_banner;40
pub mod conversation;41
pub mod conversation;@@ -22,13 +22,14 @@ use super::saved_panel::{SavedPanel, SavedPanelEvent};
22
22
use super::shortcuts::{
23
23
AcceptCall, ClearChatFilters, DeclineCall, FilterMeetingChats, FilterMutedChats,
24
24
FilterNonMeetingChats, FilterUnreadChats, FindInChat, HangUpCall, JoinMeetingFromToast, JumpToLastReadOrNewest, NextConversation, OpenActivity,
25
OpenAgents, OpenCallsTab, OpenSettings, OpenChannelsTab, OpenChatFilter, OpenChatsTab, OpenLobbyList, OpenSaved, PreviousConversation, PushToTalk,
25
OpenAgents, OpenCallsTab, OpenSettings, OpenChannelsTab, OpenChatFilter, OpenChatsTab, PopOutSelectedChat, OpenLobbyList, OpenSaved, PreviousConversation, PushToTalk,
26
26
Scope, ShowShortcuts, StartAudioCall, StartVideoCall, ToggleCallCamera, ToggleCallFullscreen,
27
27
ToggleCallHand, ToggleCallShare, ZoomIn, ZoomOut, ZoomReset, ZoomShareIn, ZoomShareOut,
28
28
ZoomShareReset,
29
29
};
30
30
use super::window_zoom::{WindowZoom, change_zoom};
31
31
use super::call_pop_out::zoom_listener;
32
use super::chat_pop_out;
32
33
use super::shortcuts_dialog::{ShortcutsDialog, ShortcutsDialogEvent};
33
34
use super::sidebar::{SidebarEvent, SidebarView};
34
35
use app_ui_kit::render::hooks::RenderHooks;
@@ -981,6 +982,12 @@ impl Render for AppShell {
981
982
this.conversation
982
983
.update(cx, |conversation, cx| conversation.open_find(window, cx));
983
984
}))
985
.on_action(cx.listener(|this, _: &PopOutSelectedChat, _, cx| {
986
let selected = this.state.read(cx).selection.clone();
987
if let Some(Selection::Chat(chat_id)) = selected {
988
chat_pop_out::pop_out_chat(&this.state, &chat_id, cx);
989
}
990
}))
984
991
.on_action(cx.listener(|this, _: &OpenChatFilter, window, cx| {
985
992
this.close_image_viewer(window, cx);
986
993
this.sidebar
@@ -22,13 +22,14 @@ use super::saved_panel::{SavedPanel, SavedPanelEvent};22
use super::shortcuts::{22
use super::shortcuts::{23
AcceptCall, ClearChatFilters, DeclineCall, FilterMeetingChats, FilterMutedChats,23
AcceptCall, ClearChatFilters, DeclineCall, FilterMeetingChats, FilterMutedChats,24
FilterNonMeetingChats, FilterUnreadChats, FindInChat, HangUpCall, JoinMeetingFromToast, JumpToLastReadOrNewest, NextConversation, OpenActivity,24
FilterNonMeetingChats, FilterUnreadChats, FindInChat, HangUpCall, JoinMeetingFromToast, JumpToLastReadOrNewest, NextConversation, OpenActivity,25
OpenAgents, OpenCallsTab, OpenSettings, OpenChannelsTab, OpenChatFilter, OpenChatsTab, OpenLobbyList, OpenSaved, PreviousConversation, PushToTalk,25
OpenAgents, OpenCallsTab, OpenSettings, OpenChannelsTab, OpenChatFilter, OpenChatsTab, PopOutSelectedChat, OpenLobbyList, OpenSaved, PreviousConversation, PushToTalk,26
Scope, ShowShortcuts, StartAudioCall, StartVideoCall, ToggleCallCamera, ToggleCallFullscreen,26
Scope, ShowShortcuts, StartAudioCall, StartVideoCall, ToggleCallCamera, ToggleCallFullscreen,27
ToggleCallHand, ToggleCallShare, ZoomIn, ZoomOut, ZoomReset, ZoomShareIn, ZoomShareOut,27
ToggleCallHand, ToggleCallShare, ZoomIn, ZoomOut, ZoomReset, ZoomShareIn, ZoomShareOut,28
ZoomShareReset,28
ZoomShareReset,29
};29
};30
use super::window_zoom::{WindowZoom, change_zoom};30
use super::window_zoom::{WindowZoom, change_zoom};31
use super::call_pop_out::zoom_listener;31
use super::call_pop_out::zoom_listener;32
use super::chat_pop_out;32
use super::shortcuts_dialog::{ShortcutsDialog, ShortcutsDialogEvent};33
use super::shortcuts_dialog::{ShortcutsDialog, ShortcutsDialogEvent};33
use super::sidebar::{SidebarEvent, SidebarView};34
use super::sidebar::{SidebarEvent, SidebarView};34
use app_ui_kit::render::hooks::RenderHooks;35
use app_ui_kit::render::hooks::RenderHooks;@@ -981,6 +982,12 @@ impl Render for AppShell {981
this.conversation982
this.conversation982
.update(cx, |conversation, cx| conversation.open_find(window, cx));983
.update(cx, |conversation, cx| conversation.open_find(window, cx));983
}))984
}))985
.on_action(cx.listener(|this, _: &PopOutSelectedChat, _, cx| {986
let selected = this.state.read(cx).selection.clone();987
if let Some(Selection::Chat(chat_id)) = selected {988
chat_pop_out::pop_out_chat(&this.state, &chat_id, cx);989
}990
}))984
.on_action(cx.listener(|this, _: &OpenChatFilter, window, cx| {991
.on_action(cx.listener(|this, _: &OpenChatFilter, window, cx| {985
this.close_image_viewer(window, cx);992
this.close_image_viewer(window, cx);986
this.sidebar993
this.sidebar@@ -31,6 +31,7 @@ actions!(
31
31
OpenCallsTab,
32
32
OpenAgents,
33
33
OpenChatFilter,
34
PopOutSelectedChat,
34
35
FindInChat,
35
36
FilterUnreadChats,
36
37
FilterNonMeetingChats,
@@ -124,6 +125,7 @@ macro_rules! shortcut {
124
125
pub const SHORTCUTS: &[Shortcut] = &[
125
126
shortcut!(General, OutsideComposer, "Search and switch chats", "ctrl-k", Some("cmd-k"), OpenSwitcher),
126
127
shortcut!(General, Global, "New chat", "ctrl-n", Some("cmd-n"), NewChat),
128
shortcut!(General, OutsideTextFields, "Pop out selected chat", "ctrl-enter", Some("cmd-enter"), PopOutSelectedChat),
127
129
shortcut!(General, GlobalOverTextFields, "Keyboard shortcuts", "ctrl-.", Some("cmd-."), ShowShortcuts),
128
130
shortcut!(General, GlobalOverTextFields, "Settings", "ctrl-,", Some("cmd-,"), OpenSettings),
129
131
shortcut!(General, OutsideComposer, "Zoom in", "ctrl-=", Some("cmd-="), ZoomIn),
@@ -31,6 +31,7 @@ actions!(31
OpenCallsTab,31
OpenCallsTab,32
OpenAgents,32
OpenAgents,33
OpenChatFilter,33
OpenChatFilter,34
PopOutSelectedChat,34
FindInChat,35
FindInChat,35
FilterUnreadChats,36
FilterUnreadChats,36
FilterNonMeetingChats,37
FilterNonMeetingChats,@@ -124,6 +125,7 @@ macro_rules! shortcut {124
pub const SHORTCUTS: &[Shortcut] = &[125
pub const SHORTCUTS: &[Shortcut] = &[125
shortcut!(General, OutsideComposer, "Search and switch chats", "ctrl-k", Some("cmd-k"), OpenSwitcher),126
shortcut!(General, OutsideComposer, "Search and switch chats", "ctrl-k", Some("cmd-k"), OpenSwitcher),126
shortcut!(General, Global, "New chat", "ctrl-n", Some("cmd-n"), NewChat),127
shortcut!(General, Global, "New chat", "ctrl-n", Some("cmd-n"), NewChat),128
shortcut!(General, OutsideTextFields, "Pop out selected chat", "ctrl-enter", Some("cmd-enter"), PopOutSelectedChat),127
shortcut!(General, GlobalOverTextFields, "Keyboard shortcuts", "ctrl-.", Some("cmd-."), ShowShortcuts),129
shortcut!(General, GlobalOverTextFields, "Keyboard shortcuts", "ctrl-.", Some("cmd-."), ShowShortcuts),128
shortcut!(General, GlobalOverTextFields, "Settings", "ctrl-,", Some("cmd-,"), OpenSettings),130
shortcut!(General, GlobalOverTextFields, "Settings", "ctrl-,", Some("cmd-,"), OpenSettings),129
shortcut!(General, OutsideComposer, "Zoom in", "ctrl-=", Some("cmd-="), ZoomIn),131
shortcut!(General, OutsideComposer, "Zoom in", "ctrl-=", Some("cmd-="), ZoomIn),@@ -19,6 +19,7 @@ use teams_core::{ChatNotificationMode, DesktopNotifications, is_notes_chat};
19
19
use super::activity_panel::ActivityPanel;
20
20
use super::avatar::{spec_avatar, square_avatar, with_presence};
21
21
use super::calls_tab::calls_body;
22
use super::chat_pop_out;
22
23
use super::saved_panel::SavedPanel;
23
24
use super::scroll_edge::{scroll_offset, with_top_edge};
24
25
use super::section_dialog::{SectionNameTarget, open_section_name_dialog};
@@ -218,7 +219,7 @@ fn chat_menu(
218
219
}),
219
220
);
220
221
if notes {
221
return popup;
222
return popup.item(pop_out_item(context, target));
222
223
}
223
224
popup = popup.item(
224
225
PopupMenuItem::new(if muted { "Unmute" } else { "Mute" })
@@ -232,6 +233,7 @@ fn chat_menu(
232
233
}),
233
234
);
234
235
popup = chat_notifications_submenu(popup, window, cx, context, target)
236
.item(pop_out_item(context, target))
235
237
.separator()
236
238
.item(
237
239
PopupMenuItem::new("Hide")
@@ -269,6 +271,13 @@ fn chat_menu(
269
271
popup
270
272
}
271
273
274
fn pop_out_item(context: &MenuContext, target: &ChatMenuTarget) -> PopupMenuItem {
275
let (state, chat_id) = (context.state.clone(), target.id.clone());
276
PopupMenuItem::new(chat_pop_out::POP_OUT_CHAT_LABEL)
277
.icon(menu_icon(IconName::ExternalLink))
278
.on_click(move |_, _, cx| chat_pop_out::pop_out_chat(&state, &chat_id, cx))
279
}
280
272
281
const CHAT_NOTIFICATION_MODES: [(&str, ChatNotificationMode); 2] = [
273
282
("All new messages", ChatNotificationMode::AllNewMessages),
274
283
("Mute", ChatNotificationMode::Mute),
@@ -19,6 +19,7 @@ use teams_core::{ChatNotificationMode, DesktopNotifications, is_notes_chat};19
use super::activity_panel::ActivityPanel;19
use super::activity_panel::ActivityPanel;20
use super::avatar::{spec_avatar, square_avatar, with_presence};20
use super::avatar::{spec_avatar, square_avatar, with_presence};21
use super::calls_tab::calls_body;21
use super::calls_tab::calls_body;22
use super::chat_pop_out;22
use super::saved_panel::SavedPanel;23
use super::saved_panel::SavedPanel;23
use super::scroll_edge::{scroll_offset, with_top_edge};24
use super::scroll_edge::{scroll_offset, with_top_edge};24
use super::section_dialog::{SectionNameTarget, open_section_name_dialog};25
use super::section_dialog::{SectionNameTarget, open_section_name_dialog};@@ -218,7 +219,7 @@ fn chat_menu(218
}),219
}),219
);220
);220
if notes {221
if notes {221
return popup;222
return popup.item(pop_out_item(context, target));222
}223
}223
popup = popup.item(224
popup = popup.item(224
PopupMenuItem::new(if muted { "Unmute" } else { "Mute" })225
PopupMenuItem::new(if muted { "Unmute" } else { "Mute" })@@ -232,6 +233,7 @@ fn chat_menu(232
}),233
}),233
);234
);234
popup = chat_notifications_submenu(popup, window, cx, context, target)235
popup = chat_notifications_submenu(popup, window, cx, context, target)236
.item(pop_out_item(context, target))235
.separator()237
.separator()236
.item(238
.item(237
PopupMenuItem::new("Hide")239
PopupMenuItem::new("Hide")@@ -269,6 +271,13 @@ fn chat_menu(269
popup271
popup270
}272
}271
273
274
fn pop_out_item(context: &MenuContext, target: &ChatMenuTarget) -> PopupMenuItem {275
let (state, chat_id) = (context.state.clone(), target.id.clone());276
PopupMenuItem::new(chat_pop_out::POP_OUT_CHAT_LABEL)277
.icon(menu_icon(IconName::ExternalLink))278
.on_click(move |_, _, cx| chat_pop_out::pop_out_chat(&state, &chat_id, cx))279
}280
272
const CHAT_NOTIFICATION_MODES: [(&str, ChatNotificationMode); 2] = [281
const CHAT_NOTIFICATION_MODES: [(&str, ChatNotificationMode); 2] = [273
("All new messages", ChatNotificationMode::AllNewMessages),282
("All new messages", ChatNotificationMode::AllNewMessages),274
("Mute", ChatNotificationMode::Mute),283
("Mute", ChatNotificationMode::Mute),