feat(shortcuts): more Teams keyboard shortcuts
- Go to compose box (Ctrl+R), Reply to the last message (Alt+Shift+R), Edit last message (Ctrl+Up in the compose box)
- Go to next / previous unread conversation (Ctrl+Alt+Down / Up), Go to a specific chat or channel (Ctrl+G, opens the switcher)
- Set presence status: Available Alt+Shift+Q, Busy Alt+Shift+Y, Do Not Disturb Alt+Shift+U, Be Right Back Alt+Shift+K, Away Alt+Shift+W
- Calls: Ctrl+Shift+A now accepts with video, Ctrl+Shift+S with audio (was audio on A), Toggle background blur (Ctrl+Shift+P), Toggle live captions (Alt+Shift+C)
- labels from Teams' shortcut list ("Accept video call", "Decline call")
- deviations: unread stepping covers the chat list only (channels have their own tab); not built: React to the last message, Go back / forward, next / previous section, screen share accept, Slack / Zoom presets
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@@ -926,6 +926,18 @@ impl AppState {
926
926
cx.notify();
927
927
}
928
928
929
pub fn toggle_call_background_blur(&mut self, cx: &mut Context<Self>) {
930
if self.call.is_none() {
931
return;
932
}
933
let pick = if self.call_background == BackgroundPick::Blur {
934
BackgroundPick::None
935
} else {
936
BackgroundPick::Blur
937
};
938
self.set_call_background(pick, cx);
939
}
940
929
941
pub(super) fn send_background_command(&mut self, cx: &mut Context<Self>) {
930
942
let pick = self.call_background.clone();
931
943
if let Some(choice) = self.call_backgrounds.choice_for(&pick) {
@@ -1172,9 +1184,9 @@ impl AppState {
1172
1184
}
1173
1185
}
1174
1186
1175
pub fn accept_ringing_call(&mut self, cx: &mut Context<Self>) {
1187
pub fn accept_ringing_call(&mut self, mode: AcceptMode, cx: &mut Context<Self>) {
1176
1188
if let Some(ring_id) = self.rings.first_ringing_id() {
1177
self.accept_ring(ring_id, AcceptMode::Audio, cx);
1189
self.accept_ring(ring_id, mode, cx);
1178
1190
}
1179
1191
}
1180
1192
@@ -926,6 +926,18 @@ impl AppState {926
cx.notify();926
cx.notify();927
}927
}928
928
929
pub fn toggle_call_background_blur(&mut self, cx: &mut Context<Self>) {930
if self.call.is_none() {931
return;932
}933
let pick = if self.call_background == BackgroundPick::Blur {934
BackgroundPick::None935
} else {936
BackgroundPick::Blur937
};938
self.set_call_background(pick, cx);939
}940
929
pub(super) fn send_background_command(&mut self, cx: &mut Context<Self>) {941
pub(super) fn send_background_command(&mut self, cx: &mut Context<Self>) {930
let pick = self.call_background.clone();942
let pick = self.call_background.clone();931
if let Some(choice) = self.call_backgrounds.choice_for(&pick) {943
if let Some(choice) = self.call_backgrounds.choice_for(&pick) {@@ -1172,9 +1184,9 @@ impl AppState {1172
}1184
}1173
}1185
}1174
1186
1175
pub fn accept_ringing_call(&mut self, cx: &mut Context<Self>) {1187
pub fn accept_ringing_call(&mut self, mode: AcceptMode, cx: &mut Context<Self>) {1176
if let Some(ring_id) = self.rings.first_ringing_id() {1188
if let Some(ring_id) = self.rings.first_ringing_id() {1177
self.accept_ring(ring_id, AcceptMode::Audio, cx);1189
self.accept_ring(ring_id, mode, cx);1178
}1190
}1179
}1191
}1180
1192
@@ -9,7 +9,8 @@ use teams_core::roster_event::{RosterChange, RosterEvent, SharedHistory, merge_m
9
9
use crate::app_state::{AppState, Selection, chat_title};
10
10
use crate::notice::{NoticeAction, short_error, truncated};
11
11
use crate::sidebar_model::{
12
Section, SectionInput, Step, build_sections, next_chat_id, step_id, visible_chat_ids,
12
Section, SectionInput, Step, build_sections, next_chat_id, step_id, step_unread_id,
13
visible_chat_ids,
13
14
};
14
15
15
16
pub const TITLE_LIMIT: usize = 40;
@@ -480,6 +481,14 @@ impl AppState {
480
481
step_id(&visible_chat_ids(&self.chat_sections()), current, step)
481
482
}
482
483
484
pub fn adjacent_unread_chat_id(&self, step: Step) -> Option<String> {
485
let current = match &self.selection {
486
Some(Selection::Chat(chat_id)) => Some(chat_id.as_str()),
487
_ => None,
488
};
489
step_unread_id(&self.chat_sections(), current, step)
490
}
491
483
492
fn chat_sections(&self) -> Vec<Section> {
484
493
let input = SectionInput {
485
494
chats: &self.sidebar.chats,
@@ -9,7 +9,8 @@ use teams_core::roster_event::{RosterChange, RosterEvent, SharedHistory, merge_m9
use crate::app_state::{AppState, Selection, chat_title};9
use crate::app_state::{AppState, Selection, chat_title};10
use crate::notice::{NoticeAction, short_error, truncated};10
use crate::notice::{NoticeAction, short_error, truncated};11
use crate::sidebar_model::{11
use crate::sidebar_model::{12
Section, SectionInput, Step, build_sections, next_chat_id, step_id, visible_chat_ids,12
Section, SectionInput, Step, build_sections, next_chat_id, step_id, step_unread_id,13
visible_chat_ids,13
};14
};14
15
15
pub const TITLE_LIMIT: usize = 40;16
pub const TITLE_LIMIT: usize = 40;@@ -480,6 +481,14 @@ impl AppState {480
step_id(&visible_chat_ids(&self.chat_sections()), current, step)481
step_id(&visible_chat_ids(&self.chat_sections()), current, step)481
}482
}482
483
484
pub fn adjacent_unread_chat_id(&self, step: Step) -> Option<String> {485
let current = match &self.selection {486
Some(Selection::Chat(chat_id)) => Some(chat_id.as_str()),487
_ => None,488
};489
step_unread_id(&self.chat_sections(), current, step)490
}491
483
fn chat_sections(&self) -> Vec<Section> {492
fn chat_sections(&self) -> Vec<Section> {484
let input = SectionInput {493
let input = SectionInput {485
chats: &self.sidebar.chats,494
chats: &self.sidebar.chats,@@ -521,6 +521,27 @@ pub fn step_id(ids: &[&str], current: Option<&str>, step: Step) -> Option<String
521
521
ids.get(target).map(|id| (*id).to_owned())
522
522
}
523
523
524
pub fn step_unread_id(
525
sections: &[Section],
526
current: Option<&str>,
527
step: Step,
528
) -> Option<String> {
529
let items: Vec<&ChatItem> = sections
530
.iter()
531
.filter(|section| !section.collapsed)
532
.flat_map(|section| section.items.iter())
533
.collect();
534
let position = current.and_then(|current| items.iter().position(|item| item.id == current));
535
let unread = |item: &&&ChatItem| item.unread.is_unread();
536
let found = match (position, step) {
537
(Some(position), Step::Next) => items[position + 1..].iter().find(unread),
538
(Some(position), Step::Previous) => items[..position].iter().rev().find(unread),
539
(None, Step::Next) => items.iter().find(unread),
540
(None, Step::Previous) => items.iter().rev().find(unread),
541
};
542
found.map(|item| item.id.clone())
543
}
544
524
545
pub struct ChannelOrderInput<'a> {
525
546
pub teams: &'a [SidebarTeam],
526
547
pub pinned_ids: &'a [String],
@@ -828,6 +849,37 @@ mod tests {
828
849
assert_eq!(step_id(&[], None, Step::Next), None);
829
850
}
830
851
852
#[test]
853
fn unread_stepping_skips_read_chats_in_both_directions() {
854
let directory = Directory::default();
855
let collapsed = HashSet::new();
856
let chats = [
857
chat("a", "group", true),
858
chat("b", "group", false),
859
chat("c", "group", true),
860
chat("d", "group", false),
861
];
862
let sections = build_sections(&input(&chats, &directory, &collapsed));
863
let unread: Vec<&str> = visible_chat_ids(§ions)
864
.into_iter()
865
.filter(|id| *id == "a" || *id == "c")
866
.collect();
867
let (first_unread, last_unread) = (unread[0], unread[1]);
868
assert_eq!(
869
step_unread_id(§ions, None, Step::Next).as_deref(),
870
Some(first_unread)
871
);
872
assert_eq!(step_unread_id(§ions, Some(last_unread), Step::Next), None);
873
assert_eq!(
874
step_unread_id(§ions, Some(last_unread), Step::Previous).as_deref(),
875
Some(first_unread)
876
);
877
assert_eq!(
878
step_unread_id(§ions, None, Step::Previous).as_deref(),
879
Some(last_unread)
880
);
881
}
882
831
883
#[test]
832
884
fn visible_chats_skip_collapsed_sections_and_see_more_rows() {
833
885
let mut chats = vec![chat("fav", "group", false), chat("hid", "group", false)];
@@ -521,6 +521,27 @@ pub fn step_id(ids: &[&str], current: Option<&str>, step: Step) -> Option<String521
ids.get(target).map(|id| (*id).to_owned())521
ids.get(target).map(|id| (*id).to_owned())522
}522
}523
523
524
pub fn step_unread_id(525
sections: &[Section],526
current: Option<&str>,527
step: Step,528
) -> Option<String> {529
let items: Vec<&ChatItem> = sections530
.iter()531
.filter(|section| !section.collapsed)532
.flat_map(|section| section.items.iter())533
.collect();534
let position = current.and_then(|current| items.iter().position(|item| item.id == current));535
let unread = |item: &&&ChatItem| item.unread.is_unread();536
let found = match (position, step) {537
(Some(position), Step::Next) => items[position + 1..].iter().find(unread),538
(Some(position), Step::Previous) => items[..position].iter().rev().find(unread),539
(None, Step::Next) => items.iter().find(unread),540
(None, Step::Previous) => items.iter().rev().find(unread),541
};542
found.map(|item| item.id.clone())543
}544
524
pub struct ChannelOrderInput<'a> {545
pub struct ChannelOrderInput<'a> {525
pub teams: &'a [SidebarTeam],546
pub teams: &'a [SidebarTeam],526
pub pinned_ids: &'a [String],547
pub pinned_ids: &'a [String],@@ -828,6 +849,37 @@ mod tests {828
assert_eq!(step_id(&[], None, Step::Next), None);849
assert_eq!(step_id(&[], None, Step::Next), None);829
}850
}830
851
852
#[test]853
fn unread_stepping_skips_read_chats_in_both_directions() {854
let directory = Directory::default();855
let collapsed = HashSet::new();856
let chats = [857
chat("a", "group", true),858
chat("b", "group", false),859
chat("c", "group", true),860
chat("d", "group", false),861
];862
let sections = build_sections(&input(&chats, &directory, &collapsed));863
let unread: Vec<&str> = visible_chat_ids(§ions)864
.into_iter()865
.filter(|id| *id == "a" || *id == "c")866
.collect();867
let (first_unread, last_unread) = (unread[0], unread[1]);868
assert_eq!(869
step_unread_id(§ions, None, Step::Next).as_deref(),870
Some(first_unread)871
);872
assert_eq!(step_unread_id(§ions, Some(last_unread), Step::Next), None);873
assert_eq!(874
step_unread_id(§ions, Some(last_unread), Step::Previous).as_deref(),875
Some(first_unread)876
);877
assert_eq!(878
step_unread_id(§ions, None, Step::Previous).as_deref(),879
Some(last_unread)880
);881
}882
831
#[test]883
#[test]832
fn visible_chats_skip_collapsed_sections_and_see_more_rows() {884
fn visible_chats_skip_collapsed_sections_and_see_more_rows() {833
let mut chats = vec![chat("fav", "group", false), chat("hid", "group", false)];885
let mut chats = vec![chat("fav", "group", false), chat("hid", "group", false)];@@ -30,7 +30,8 @@ actions!(
30
30
SetHeading2,
31
31
SetHeading3,
32
32
ToggleCodeBlock,
33
ToggleQuote
33
ToggleQuote,
34
EditLastMessage
34
35
]
35
36
);
36
37
@@ -30,7 +30,8 @@ actions!(30
SetHeading2,30
SetHeading2,31
SetHeading3,31
SetHeading3,32
ToggleCodeBlock,32
ToggleCodeBlock,33
ToggleQuote33
ToggleQuote,34
EditLastMessage34
]35
]35
);36
);36
37
@@ -38,8 +38,8 @@ mod schedule;
38
38
mod table;
39
39
40
40
use super::actions::{
41
COMPOSER_KEY_CONTEXT, DeleteTable, DeleteTableColumn, DeleteTableRow, EditLink,
42
InsertTableColumnLeft, InsertTableColumnRight, InsertTableLine, InsertTableRowAbove,
41
COMPOSER_KEY_CONTEXT, DeleteTable, DeleteTableColumn, DeleteTableRow, EditLastMessage,
42
EditLink, InsertTableColumnLeft, InsertTableColumnRight, InsertTableLine, InsertTableRowAbove,
43
43
InsertTableRowBelow, OpenSwitcher, PastePlainText, RemoveTableLine, ScheduleSend,
44
44
SetHeading1, SetHeading2, SetHeading3, SetParagraph, ToggleBold, ToggleCode, ToggleCodeBlock,
45
45
ToggleFormatBar, ToggleItalic, ToggleQuote, ToggleStrike, ToggleSubscript, ToggleSuperscript,
@@ -3111,6 +3111,9 @@ impl Render for Composer {
3111
3111
.on_action(cx.listener(|this, _: &ToggleFormatBar, window, cx| {
3112
3112
this.toggle_format_bar(window, cx)
3113
3113
}))
3114
.on_action(cx.listener(|_, _: &EditLastMessage, _, cx| {
3115
cx.emit(ComposerEvent::EditLast)
3116
}))
3114
3117
.on_action(cx.listener(|this, _: &InsertTableLine, window, cx| {
3115
3118
this.open_table_menu(TableLineMenu::Insert, window, cx);
3116
3119
}))
@@ -38,8 +38,8 @@ mod schedule;38
mod table;38
mod table;39
39
40
use super::actions::{40
use super::actions::{41
COMPOSER_KEY_CONTEXT, DeleteTable, DeleteTableColumn, DeleteTableRow, EditLink,41
COMPOSER_KEY_CONTEXT, DeleteTable, DeleteTableColumn, DeleteTableRow, EditLastMessage,42
InsertTableColumnLeft, InsertTableColumnRight, InsertTableLine, InsertTableRowAbove,42
EditLink, InsertTableColumnLeft, InsertTableColumnRight, InsertTableLine, InsertTableRowAbove,43
InsertTableRowBelow, OpenSwitcher, PastePlainText, RemoveTableLine, ScheduleSend,43
InsertTableRowBelow, OpenSwitcher, PastePlainText, RemoveTableLine, ScheduleSend,44
SetHeading1, SetHeading2, SetHeading3, SetParagraph, ToggleBold, ToggleCode, ToggleCodeBlock,44
SetHeading1, SetHeading2, SetHeading3, SetParagraph, ToggleBold, ToggleCode, ToggleCodeBlock,45
ToggleFormatBar, ToggleItalic, ToggleQuote, ToggleStrike, ToggleSubscript, ToggleSuperscript,45
ToggleFormatBar, ToggleItalic, ToggleQuote, ToggleStrike, ToggleSubscript, ToggleSuperscript,@@ -3111,6 +3111,9 @@ impl Render for Composer {3111
.on_action(cx.listener(|this, _: &ToggleFormatBar, window, cx| {3111
.on_action(cx.listener(|this, _: &ToggleFormatBar, window, cx| {3112
this.toggle_format_bar(window, cx)3112
this.toggle_format_bar(window, cx)3113
}))3113
}))3114
.on_action(cx.listener(|_, _: &EditLastMessage, _, cx| {3115
cx.emit(ComposerEvent::EditLast)3116
}))3114
.on_action(cx.listener(|this, _: &InsertTableLine, window, cx| {3117
.on_action(cx.listener(|this, _: &InsertTableLine, window, cx| {3115
this.open_table_menu(TableLineMenu::Insert, window, cx);3118
this.open_table_menu(TableLineMenu::Insert, window, cx);3116
}))3119
}))@@ -1249,6 +1249,11 @@ impl ConversationView {
1249
1249
.update(cx, |composer, cx| composer.focus(window, cx));
1250
1250
}
1251
1251
1252
pub fn focus_composer(&mut self, window: &mut Window, cx: &mut Context<Self>) {
1253
self.composer
1254
.update(cx, |composer, cx| composer.focus(window, cx));
1255
}
1256
1252
1257
pub fn reply_to_latest_from_others(&mut self, window: &mut Window, cx: &mut Context<Self>) {
1253
1258
let key = self
1254
1259
.rows
@@ -1249,6 +1249,11 @@ impl ConversationView {1249
.update(cx, |composer, cx| composer.focus(window, cx));1249
.update(cx, |composer, cx| composer.focus(window, cx));1250
}1250
}1251
1251
1252
pub fn focus_composer(&mut self, window: &mut Window, cx: &mut Context<Self>) {1253
self.composer1254
.update(cx, |composer, cx| composer.focus(window, cx));1255
}1256
1252
pub fn reply_to_latest_from_others(&mut self, window: &mut Window, cx: &mut Context<Self>) {1257
pub fn reply_to_latest_from_others(&mut self, window: &mut Window, cx: &mut Context<Self>) {1253
let key = self1258
let key = self1254
.rows1259
.rows@@ -1,3 +1,5 @@
1
mod team_keys;
2
1
3
use std::sync::Arc;
2
4
3
5
use gpui_kit::component::{elevation, h_flex, v_flex};
@@ -20,7 +22,7 @@ use super::rail::RailView;
20
22
use crate::chat_filter::ChatFilterPill;
21
23
use super::saved_panel::{SavedPanel, SavedPanelEvent};
22
24
use super::shortcuts::{
23
AcceptCall, ClearChatFilters, DeclineCall, FilterMeetingChats, FilterMutedChats,
25
ClearChatFilters, DeclineCall, FilterMeetingChats, FilterMutedChats,
24
26
FilterNonMeetingChats, FilterUnreadChats, FindInChat, HangUpCall, JoinMeetingFromToast, JumpToLastReadOrNewest, NextConversation, OpenActivity,
25
27
OpenAgents, OpenCallsTab, OpenSettings, OpenChannelsTab, OpenChatFilter, OpenChatsTab, OpenLobbyList, OpenSaved, PreviousConversation, PushToTalk,
26
28
Scope, ShowShortcuts, StartAudioCall, StartVideoCall, ToggleCallCamera, ToggleCallFullscreen,
@@ -919,10 +921,11 @@ impl Render for AppShell {
919
921
.flatten(),
920
922
cx.listener(|this, _, window, cx| this.toggle_switcher("", window, cx)),
921
923
);
922
div()
924
let shell = div()
923
925
.id("app-shell")
924
926
.key_context("AppShell")
925
.track_focus(&self.focus_handle)
927
.track_focus(&self.focus_handle);
928
self.team_keys(shell, cx)
926
929
.on_action(cx.listener(|this, _: &OpenSwitcher, window, cx| {
927
930
this.toggle_switcher("", window, cx);
928
931
}))
@@ -1027,10 +1030,6 @@ impl Render for AppShell {
1027
1030
this.sidebar
1028
1031
.update(cx, |sidebar, cx| sidebar.select_adjacent(Step::Next, cx));
1029
1032
}))
1030
.on_action(cx.listener(|this, _: &AcceptCall, _, cx| {
1031
this.state
1032
.update(cx, |state, cx| state.accept_ringing_call(cx));
1033
}))
1034
1033
.on_action(cx.listener(|this, _: &DeclineCall, _, cx| {
1035
1034
this.state
1036
1035
.update(cx, |state, cx| state.decline_ringing_call(cx));
@@ -1,3 +1,5 @@1
mod team_keys;2
1
use std::sync::Arc;3
use std::sync::Arc;2
4
3
use gpui_kit::component::{elevation, h_flex, v_flex};5
use gpui_kit::component::{elevation, h_flex, v_flex};@@ -20,7 +22,7 @@ use super::rail::RailView;20
use crate::chat_filter::ChatFilterPill;22
use crate::chat_filter::ChatFilterPill;21
use super::saved_panel::{SavedPanel, SavedPanelEvent};23
use super::saved_panel::{SavedPanel, SavedPanelEvent};22
use super::shortcuts::{24
use super::shortcuts::{23
AcceptCall, ClearChatFilters, DeclineCall, FilterMeetingChats, FilterMutedChats,25
ClearChatFilters, DeclineCall, FilterMeetingChats, FilterMutedChats,24
FilterNonMeetingChats, FilterUnreadChats, FindInChat, HangUpCall, JoinMeetingFromToast, JumpToLastReadOrNewest, NextConversation, OpenActivity,26
FilterNonMeetingChats, FilterUnreadChats, FindInChat, HangUpCall, JoinMeetingFromToast, JumpToLastReadOrNewest, NextConversation, OpenActivity,25
OpenAgents, OpenCallsTab, OpenSettings, OpenChannelsTab, OpenChatFilter, OpenChatsTab, OpenLobbyList, OpenSaved, PreviousConversation, PushToTalk,27
OpenAgents, OpenCallsTab, OpenSettings, OpenChannelsTab, OpenChatFilter, OpenChatsTab, OpenLobbyList, OpenSaved, PreviousConversation, PushToTalk,26
Scope, ShowShortcuts, StartAudioCall, StartVideoCall, ToggleCallCamera, ToggleCallFullscreen,28
Scope, ShowShortcuts, StartAudioCall, StartVideoCall, ToggleCallCamera, ToggleCallFullscreen,@@ -919,10 +921,11 @@ impl Render for AppShell {919
.flatten(),921
.flatten(),920
cx.listener(|this, _, window, cx| this.toggle_switcher("", window, cx)),922
cx.listener(|this, _, window, cx| this.toggle_switcher("", window, cx)),921
);923
);922
div()924
let shell = div()923
.id("app-shell")925
.id("app-shell")924
.key_context("AppShell")926
.key_context("AppShell")925
.track_focus(&self.focus_handle)927
.track_focus(&self.focus_handle);928
self.team_keys(shell, cx)926
.on_action(cx.listener(|this, _: &OpenSwitcher, window, cx| {929
.on_action(cx.listener(|this, _: &OpenSwitcher, window, cx| {927
this.toggle_switcher("", window, cx);930
this.toggle_switcher("", window, cx);928
}))931
}))@@ -1027,10 +1030,6 @@ impl Render for AppShell {1027
this.sidebar1030
this.sidebar1028
.update(cx, |sidebar, cx| sidebar.select_adjacent(Step::Next, cx));1031
.update(cx, |sidebar, cx| sidebar.select_adjacent(Step::Next, cx));1029
}))1032
}))1030
.on_action(cx.listener(|this, _: &AcceptCall, _, cx| {1031
this.state1032
.update(cx, |state, cx| state.accept_ringing_call(cx));1033
}))1034
.on_action(cx.listener(|this, _: &DeclineCall, _, cx| {1033
.on_action(cx.listener(|this, _: &DeclineCall, _, cx| {1035
this.state1034
this.state1036
.update(cx, |state, cx| state.decline_ringing_call(cx));1035
.update(cx, |state, cx| state.decline_ringing_call(cx));@@ -0,0 +1,91 @@
1
use calling::AcceptMode;
2
use gpui_kit::*;
3
use teams_core::{ForcedAvailability, ForcedKind};
4
5
use super::AppShell;
6
use crate::app_state::AppState;
7
use crate::sidebar_model::Step;
8
use crate::views::shortcuts::{
9
AcceptAudioCall, AcceptCall, GoToComposeBox, NextUnreadConversation,
10
PreviousUnreadConversation, ReplyToLastMessage, SetPresenceAvailable, SetPresenceAway,
11
SetPresenceBeRightBack, SetPresenceBusy, SetPresenceDoNotDisturb, ToggleBackgroundBlur,
12
ToggleLiveCaptions,
13
};
14
15
fn force_presence(state: &Entity<AppState>, kind: ForcedKind, cx: &mut App) {
16
let forced = ForcedAvailability {
17
kind,
18
expires_at: None,
19
};
20
state.update(cx, |state, cx| state.set_own_availability(Some(forced), cx));
21
}
22
23
fn presence_listener<A: Action>(
24
state: &Entity<AppState>,
25
kind: ForcedKind,
26
) -> impl Fn(&A, &mut Window, &mut App) + 'static {
27
let state = state.clone();
28
move |_, _, cx| force_presence(&state, kind, cx)
29
}
30
31
impl AppShell {
32
pub(super) fn team_keys(&self, shell: Stateful<Div>, cx: &mut Context<Self>) -> Stateful<Div> {
33
shell
34
.on_action(cx.listener(|this, _: &GoToComposeBox, window, cx| {
35
this.close_image_viewer(window, cx);
36
this.conversation
37
.update(cx, |conversation, cx| conversation.focus_composer(window, cx));
38
}))
39
.on_action(cx.listener(|this, _: &ReplyToLastMessage, window, cx| {
40
this.close_image_viewer(window, cx);
41
this.conversation.update(cx, |conversation, cx| {
42
conversation.reply_to_latest_from_others(window, cx)
43
});
44
}))
45
.on_action(cx.listener(|this, _: &PreviousUnreadConversation, window, cx| {
46
this.close_image_viewer(window, cx);
47
this.select_unread(Step::Previous, cx);
48
}))
49
.on_action(cx.listener(|this, _: &NextUnreadConversation, window, cx| {
50
this.close_image_viewer(window, cx);
51
this.select_unread(Step::Next, cx);
52
}))
53
.on_action(presence_listener::<SetPresenceAvailable>(&self.state, ForcedKind::Available))
54
.on_action(presence_listener::<SetPresenceBusy>(&self.state, ForcedKind::Busy))
55
.on_action(presence_listener::<SetPresenceDoNotDisturb>(
56
&self.state,
57
ForcedKind::DoNotDisturb,
58
))
59
.on_action(presence_listener::<SetPresenceBeRightBack>(
60
&self.state,
61
ForcedKind::BeRightBack,
62
))
63
.on_action(presence_listener::<SetPresenceAway>(&self.state, ForcedKind::Away))
64
.on_action(cx.listener(|this, _: &AcceptCall, _, cx| {
65
this.state
66
.update(cx, |state, cx| state.accept_ringing_call(AcceptMode::Video, cx));
67
}))
68
.on_action(cx.listener(|this, _: &AcceptAudioCall, _, cx| {
69
this.state
70
.update(cx, |state, cx| state.accept_ringing_call(AcceptMode::Audio, cx));
71
}))
72
.on_action(cx.listener(|this, _: &ToggleBackgroundBlur, _, cx| {
73
this.state
74
.update(cx, |state, cx| state.toggle_call_background_blur(cx));
75
}))
76
.on_action(cx.listener(|this, _: &ToggleLiveCaptions, _, cx| {
77
this.state
78
.update(cx, |state, cx| state.toggle_call_captions(cx));
79
}))
80
}
81
82
fn select_unread(&mut self, step: Step, cx: &mut Context<Self>) {
83
let target = self.state.read(cx).adjacent_unread_chat_id(step);
84
if let Some(chat_id) = target {
85
self.sidebar.update(cx, |sidebar, cx| sidebar.show_chats(cx));
86
self.state.update(cx, |state, cx| {
87
state.select(crate::app_state::Selection::Chat(chat_id), cx)
88
});
89
}
90
}
91
}
@@ -0,0 +1,91 @@1
use calling::AcceptMode;2
use gpui_kit::*;3
use teams_core::{ForcedAvailability, ForcedKind};4
5
use super::AppShell;6
use crate::app_state::AppState;7
use crate::sidebar_model::Step;8
use crate::views::shortcuts::{9
AcceptAudioCall, AcceptCall, GoToComposeBox, NextUnreadConversation,10
PreviousUnreadConversation, ReplyToLastMessage, SetPresenceAvailable, SetPresenceAway,11
SetPresenceBeRightBack, SetPresenceBusy, SetPresenceDoNotDisturb, ToggleBackgroundBlur,12
ToggleLiveCaptions,13
};14
15
fn force_presence(state: &Entity<AppState>, kind: ForcedKind, cx: &mut App) {16
let forced = ForcedAvailability {17
kind,18
expires_at: None,19
};20
state.update(cx, |state, cx| state.set_own_availability(Some(forced), cx));21
}22
23
fn presence_listener<A: Action>(24
state: &Entity<AppState>,25
kind: ForcedKind,26
) -> impl Fn(&A, &mut Window, &mut App) + 'static {27
let state = state.clone();28
move |_, _, cx| force_presence(&state, kind, cx)29
}30
31
impl AppShell {32
pub(super) fn team_keys(&self, shell: Stateful<Div>, cx: &mut Context<Self>) -> Stateful<Div> {33
shell34
.on_action(cx.listener(|this, _: &GoToComposeBox, window, cx| {35
this.close_image_viewer(window, cx);36
this.conversation37
.update(cx, |conversation, cx| conversation.focus_composer(window, cx));38
}))39
.on_action(cx.listener(|this, _: &ReplyToLastMessage, window, cx| {40
this.close_image_viewer(window, cx);41
this.conversation.update(cx, |conversation, cx| {42
conversation.reply_to_latest_from_others(window, cx)43
});44
}))45
.on_action(cx.listener(|this, _: &PreviousUnreadConversation, window, cx| {46
this.close_image_viewer(window, cx);47
this.select_unread(Step::Previous, cx);48
}))49
.on_action(cx.listener(|this, _: &NextUnreadConversation, window, cx| {50
this.close_image_viewer(window, cx);51
this.select_unread(Step::Next, cx);52
}))53
.on_action(presence_listener::<SetPresenceAvailable>(&self.state, ForcedKind::Available))54
.on_action(presence_listener::<SetPresenceBusy>(&self.state, ForcedKind::Busy))55
.on_action(presence_listener::<SetPresenceDoNotDisturb>(56
&self.state,57
ForcedKind::DoNotDisturb,58
))59
.on_action(presence_listener::<SetPresenceBeRightBack>(60
&self.state,61
ForcedKind::BeRightBack,62
))63
.on_action(presence_listener::<SetPresenceAway>(&self.state, ForcedKind::Away))64
.on_action(cx.listener(|this, _: &AcceptCall, _, cx| {65
this.state66
.update(cx, |state, cx| state.accept_ringing_call(AcceptMode::Video, cx));67
}))68
.on_action(cx.listener(|this, _: &AcceptAudioCall, _, cx| {69
this.state70
.update(cx, |state, cx| state.accept_ringing_call(AcceptMode::Audio, cx));71
}))72
.on_action(cx.listener(|this, _: &ToggleBackgroundBlur, _, cx| {73
this.state74
.update(cx, |state, cx| state.toggle_call_background_blur(cx));75
}))76
.on_action(cx.listener(|this, _: &ToggleLiveCaptions, _, cx| {77
this.state78
.update(cx, |state, cx| state.toggle_call_captions(cx));79
}))80
}81
82
fn select_unread(&mut self, step: Step, cx: &mut Context<Self>) {83
let target = self.state.read(cx).adjacent_unread_chat_id(step);84
if let Some(chat_id) = target {85
self.sidebar.update(cx, |sidebar, cx| sidebar.show_chats(cx));86
self.state.update(cx, |state, cx| {87
state.select(crate::app_state::Selection::Chat(chat_id), cx)88
});89
}90
}91
}@@ -2,9 +2,10 @@ use gpui_kit::component::input::Enter;
2
2
use gpui_kit::*;
3
3
4
4
use super::actions::{
5
COMPOSER_KEY_CONTEXT as COMPOSER_CONTEXT, EditLink, InsertTableLine, NewChat, OpenSwitcher,
6
PastePlainText, RemoveTableLine, ReplyToHovered, ScheduleSend, ToggleBold, ToggleCallMute,
7
ToggleCode, ToggleFormatBar, ToggleItalic, ToggleStrike, ToggleSubscript, ToggleSuperscript,
5
COMPOSER_KEY_CONTEXT as COMPOSER_CONTEXT, EditLastMessage, EditLink, InsertTableLine, NewChat,
6
OpenSwitcher, PastePlainText, RemoveTableLine, ReplyToHovered, ScheduleSend, ToggleBold,
7
ToggleCallMute, ToggleCode, ToggleFormatBar, ToggleItalic, ToggleStrike, ToggleSubscript,
8
ToggleSuperscript,
8
9
ToggleUnderline, SetParagraph, SetHeading1, SetHeading2, SetHeading3, ToggleCodeBlock,
9
10
ToggleQuote,
10
11
};
@@ -41,6 +42,18 @@ actions!(
41
42
PreviousConversation,
42
43
NextConversation,
43
44
JumpToLastReadOrNewest,
45
GoToComposeBox,
46
ReplyToLastMessage,
47
PreviousUnreadConversation,
48
NextUnreadConversation,
49
SetPresenceAvailable,
50
SetPresenceBusy,
51
SetPresenceDoNotDisturb,
52
SetPresenceBeRightBack,
53
SetPresenceAway,
54
AcceptAudioCall,
55
ToggleBackgroundBlur,
56
ToggleLiveCaptions,
44
57
AcceptCall,
45
58
DeclineCall,
46
59
JoinMeetingFromToast,
@@ -130,6 +143,11 @@ pub const SHORTCUTS: &[Shortcut] = &[
130
143
shortcut!(General, OutsideComposer, "Zoom in", "ctrl-=", Some("cmd-="), ZoomIn),
131
144
shortcut!(General, GlobalOverTextFields, "Zoom out", "ctrl--", Some("cmd--"), ZoomOut),
132
145
shortcut!(General, GlobalOverTextFields, "Reset zoom level", "ctrl-0", Some("cmd-0"), ZoomReset),
146
shortcut!(General, Global, "Set presence status to Available", "alt-shift-q", None, SetPresenceAvailable),
147
shortcut!(General, Global, "Set presence status to Busy", "alt-shift-y", None, SetPresenceBusy),
148
shortcut!(General, Global, "Set presence status to Do Not Disturb", "alt-shift-u", None, SetPresenceDoNotDisturb),
149
shortcut!(General, Global, "Set presence status to Be Right Back", "alt-shift-k", None, SetPresenceBeRightBack),
150
shortcut!(General, Global, "Set presence status to Away", "alt-shift-w", None, SetPresenceAway),
133
151
shortcut!(Navigation, GlobalOverTextFields, "Open Activity", "ctrl-1", Some("cmd-1"), OpenActivity),
134
152
shortcut!(Navigation, GlobalOverTextFields, "Show Chats", "ctrl-2", Some("cmd-2"), OpenChatsTab),
135
153
shortcut!(Navigation, GlobalOverTextFields, "Show Channels", "ctrl-3", Some("cmd-3"), OpenChannelsTab),
@@ -138,6 +156,10 @@ pub const SHORTCUTS: &[Shortcut] = &[
138
156
shortcut!(Navigation, GlobalOverTextFields, "Open Agents", "ctrl-6", Some("cmd-6"), OpenAgents),
139
157
shortcut!(Navigation, GlobalOverTextFields, "Previous chat or channel", "alt-up", None, PreviousConversation),
140
158
shortcut!(Navigation, GlobalOverTextFields, "Next chat or channel", "alt-down", None, NextConversation),
159
shortcut!(Navigation, GlobalOverTextFields, "Go to previous unread conversation", "ctrl-alt-up", None, PreviousUnreadConversation),
160
shortcut!(Navigation, GlobalOverTextFields, "Go to next unread conversation", "ctrl-alt-down", None, NextUnreadConversation),
161
shortcut!(Navigation, GlobalOverTextFields, "Go to a specific chat or channel", "ctrl-g", Some("cmd-g"), OpenSwitcher),
162
shortcut!(Navigation, Global, "Go to compose box", "ctrl-r", Some("cmd-r"), GoToComposeBox),
141
163
shortcut!(Navigation, GlobalOverTextFields, "Open filter", "ctrl-shift-f", Some("cmd-shift-f"), OpenChatFilter),
142
164
shortcut!(Navigation, OutsideTextFields, "Filter chat list by unread chats only", "ctrl-alt-u", None, FilterUnreadChats),
143
165
shortcut!(Navigation, OutsideTextFields, "Filter chat list by chats only", "ctrl-alt-c", None, FilterNonMeetingChats),
@@ -146,6 +168,8 @@ pub const SHORTCUTS: &[Shortcut] = &[
146
168
shortcut!(Navigation, OutsideTextFields, "Remove all filters in the chat list", "ctrl-alt-z", None, ClearChatFilters),
147
169
shortcut!(Composer, GlobalOverTextFields, "Find in chat", "ctrl-f", Some("cmd-f"), FindInChat),
148
170
shortcut!(Composer, Global, "Reply to the message under the pointer", "alt-r", None, ReplyToHovered),
171
shortcut!(Composer, Global, "Reply to the last message", "alt-shift-r", None, ReplyToLastMessage),
172
shortcut!(Composer, Composer, "Edit last message", "ctrl-up", Some("cmd-up"), EditLastMessage),
149
173
shortcut!(Composer, Global, "Jump to last read or newest message", "ctrl-j", Some("cmd-j"), JumpToLastReadOrNewest),
150
174
shortcut!(Composer, Composer, "Bold", "ctrl-b", Some("cmd-b"), ToggleBold),
151
175
shortcut!(Composer, Composer, "Italic", "ctrl-i", Some("cmd-i"), ToggleItalic),
@@ -167,14 +191,17 @@ pub const SHORTCUTS: &[Shortcut] = &[
167
191
shortcut!(Composer, Composer, "Heading 2", "ctrl-alt-2", None, SetHeading2),
168
192
shortcut!(Composer, Composer, "Heading 3", "ctrl-alt-3", None, SetHeading3),
169
193
shortcut!(Composer, Composer, "Paragraph", "ctrl-alt-p", None, SetParagraph),
170
shortcut!(Calls, GlobalOverTextFields, "Accept incoming call", "ctrl-shift-a", Some("cmd-shift-a"), AcceptCall),
171
shortcut!(Calls, GlobalOverTextFields, "Decline incoming call", "ctrl-shift-d", Some("cmd-shift-d"), DeclineCall),
194
shortcut!(Calls, GlobalOverTextFields, "Accept video call", "ctrl-shift-a", Some("cmd-shift-a"), AcceptCall),
195
shortcut!(Calls, GlobalOverTextFields, "Accept audio call", "ctrl-shift-s", Some("cmd-shift-s"), AcceptAudioCall),
196
shortcut!(Calls, GlobalOverTextFields, "Decline call", "ctrl-shift-d", Some("cmd-shift-d"), DeclineCall),
172
197
shortcut!(Calls, GlobalOverTextFields, "Join the meeting from its reminder", "ctrl-shift-j", Some("cmd-shift-j"), JoinMeetingFromToast),
173
198
shortcut!(Calls, GlobalOverTextFields, "Hang up or leave", "ctrl-shift-h", Some("cmd-shift-h"), HangUpCall),
174
199
shortcut!(Calls, GlobalOverTextFields, "Mute or unmute", "ctrl-shift-m", None, ToggleCallMute),
175
200
shortcut!(Calls, GlobalOverTextFields, "Turn camera on or off", "ctrl-shift-o", Some("cmd-shift-o"), ToggleCallCamera),
176
201
shortcut!(Calls, GlobalOverTextFields, "Open the share menu or stop sharing", "ctrl-shift-e", Some("cmd-shift-e"), ToggleCallShare),
177
202
shortcut!(Calls, GlobalOverTextFields, "Raise or lower hand", "ctrl-shift-k", Some("cmd-shift-k"), ToggleCallHand),
203
shortcut!(Calls, GlobalOverTextFields, "Toggle background blur", "ctrl-shift-p", Some("cmd-shift-p"), ToggleBackgroundBlur),
204
shortcut!(Calls, GlobalOverTextFields, "Toggle live captions", "alt-shift-c", None, ToggleLiveCaptions),
178
205
shortcut!(Calls, GlobalOverTextFields, "Open the lobby list", "ctrl-shift-y", Some("cmd-shift-y"), OpenLobbyList),
179
206
shortcut!(Calls, GlobalOverTextFields, "Start an audio call in this chat", "alt-shift-a", None, StartAudioCall),
180
207
shortcut!(Calls, GlobalOverTextFields, "Start a video call in this chat", "alt-shift-v", None, StartVideoCall),
@@ -379,6 +406,43 @@ mod tests {
379
406
}
380
407
}
381
408
409
#[gpui_kit::test]
410
fn teams_message_presence_and_call_keys_resolve(cx: &mut TestAppContext) {
411
registered(cx);
412
let action_of = |label: &str| {
413
action_name(
414
SHORTCUTS
415
.iter()
416
.find(|shortcut| shortcut.label == label)
417
.unwrap(),
418
)
419
};
420
let typing = ["AppShell", "Composer", "Input"];
421
for (keys, label) in [
422
("ctrl-r", "Go to compose box"),
423
("alt-shift-r", "Reply to the last message"),
424
("ctrl-up", "Edit last message"),
425
("ctrl-alt-up", "Go to previous unread conversation"),
426
("ctrl-alt-down", "Go to next unread conversation"),
427
("ctrl-g", "Go to a specific chat or channel"),
428
("alt-shift-q", "Set presence status to Available"),
429
("alt-shift-y", "Set presence status to Busy"),
430
("alt-shift-u", "Set presence status to Do Not Disturb"),
431
("alt-shift-k", "Set presence status to Be Right Back"),
432
("alt-shift-w", "Set presence status to Away"),
433
("ctrl-shift-a", "Accept video call"),
434
("ctrl-shift-s", "Accept audio call"),
435
("ctrl-shift-p", "Toggle background blur"),
436
("alt-shift-c", "Toggle live captions"),
437
] {
438
assert_eq!(
439
bound_action(cx, keys, &typing),
440
Some(action_of(label)),
441
"{keys}"
442
);
443
}
444
}
445
382
446
#[test]
383
447
fn every_group_lists_shortcuts_and_keys_read_like_teams() {
384
448
for group in Group::ALL {
@@ -2,9 +2,10 @@ use gpui_kit::component::input::Enter;2
use gpui_kit::*;2
use gpui_kit::*;3
3
4
use super::actions::{4
use super::actions::{5
COMPOSER_KEY_CONTEXT as COMPOSER_CONTEXT, EditLink, InsertTableLine, NewChat, OpenSwitcher,5
COMPOSER_KEY_CONTEXT as COMPOSER_CONTEXT, EditLastMessage, EditLink, InsertTableLine, NewChat,6
PastePlainText, RemoveTableLine, ReplyToHovered, ScheduleSend, ToggleBold, ToggleCallMute,6
OpenSwitcher, PastePlainText, RemoveTableLine, ReplyToHovered, ScheduleSend, ToggleBold,7
ToggleCode, ToggleFormatBar, ToggleItalic, ToggleStrike, ToggleSubscript, ToggleSuperscript,7
ToggleCallMute, ToggleCode, ToggleFormatBar, ToggleItalic, ToggleStrike, ToggleSubscript,8
ToggleSuperscript,8
ToggleUnderline, SetParagraph, SetHeading1, SetHeading2, SetHeading3, ToggleCodeBlock,9
ToggleUnderline, SetParagraph, SetHeading1, SetHeading2, SetHeading3, ToggleCodeBlock,9
ToggleQuote,10
ToggleQuote,10
};11
};@@ -41,6 +42,18 @@ actions!(41
PreviousConversation,42
PreviousConversation,42
NextConversation,43
NextConversation,43
JumpToLastReadOrNewest,44
JumpToLastReadOrNewest,45
GoToComposeBox,46
ReplyToLastMessage,47
PreviousUnreadConversation,48
NextUnreadConversation,49
SetPresenceAvailable,50
SetPresenceBusy,51
SetPresenceDoNotDisturb,52
SetPresenceBeRightBack,53
SetPresenceAway,54
AcceptAudioCall,55
ToggleBackgroundBlur,56
ToggleLiveCaptions,44
AcceptCall,57
AcceptCall,45
DeclineCall,58
DeclineCall,46
JoinMeetingFromToast,59
JoinMeetingFromToast,@@ -130,6 +143,11 @@ pub const SHORTCUTS: &[Shortcut] = &[130
shortcut!(General, OutsideComposer, "Zoom in", "ctrl-=", Some("cmd-="), ZoomIn),143
shortcut!(General, OutsideComposer, "Zoom in", "ctrl-=", Some("cmd-="), ZoomIn),131
shortcut!(General, GlobalOverTextFields, "Zoom out", "ctrl--", Some("cmd--"), ZoomOut),144
shortcut!(General, GlobalOverTextFields, "Zoom out", "ctrl--", Some("cmd--"), ZoomOut),132
shortcut!(General, GlobalOverTextFields, "Reset zoom level", "ctrl-0", Some("cmd-0"), ZoomReset),145
shortcut!(General, GlobalOverTextFields, "Reset zoom level", "ctrl-0", Some("cmd-0"), ZoomReset),146
shortcut!(General, Global, "Set presence status to Available", "alt-shift-q", None, SetPresenceAvailable),147
shortcut!(General, Global, "Set presence status to Busy", "alt-shift-y", None, SetPresenceBusy),148
shortcut!(General, Global, "Set presence status to Do Not Disturb", "alt-shift-u", None, SetPresenceDoNotDisturb),149
shortcut!(General, Global, "Set presence status to Be Right Back", "alt-shift-k", None, SetPresenceBeRightBack),150
shortcut!(General, Global, "Set presence status to Away", "alt-shift-w", None, SetPresenceAway),133
shortcut!(Navigation, GlobalOverTextFields, "Open Activity", "ctrl-1", Some("cmd-1"), OpenActivity),151
shortcut!(Navigation, GlobalOverTextFields, "Open Activity", "ctrl-1", Some("cmd-1"), OpenActivity),134
shortcut!(Navigation, GlobalOverTextFields, "Show Chats", "ctrl-2", Some("cmd-2"), OpenChatsTab),152
shortcut!(Navigation, GlobalOverTextFields, "Show Chats", "ctrl-2", Some("cmd-2"), OpenChatsTab),135
shortcut!(Navigation, GlobalOverTextFields, "Show Channels", "ctrl-3", Some("cmd-3"), OpenChannelsTab),153
shortcut!(Navigation, GlobalOverTextFields, "Show Channels", "ctrl-3", Some("cmd-3"), OpenChannelsTab),@@ -138,6 +156,10 @@ pub const SHORTCUTS: &[Shortcut] = &[138
shortcut!(Navigation, GlobalOverTextFields, "Open Agents", "ctrl-6", Some("cmd-6"), OpenAgents),156
shortcut!(Navigation, GlobalOverTextFields, "Open Agents", "ctrl-6", Some("cmd-6"), OpenAgents),139
shortcut!(Navigation, GlobalOverTextFields, "Previous chat or channel", "alt-up", None, PreviousConversation),157
shortcut!(Navigation, GlobalOverTextFields, "Previous chat or channel", "alt-up", None, PreviousConversation),140
shortcut!(Navigation, GlobalOverTextFields, "Next chat or channel", "alt-down", None, NextConversation),158
shortcut!(Navigation, GlobalOverTextFields, "Next chat or channel", "alt-down", None, NextConversation),159
shortcut!(Navigation, GlobalOverTextFields, "Go to previous unread conversation", "ctrl-alt-up", None, PreviousUnreadConversation),160
shortcut!(Navigation, GlobalOverTextFields, "Go to next unread conversation", "ctrl-alt-down", None, NextUnreadConversation),161
shortcut!(Navigation, GlobalOverTextFields, "Go to a specific chat or channel", "ctrl-g", Some("cmd-g"), OpenSwitcher),162
shortcut!(Navigation, Global, "Go to compose box", "ctrl-r", Some("cmd-r"), GoToComposeBox),141
shortcut!(Navigation, GlobalOverTextFields, "Open filter", "ctrl-shift-f", Some("cmd-shift-f"), OpenChatFilter),163
shortcut!(Navigation, GlobalOverTextFields, "Open filter", "ctrl-shift-f", Some("cmd-shift-f"), OpenChatFilter),142
shortcut!(Navigation, OutsideTextFields, "Filter chat list by unread chats only", "ctrl-alt-u", None, FilterUnreadChats),164
shortcut!(Navigation, OutsideTextFields, "Filter chat list by unread chats only", "ctrl-alt-u", None, FilterUnreadChats),143
shortcut!(Navigation, OutsideTextFields, "Filter chat list by chats only", "ctrl-alt-c", None, FilterNonMeetingChats),165
shortcut!(Navigation, OutsideTextFields, "Filter chat list by chats only", "ctrl-alt-c", None, FilterNonMeetingChats),@@ -146,6 +168,8 @@ pub const SHORTCUTS: &[Shortcut] = &[146
shortcut!(Navigation, OutsideTextFields, "Remove all filters in the chat list", "ctrl-alt-z", None, ClearChatFilters),168
shortcut!(Navigation, OutsideTextFields, "Remove all filters in the chat list", "ctrl-alt-z", None, ClearChatFilters),147
shortcut!(Composer, GlobalOverTextFields, "Find in chat", "ctrl-f", Some("cmd-f"), FindInChat),169
shortcut!(Composer, GlobalOverTextFields, "Find in chat", "ctrl-f", Some("cmd-f"), FindInChat),148
shortcut!(Composer, Global, "Reply to the message under the pointer", "alt-r", None, ReplyToHovered),170
shortcut!(Composer, Global, "Reply to the message under the pointer", "alt-r", None, ReplyToHovered),171
shortcut!(Composer, Global, "Reply to the last message", "alt-shift-r", None, ReplyToLastMessage),172
shortcut!(Composer, Composer, "Edit last message", "ctrl-up", Some("cmd-up"), EditLastMessage),149
shortcut!(Composer, Global, "Jump to last read or newest message", "ctrl-j", Some("cmd-j"), JumpToLastReadOrNewest),173
shortcut!(Composer, Global, "Jump to last read or newest message", "ctrl-j", Some("cmd-j"), JumpToLastReadOrNewest),150
shortcut!(Composer, Composer, "Bold", "ctrl-b", Some("cmd-b"), ToggleBold),174
shortcut!(Composer, Composer, "Bold", "ctrl-b", Some("cmd-b"), ToggleBold),151
shortcut!(Composer, Composer, "Italic", "ctrl-i", Some("cmd-i"), ToggleItalic),175
shortcut!(Composer, Composer, "Italic", "ctrl-i", Some("cmd-i"), ToggleItalic),@@ -167,14 +191,17 @@ pub const SHORTCUTS: &[Shortcut] = &[167
shortcut!(Composer, Composer, "Heading 2", "ctrl-alt-2", None, SetHeading2),191
shortcut!(Composer, Composer, "Heading 2", "ctrl-alt-2", None, SetHeading2),168
shortcut!(Composer, Composer, "Heading 3", "ctrl-alt-3", None, SetHeading3),192
shortcut!(Composer, Composer, "Heading 3", "ctrl-alt-3", None, SetHeading3),169
shortcut!(Composer, Composer, "Paragraph", "ctrl-alt-p", None, SetParagraph),193
shortcut!(Composer, Composer, "Paragraph", "ctrl-alt-p", None, SetParagraph),170
shortcut!(Calls, GlobalOverTextFields, "Accept incoming call", "ctrl-shift-a", Some("cmd-shift-a"), AcceptCall),194
shortcut!(Calls, GlobalOverTextFields, "Accept video call", "ctrl-shift-a", Some("cmd-shift-a"), AcceptCall),171
shortcut!(Calls, GlobalOverTextFields, "Decline incoming call", "ctrl-shift-d", Some("cmd-shift-d"), DeclineCall),195
shortcut!(Calls, GlobalOverTextFields, "Accept audio call", "ctrl-shift-s", Some("cmd-shift-s"), AcceptAudioCall),196
shortcut!(Calls, GlobalOverTextFields, "Decline call", "ctrl-shift-d", Some("cmd-shift-d"), DeclineCall),172
shortcut!(Calls, GlobalOverTextFields, "Join the meeting from its reminder", "ctrl-shift-j", Some("cmd-shift-j"), JoinMeetingFromToast),197
shortcut!(Calls, GlobalOverTextFields, "Join the meeting from its reminder", "ctrl-shift-j", Some("cmd-shift-j"), JoinMeetingFromToast),173
shortcut!(Calls, GlobalOverTextFields, "Hang up or leave", "ctrl-shift-h", Some("cmd-shift-h"), HangUpCall),198
shortcut!(Calls, GlobalOverTextFields, "Hang up or leave", "ctrl-shift-h", Some("cmd-shift-h"), HangUpCall),174
shortcut!(Calls, GlobalOverTextFields, "Mute or unmute", "ctrl-shift-m", None, ToggleCallMute),199
shortcut!(Calls, GlobalOverTextFields, "Mute or unmute", "ctrl-shift-m", None, ToggleCallMute),175
shortcut!(Calls, GlobalOverTextFields, "Turn camera on or off", "ctrl-shift-o", Some("cmd-shift-o"), ToggleCallCamera),200
shortcut!(Calls, GlobalOverTextFields, "Turn camera on or off", "ctrl-shift-o", Some("cmd-shift-o"), ToggleCallCamera),176
shortcut!(Calls, GlobalOverTextFields, "Open the share menu or stop sharing", "ctrl-shift-e", Some("cmd-shift-e"), ToggleCallShare),201
shortcut!(Calls, GlobalOverTextFields, "Open the share menu or stop sharing", "ctrl-shift-e", Some("cmd-shift-e"), ToggleCallShare),177
shortcut!(Calls, GlobalOverTextFields, "Raise or lower hand", "ctrl-shift-k", Some("cmd-shift-k"), ToggleCallHand),202
shortcut!(Calls, GlobalOverTextFields, "Raise or lower hand", "ctrl-shift-k", Some("cmd-shift-k"), ToggleCallHand),203
shortcut!(Calls, GlobalOverTextFields, "Toggle background blur", "ctrl-shift-p", Some("cmd-shift-p"), ToggleBackgroundBlur),204
shortcut!(Calls, GlobalOverTextFields, "Toggle live captions", "alt-shift-c", None, ToggleLiveCaptions),178
shortcut!(Calls, GlobalOverTextFields, "Open the lobby list", "ctrl-shift-y", Some("cmd-shift-y"), OpenLobbyList),205
shortcut!(Calls, GlobalOverTextFields, "Open the lobby list", "ctrl-shift-y", Some("cmd-shift-y"), OpenLobbyList),179
shortcut!(Calls, GlobalOverTextFields, "Start an audio call in this chat", "alt-shift-a", None, StartAudioCall),206
shortcut!(Calls, GlobalOverTextFields, "Start an audio call in this chat", "alt-shift-a", None, StartAudioCall),180
shortcut!(Calls, GlobalOverTextFields, "Start a video call in this chat", "alt-shift-v", None, StartVideoCall),207
shortcut!(Calls, GlobalOverTextFields, "Start a video call in this chat", "alt-shift-v", None, StartVideoCall),@@ -379,6 +406,43 @@ mod tests {379
}406
}380
}407
}381
408
409
#[gpui_kit::test]410
fn teams_message_presence_and_call_keys_resolve(cx: &mut TestAppContext) {411
registered(cx);412
let action_of = |label: &str| {413
action_name(414
SHORTCUTS415
.iter()416
.find(|shortcut| shortcut.label == label)417
.unwrap(),418
)419
};420
let typing = ["AppShell", "Composer", "Input"];421
for (keys, label) in [422
("ctrl-r", "Go to compose box"),423
("alt-shift-r", "Reply to the last message"),424
("ctrl-up", "Edit last message"),425
("ctrl-alt-up", "Go to previous unread conversation"),426
("ctrl-alt-down", "Go to next unread conversation"),427
("ctrl-g", "Go to a specific chat or channel"),428
("alt-shift-q", "Set presence status to Available"),429
("alt-shift-y", "Set presence status to Busy"),430
("alt-shift-u", "Set presence status to Do Not Disturb"),431
("alt-shift-k", "Set presence status to Be Right Back"),432
("alt-shift-w", "Set presence status to Away"),433
("ctrl-shift-a", "Accept video call"),434
("ctrl-shift-s", "Accept audio call"),435
("ctrl-shift-p", "Toggle background blur"),436
("alt-shift-c", "Toggle live captions"),437
] {438
assert_eq!(439
bound_action(cx, keys, &typing),440
Some(action_of(label)),441
"{keys}"442
);443
}444
}445
382
#[test]446
#[test]383
fn every_group_lists_shortcuts_and_keys_read_like_teams() {447
fn every_group_lists_shortcuts_and_keys_read_like_teams() {384
for group in Group::ALL {448
for group in Group::ALL {