Merge remote-tracking branch 'origin/main' into fix/notes-chat-gaps
@@ -50,6 +50,7 @@ windows = { version = "0.62", features = [
50
50
"Win32_Storage_FileSystem",
51
51
"Win32_System_Com",
52
52
"Win32_System_Pipes",
53
"Win32_System_Registry",
53
54
"Win32_System_SystemInformation",
54
55
"Win32_System_Threading",
55
56
"Win32_UI_Accessibility",
@@ -50,6 +50,7 @@ windows = { version = "0.62", features = [50
"Win32_Storage_FileSystem",50
"Win32_Storage_FileSystem",51
"Win32_System_Com",51
"Win32_System_Com",52
"Win32_System_Pipes",52
"Win32_System_Pipes",53
"Win32_System_Registry",53
"Win32_System_SystemInformation",54
"Win32_System_SystemInformation",54
"Win32_System_Threading",55
"Win32_System_Threading",55
"Win32_UI_Accessibility",56
"Win32_UI_Accessibility",@@ -0,0 +1,182 @@
1
use std::io;
2
use std::path::Path;
3
4
pub const AUTOSTART_FLAG: &str = "--autostart";
5
const BACKGROUND_META_KEY: &str = "startup.open_in_background";
6
7
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
8
pub struct StartupSettings {
9
pub auto_start: bool,
10
pub open_in_background: bool,
11
}
12
13
impl StartupSettings {
14
pub fn load(store: &store::Store, read_system: bool) -> StartupSettings {
15
StartupSettings {
16
auto_start: read_system && is_enabled(crate::APP_NAME),
17
open_in_background: store.meta(BACKGROUND_META_KEY).ok().flatten().as_deref()
18
== Some("1"),
19
}
20
}
21
22
pub fn save_background(&self, store: &store::Store) {
23
let _ = store.set_meta(
24
BACKGROUND_META_KEY,
25
if self.open_in_background { "1" } else { "0" },
26
);
27
}
28
29
pub fn starts_hidden(&self, launched_by_autostart: bool) -> bool {
30
launched_by_autostart && self.auto_start && self.open_in_background
31
}
32
}
33
34
pub fn launch_command(executable: &Path) -> String {
35
format!("\"{}\" {AUTOSTART_FLAG}", executable.display())
36
}
37
38
pub fn desktop_entry(name: &str, executable: &Path) -> String {
39
format!(
40
"[Desktop Entry]\nType=Application\nName={name}\nExec={}\nX-GNOME-Autostart-enabled=true\n",
41
launch_command(executable)
42
)
43
}
44
45
pub fn launched_by_autostart(arguments: impl IntoIterator<Item = String>) -> bool {
46
arguments
47
.into_iter()
48
.any(|argument| argument == AUTOSTART_FLAG)
49
}
50
51
#[cfg(not(windows))]
52
fn entry_path(name: &str) -> Option<std::path::PathBuf> {
53
let file_name = format!("{}.desktop", name.to_lowercase().replace(' ', "-"));
54
directories::BaseDirs::new().map(|base| base.config_dir().join("autostart").join(file_name))
55
}
56
57
#[cfg(not(windows))]
58
pub fn is_enabled(name: &str) -> bool {
59
entry_path(name).is_some_and(|path| path.is_file())
60
}
61
62
#[cfg(not(windows))]
63
pub fn set_enabled(name: &str, enabled: bool) -> io::Result<()> {
64
let path = entry_path(name).ok_or_else(|| io::Error::other("no config directory"))?;
65
if !enabled {
66
return match std::fs::remove_file(&path) {
67
Err(error) if error.kind() != io::ErrorKind::NotFound => Err(error),
68
_ => Ok(()),
69
};
70
}
71
if let Some(directory) = path.parent() {
72
std::fs::create_dir_all(directory)?;
73
}
74
std::fs::write(&path, desktop_entry(name, &std::env::current_exe()?))
75
}
76
77
#[cfg(windows)]
78
const RUN_KEY: &str = "Software\\Microsoft\\Windows\\CurrentVersion\\Run";
79
80
#[cfg(windows)]
81
fn wide(text: &str) -> Vec<u16> {
82
text.encode_utf16().chain(std::iter::once(0)).collect()
83
}
84
85
#[cfg(windows)]
86
pub fn is_enabled(name: &str) -> bool {
87
use windows::Win32::System::Registry::{HKEY_CURRENT_USER, RRF_RT_REG_SZ, RegGetValueW};
88
use windows::core::PCWSTR;
89
let (key, value) = (wide(RUN_KEY), wide(name));
90
unsafe {
91
RegGetValueW(
92
HKEY_CURRENT_USER,
93
PCWSTR(key.as_ptr()),
94
PCWSTR(value.as_ptr()),
95
RRF_RT_REG_SZ,
96
None,
97
None,
98
None,
99
)
100
.is_ok()
101
}
102
}
103
104
#[cfg(windows)]
105
pub fn set_enabled(name: &str, enabled: bool) -> io::Result<()> {
106
use windows::Win32::Foundation::ERROR_FILE_NOT_FOUND;
107
use windows::Win32::System::Registry::{
108
HKEY_CURRENT_USER, REG_SZ, RegDeleteKeyValueW, RegSetKeyValueW,
109
};
110
use windows::core::PCWSTR;
111
let (key, value) = (wide(RUN_KEY), wide(name));
112
let status = if enabled {
113
let command = wide(&launch_command(&std::env::current_exe()?));
114
unsafe {
115
RegSetKeyValueW(
116
HKEY_CURRENT_USER,
117
PCWSTR(key.as_ptr()),
118
PCWSTR(value.as_ptr()),
119
REG_SZ.0,
120
Some(command.as_ptr().cast()),
121
(command.len() * size_of::<u16>()) as u32,
122
)
123
}
124
} else {
125
match unsafe {
126
RegDeleteKeyValueW(HKEY_CURRENT_USER, PCWSTR(key.as_ptr()), PCWSTR(value.as_ptr()))
127
} {
128
ERROR_FILE_NOT_FOUND => return Ok(()),
129
status => status,
130
}
131
};
132
status
133
.ok()
134
.map_err(|error| io::Error::other(error.message()))
135
}
136
137
#[cfg(test)]
138
mod tests {
139
use std::path::Path;
140
141
use super::{
142
AUTOSTART_FLAG, StartupSettings, desktop_entry, launch_command, launched_by_autostart,
143
};
144
145
#[test]
146
fn background_choice_survives_a_restart_and_only_applies_to_autostart() {
147
let store = store::Store::open_in_memory().unwrap();
148
let loaded = StartupSettings::load(&store, false);
149
assert_eq!(loaded, StartupSettings::default());
150
let settings = StartupSettings {
151
auto_start: true,
152
open_in_background: true,
153
};
154
settings.save_background(&store);
155
assert!(StartupSettings::load(&store, false).open_in_background);
156
assert!(settings.starts_hidden(true));
157
assert!(!settings.starts_hidden(false));
158
assert!(
159
!StartupSettings {
160
auto_start: false,
161
..settings
162
}
163
.starts_hidden(true)
164
);
165
}
166
167
#[test]
168
fn the_start_command_quotes_the_path_and_marks_the_autostart() {
169
let command = launch_command(Path::new("/opt/rusty teams/teams"));
170
assert_eq!(command, format!("\"/opt/rusty teams/teams\" {AUTOSTART_FLAG}"));
171
let entry = desktop_entry("Rusty Teams", Path::new("/opt/teams"));
172
assert!(entry.starts_with("[Desktop Entry]\n"));
173
assert!(entry.contains(&format!("Exec=\"/opt/teams\" {AUTOSTART_FLAG}\n")));
174
assert!(entry.contains("Name=Rusty Teams\n"));
175
}
176
177
#[test]
178
fn only_the_autostart_flag_marks_a_background_start() {
179
assert!(launched_by_autostart(["--demo".into(), AUTOSTART_FLAG.into()]));
180
assert!(!launched_by_autostart(["--demo".to_owned()]));
181
}
182
}
@@ -0,0 +1,182 @@1
use std::io;2
use std::path::Path;3
4
pub const AUTOSTART_FLAG: &str = "--autostart";5
const BACKGROUND_META_KEY: &str = "startup.open_in_background";6
7
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]8
pub struct StartupSettings {9
pub auto_start: bool,10
pub open_in_background: bool,11
}12
13
impl StartupSettings {14
pub fn load(store: &store::Store, read_system: bool) -> StartupSettings {15
StartupSettings {16
auto_start: read_system && is_enabled(crate::APP_NAME),17
open_in_background: store.meta(BACKGROUND_META_KEY).ok().flatten().as_deref()18
== Some("1"),19
}20
}21
22
pub fn save_background(&self, store: &store::Store) {23
let _ = store.set_meta(24
BACKGROUND_META_KEY,25
if self.open_in_background { "1" } else { "0" },26
);27
}28
29
pub fn starts_hidden(&self, launched_by_autostart: bool) -> bool {30
launched_by_autostart && self.auto_start && self.open_in_background31
}32
}33
34
pub fn launch_command(executable: &Path) -> String {35
format!("\"{}\" {AUTOSTART_FLAG}", executable.display())36
}37
38
pub fn desktop_entry(name: &str, executable: &Path) -> String {39
format!(40
"[Desktop Entry]\nType=Application\nName={name}\nExec={}\nX-GNOME-Autostart-enabled=true\n",41
launch_command(executable)42
)43
}44
45
pub fn launched_by_autostart(arguments: impl IntoIterator<Item = String>) -> bool {46
arguments47
.into_iter()48
.any(|argument| argument == AUTOSTART_FLAG)49
}50
51
#[cfg(not(windows))]52
fn entry_path(name: &str) -> Option<std::path::PathBuf> {53
let file_name = format!("{}.desktop", name.to_lowercase().replace(' ', "-"));54
directories::BaseDirs::new().map(|base| base.config_dir().join("autostart").join(file_name))55
}56
57
#[cfg(not(windows))]58
pub fn is_enabled(name: &str) -> bool {59
entry_path(name).is_some_and(|path| path.is_file())60
}61
62
#[cfg(not(windows))]63
pub fn set_enabled(name: &str, enabled: bool) -> io::Result<()> {64
let path = entry_path(name).ok_or_else(|| io::Error::other("no config directory"))?;65
if !enabled {66
return match std::fs::remove_file(&path) {67
Err(error) if error.kind() != io::ErrorKind::NotFound => Err(error),68
_ => Ok(()),69
};70
}71
if let Some(directory) = path.parent() {72
std::fs::create_dir_all(directory)?;73
}74
std::fs::write(&path, desktop_entry(name, &std::env::current_exe()?))75
}76
77
#[cfg(windows)]78
const RUN_KEY: &str = "Software\\Microsoft\\Windows\\CurrentVersion\\Run";79
80
#[cfg(windows)]81
fn wide(text: &str) -> Vec<u16> {82
text.encode_utf16().chain(std::iter::once(0)).collect()83
}84
85
#[cfg(windows)]86
pub fn is_enabled(name: &str) -> bool {87
use windows::Win32::System::Registry::{HKEY_CURRENT_USER, RRF_RT_REG_SZ, RegGetValueW};88
use windows::core::PCWSTR;89
let (key, value) = (wide(RUN_KEY), wide(name));90
unsafe {91
RegGetValueW(92
HKEY_CURRENT_USER,93
PCWSTR(key.as_ptr()),94
PCWSTR(value.as_ptr()),95
RRF_RT_REG_SZ,96
None,97
None,98
None,99
)100
.is_ok()101
}102
}103
104
#[cfg(windows)]105
pub fn set_enabled(name: &str, enabled: bool) -> io::Result<()> {106
use windows::Win32::Foundation::ERROR_FILE_NOT_FOUND;107
use windows::Win32::System::Registry::{108
HKEY_CURRENT_USER, REG_SZ, RegDeleteKeyValueW, RegSetKeyValueW,109
};110
use windows::core::PCWSTR;111
let (key, value) = (wide(RUN_KEY), wide(name));112
let status = if enabled {113
let command = wide(&launch_command(&std::env::current_exe()?));114
unsafe {115
RegSetKeyValueW(116
HKEY_CURRENT_USER,117
PCWSTR(key.as_ptr()),118
PCWSTR(value.as_ptr()),119
REG_SZ.0,120
Some(command.as_ptr().cast()),121
(command.len() * size_of::<u16>()) as u32,122
)123
}124
} else {125
match unsafe {126
RegDeleteKeyValueW(HKEY_CURRENT_USER, PCWSTR(key.as_ptr()), PCWSTR(value.as_ptr()))127
} {128
ERROR_FILE_NOT_FOUND => return Ok(()),129
status => status,130
}131
};132
status133
.ok()134
.map_err(|error| io::Error::other(error.message()))135
}136
137
#[cfg(test)]138
mod tests {139
use std::path::Path;140
141
use super::{142
AUTOSTART_FLAG, StartupSettings, desktop_entry, launch_command, launched_by_autostart,143
};144
145
#[test]146
fn background_choice_survives_a_restart_and_only_applies_to_autostart() {147
let store = store::Store::open_in_memory().unwrap();148
let loaded = StartupSettings::load(&store, false);149
assert_eq!(loaded, StartupSettings::default());150
let settings = StartupSettings {151
auto_start: true,152
open_in_background: true,153
};154
settings.save_background(&store);155
assert!(StartupSettings::load(&store, false).open_in_background);156
assert!(settings.starts_hidden(true));157
assert!(!settings.starts_hidden(false));158
assert!(159
!StartupSettings {160
auto_start: false,161
..settings162
}163
.starts_hidden(true)164
);165
}166
167
#[test]168
fn the_start_command_quotes_the_path_and_marks_the_autostart() {169
let command = launch_command(Path::new("/opt/rusty teams/teams"));170
assert_eq!(command, format!("\"/opt/rusty teams/teams\" {AUTOSTART_FLAG}"));171
let entry = desktop_entry("Rusty Teams", Path::new("/opt/teams"));172
assert!(entry.starts_with("[Desktop Entry]\n"));173
assert!(entry.contains(&format!("Exec=\"/opt/teams\" {AUTOSTART_FLAG}\n")));174
assert!(entry.contains("Name=Rusty Teams\n"));175
}176
177
#[test]178
fn only_the_autostart_flag_marks_a_background_start() {179
assert!(launched_by_autostart(["--demo".into(), AUTOSTART_FLAG.into()]));180
assert!(!launched_by_autostart(["--demo".to_owned()]));181
}182
}@@ -2,6 +2,7 @@ pub mod agent_api;
2
2
pub mod appearance;
3
3
pub mod agents;
4
4
pub mod assets;
5
pub mod autostart;
5
6
pub mod avatar_image;
6
7
pub mod channel_files;
7
8
pub mod crash_log;
@@ -2,6 +2,7 @@ pub mod agent_api;2
pub mod appearance;2
pub mod appearance;3
pub mod agents;3
pub mod agents;4
pub mod assets;4
pub mod assets;5
pub mod autostart;5
pub mod avatar_image;6
pub mod avatar_image;6
pub mod channel_files;7
pub mod channel_files;7
pub mod crash_log;8
pub mod crash_log;@@ -1,4 +1,5 @@
1
1
use std::cell::Cell;
2
use std::collections::HashSet;
2
3
use std::rc::Rc;
3
4
use std::sync::Arc;
4
5
use std::time::{Duration, Instant};
@@ -302,6 +303,7 @@ pub struct CallModel {
302
303
pub own_role: Option<MeetingRole>,
303
304
pub capability: MeetingCapability,
304
305
pub pinned: Option<String>,
306
pub fitted: HashSet<String>,
305
307
pub captions: CaptionState,
306
308
pub caption_lines: Vec<CaptionLine>,
307
309
pub transcript: Transcript,
@@ -368,6 +370,7 @@ impl CallModel {
368
370
own_role: None,
369
371
capability: MeetingCapability::default(),
370
372
pinned: None,
373
fitted: HashSet::new(),
371
374
captions: CaptionState::Off,
372
375
caption_lines: Vec::new(),
373
376
transcript: Transcript::default(),
@@ -708,6 +711,16 @@ impl CallModel {
708
711
self.refresh_layout(Instant::now());
709
712
}
710
713
714
pub fn is_fitted(&self, mri: &str) -> bool {
715
self.fitted.contains(mri)
716
}
717
718
pub fn toggle_fit(&mut self, mri: &str) {
719
if !self.fitted.remove(mri) {
720
self.fitted.insert(mri.to_owned());
721
}
722
}
723
711
724
pub fn is_spotlighted(&self, mri: &str) -> bool {
712
725
self.own_mri.as_deref() == Some(mri) && self.own_spotlight.is_some()
713
726
|| self
@@ -1563,6 +1576,17 @@ mod tests {
1563
1576
.collect()
1564
1577
}
1565
1578
1579
#[test]
1580
fn fit_to_frame_is_per_tile_and_toggles_back_to_fill() {
1581
let mut model = meeting_with_me();
1582
assert!(!model.is_fitted("8:orgid:a"));
1583
model.toggle_fit("8:orgid:a");
1584
assert!(model.is_fitted("8:orgid:a"));
1585
assert!(!model.is_fitted("8:orgid:b"));
1586
model.toggle_fit("8:orgid:a");
1587
assert!(!model.is_fitted("8:orgid:a"));
1588
}
1589
1566
1590
#[test]
1567
1591
fn hiding_people_without_video_keeps_speakers_and_the_pinned_person() {
1568
1592
let mut model = meeting_with_me();
@@ -1,4 +1,5 @@1
use std::cell::Cell;1
use std::cell::Cell;2
use std::collections::HashSet;2
use std::rc::Rc;3
use std::rc::Rc;3
use std::sync::Arc;4
use std::sync::Arc;4
use std::time::{Duration, Instant};5
use std::time::{Duration, Instant};@@ -302,6 +303,7 @@ pub struct CallModel {302
pub own_role: Option<MeetingRole>,303
pub own_role: Option<MeetingRole>,303
pub capability: MeetingCapability,304
pub capability: MeetingCapability,304
pub pinned: Option<String>,305
pub pinned: Option<String>,306
pub fitted: HashSet<String>,305
pub captions: CaptionState,307
pub captions: CaptionState,306
pub caption_lines: Vec<CaptionLine>,308
pub caption_lines: Vec<CaptionLine>,307
pub transcript: Transcript,309
pub transcript: Transcript,@@ -368,6 +370,7 @@ impl CallModel {368
own_role: None,370
own_role: None,369
capability: MeetingCapability::default(),371
capability: MeetingCapability::default(),370
pinned: None,372
pinned: None,373
fitted: HashSet::new(),371
captions: CaptionState::Off,374
captions: CaptionState::Off,372
caption_lines: Vec::new(),375
caption_lines: Vec::new(),373
transcript: Transcript::default(),376
transcript: Transcript::default(),@@ -708,6 +711,16 @@ impl CallModel {708
self.refresh_layout(Instant::now());711
self.refresh_layout(Instant::now());709
}712
}710
713
714
pub fn is_fitted(&self, mri: &str) -> bool {715
self.fitted.contains(mri)716
}717
718
pub fn toggle_fit(&mut self, mri: &str) {719
if !self.fitted.remove(mri) {720
self.fitted.insert(mri.to_owned());721
}722
}723
711
pub fn is_spotlighted(&self, mri: &str) -> bool {724
pub fn is_spotlighted(&self, mri: &str) -> bool {712
self.own_mri.as_deref() == Some(mri) && self.own_spotlight.is_some()725
self.own_mri.as_deref() == Some(mri) && self.own_spotlight.is_some()713
|| self726
|| self@@ -1563,6 +1576,17 @@ mod tests {1563
.collect()1576
.collect()1564
}1577
}1565
1578
1579
#[test]1580
fn fit_to_frame_is_per_tile_and_toggles_back_to_fill() {1581
let mut model = meeting_with_me();1582
assert!(!model.is_fitted("8:orgid:a"));1583
model.toggle_fit("8:orgid:a");1584
assert!(model.is_fitted("8:orgid:a"));1585
assert!(!model.is_fitted("8:orgid:b"));1586
model.toggle_fit("8:orgid:a");1587
assert!(!model.is_fitted("8:orgid:a"));1588
}1589
1566
#[test]1590
#[test]1567
fn hiding_people_without_video_keeps_speakers_and_the_pinned_person() {1591
fn hiding_people_without_video_keeps_speakers_and_the_pinned_person() {1568
let mut model = meeting_with_me();1592
let mut model = meeting_with_me();@@ -3,6 +3,7 @@ use super::caption_style::{CaptionPosition, CaptionSize};
3
3
const LAYOUT_META_KEY: &str = "call_layout";
4
4
const HIDE_NO_VIDEO_META_KEY: &str = "call_hide_no_video";
5
5
const CHAT_BUBBLES_META_KEY: &str = "call_chat_bubbles";
6
const HIDE_TIMER_META_KEY: &str = "call_hide_timer";
6
7
const CAPTION_SIZE_META_KEY: &str = "call_caption_size";
7
8
const CAPTION_POSITION_META_KEY: &str = "call_caption_position";
8
9
@@ -47,6 +48,7 @@ pub struct ViewSettings {
47
48
pub hide_no_video: bool,
48
49
pub chat_bubbles: bool,
49
50
pub hide_me: bool,
51
pub hide_timer: bool,
50
52
pub caption_size: CaptionSize,
51
53
pub caption_position: CaptionPosition,
52
54
}
@@ -59,6 +61,7 @@ impl Default for ViewSettings {
59
61
hide_no_video: false,
60
62
chat_bubbles: true,
61
63
hide_me: false,
64
hide_timer: false,
62
65
caption_size: CaptionSize::Medium,
63
66
caption_position: CaptionPosition::Bottom,
64
67
}
@@ -81,6 +84,7 @@ impl ViewSettings {
81
84
layout,
82
85
hide_no_video: flag(HIDE_NO_VIDEO_META_KEY, false),
83
86
chat_bubbles: flag(CHAT_BUBBLES_META_KEY, true),
87
hide_timer: flag(HIDE_TIMER_META_KEY, false),
84
88
caption_size: store
85
89
.meta(CAPTION_SIZE_META_KEY)
86
90
.ok()
@@ -105,6 +109,10 @@ impl ViewSettings {
105
109
CHAT_BUBBLES_META_KEY,
106
110
if self.chat_bubbles { "1" } else { "0" },
107
111
);
112
let _ = store.set_meta(
113
HIDE_TIMER_META_KEY,
114
if self.hide_timer { "1" } else { "0" },
115
);
108
116
let _ = store.set_meta(CAPTION_SIZE_META_KEY, self.caption_size.meta());
109
117
let _ = store.set_meta(CAPTION_POSITION_META_KEY, self.caption_position.meta());
110
118
}
@@ -129,6 +137,7 @@ mod tests {
129
137
assert!(settings.chat_bubbles);
130
138
assert!(!settings.hide_no_video);
131
139
assert!(!settings.hide_me);
140
assert!(!settings.hide_timer);
132
141
assert_eq!(settings.caption_size, CaptionSize::Medium);
133
142
assert_eq!(settings.caption_position, CaptionPosition::Bottom);
134
143
}
@@ -141,6 +150,7 @@ mod tests {
141
150
settings.hide_no_video = true;
142
151
settings.chat_bubbles = false;
143
152
settings.hide_me = true;
153
settings.hide_timer = true;
144
154
settings.caption_size = CaptionSize::Large;
145
155
settings.caption_position = CaptionPosition::Top;
146
156
settings.save(&store);
@@ -149,6 +159,7 @@ mod tests {
149
159
assert!(loaded.hide_no_video);
150
160
assert!(!loaded.chat_bubbles);
151
161
assert!(!loaded.hide_me);
162
assert!(loaded.hide_timer);
152
163
assert_eq!(loaded.caption_size, CaptionSize::Large);
153
164
assert_eq!(loaded.caption_position, CaptionPosition::Top);
154
165
}
@@ -3,6 +3,7 @@ use super::caption_style::{CaptionPosition, CaptionSize};3
const LAYOUT_META_KEY: &str = "call_layout";3
const LAYOUT_META_KEY: &str = "call_layout";4
const HIDE_NO_VIDEO_META_KEY: &str = "call_hide_no_video";4
const HIDE_NO_VIDEO_META_KEY: &str = "call_hide_no_video";5
const CHAT_BUBBLES_META_KEY: &str = "call_chat_bubbles";5
const CHAT_BUBBLES_META_KEY: &str = "call_chat_bubbles";6
const HIDE_TIMER_META_KEY: &str = "call_hide_timer";6
const CAPTION_SIZE_META_KEY: &str = "call_caption_size";7
const CAPTION_SIZE_META_KEY: &str = "call_caption_size";7
const CAPTION_POSITION_META_KEY: &str = "call_caption_position";8
const CAPTION_POSITION_META_KEY: &str = "call_caption_position";8
9
@@ -47,6 +48,7 @@ pub struct ViewSettings {47
pub hide_no_video: bool,48
pub hide_no_video: bool,48
pub chat_bubbles: bool,49
pub chat_bubbles: bool,49
pub hide_me: bool,50
pub hide_me: bool,51
pub hide_timer: bool,50
pub caption_size: CaptionSize,52
pub caption_size: CaptionSize,51
pub caption_position: CaptionPosition,53
pub caption_position: CaptionPosition,52
}54
}@@ -59,6 +61,7 @@ impl Default for ViewSettings {59
hide_no_video: false,61
hide_no_video: false,60
chat_bubbles: true,62
chat_bubbles: true,61
hide_me: false,63
hide_me: false,64
hide_timer: false,62
caption_size: CaptionSize::Medium,65
caption_size: CaptionSize::Medium,63
caption_position: CaptionPosition::Bottom,66
caption_position: CaptionPosition::Bottom,64
}67
}@@ -81,6 +84,7 @@ impl ViewSettings {81
layout,84
layout,82
hide_no_video: flag(HIDE_NO_VIDEO_META_KEY, false),85
hide_no_video: flag(HIDE_NO_VIDEO_META_KEY, false),83
chat_bubbles: flag(CHAT_BUBBLES_META_KEY, true),86
chat_bubbles: flag(CHAT_BUBBLES_META_KEY, true),87
hide_timer: flag(HIDE_TIMER_META_KEY, false),84
caption_size: store88
caption_size: store85
.meta(CAPTION_SIZE_META_KEY)89
.meta(CAPTION_SIZE_META_KEY)86
.ok()90
.ok()@@ -105,6 +109,10 @@ impl ViewSettings {105
CHAT_BUBBLES_META_KEY,109
CHAT_BUBBLES_META_KEY,106
if self.chat_bubbles { "1" } else { "0" },110
if self.chat_bubbles { "1" } else { "0" },107
);111
);112
let _ = store.set_meta(113
HIDE_TIMER_META_KEY,114
if self.hide_timer { "1" } else { "0" },115
);108
let _ = store.set_meta(CAPTION_SIZE_META_KEY, self.caption_size.meta());116
let _ = store.set_meta(CAPTION_SIZE_META_KEY, self.caption_size.meta());109
let _ = store.set_meta(CAPTION_POSITION_META_KEY, self.caption_position.meta());117
let _ = store.set_meta(CAPTION_POSITION_META_KEY, self.caption_position.meta());110
}118
}@@ -129,6 +137,7 @@ mod tests {129
assert!(settings.chat_bubbles);137
assert!(settings.chat_bubbles);130
assert!(!settings.hide_no_video);138
assert!(!settings.hide_no_video);131
assert!(!settings.hide_me);139
assert!(!settings.hide_me);140
assert!(!settings.hide_timer);132
assert_eq!(settings.caption_size, CaptionSize::Medium);141
assert_eq!(settings.caption_size, CaptionSize::Medium);133
assert_eq!(settings.caption_position, CaptionPosition::Bottom);142
assert_eq!(settings.caption_position, CaptionPosition::Bottom);134
}143
}@@ -141,6 +150,7 @@ mod tests {141
settings.hide_no_video = true;150
settings.hide_no_video = true;142
settings.chat_bubbles = false;151
settings.chat_bubbles = false;143
settings.hide_me = true;152
settings.hide_me = true;153
settings.hide_timer = true;144
settings.caption_size = CaptionSize::Large;154
settings.caption_size = CaptionSize::Large;145
settings.caption_position = CaptionPosition::Top;155
settings.caption_position = CaptionPosition::Top;146
settings.save(&store);156
settings.save(&store);@@ -149,6 +159,7 @@ mod tests {149
assert!(loaded.hide_no_video);159
assert!(loaded.hide_no_video);150
assert!(!loaded.chat_bubbles);160
assert!(!loaded.chat_bubbles);151
assert!(!loaded.hide_me);161
assert!(!loaded.hide_me);162
assert!(loaded.hide_timer);152
assert_eq!(loaded.caption_size, CaptionSize::Large);163
assert_eq!(loaded.caption_size, CaptionSize::Large);153
assert_eq!(loaded.caption_position, CaptionPosition::Top);164
assert_eq!(loaded.caption_position, CaptionPosition::Top);154
}165
}@@ -897,6 +897,13 @@ impl AppState {
897
897
}
898
898
}
899
899
900
pub fn toggle_call_fit(&mut self, mri: &str, cx: &mut Context<Self>) {
901
if let Some(call) = self.call.as_mut() {
902
call.model.toggle_fit(mri);
903
cx.notify();
904
}
905
}
906
900
907
pub fn toggle_call_captions(&mut self, _cx: &mut Context<Self>) {
901
908
let Some(call) = self
902
909
.call
@@ -926,6 +933,18 @@ impl AppState {
926
933
cx.notify();
927
934
}
928
935
936
pub fn toggle_call_background_blur(&mut self, cx: &mut Context<Self>) {
937
if self.call.is_none() {
938
return;
939
}
940
let pick = if self.call_background == BackgroundPick::Blur {
941
BackgroundPick::None
942
} else {
943
BackgroundPick::Blur
944
};
945
self.set_call_background(pick, cx);
946
}
947
929
948
pub(super) fn send_background_command(&mut self, cx: &mut Context<Self>) {
930
949
let pick = self.call_background.clone();
931
950
if let Some(choice) = self.call_backgrounds.choice_for(&pick) {
@@ -1172,9 +1191,9 @@ impl AppState {
1172
1191
}
1173
1192
}
1174
1193
1175
pub fn accept_ringing_call(&mut self, cx: &mut Context<Self>) {
1194
pub fn accept_ringing_call(&mut self, mode: AcceptMode, cx: &mut Context<Self>) {
1176
1195
if let Some(ring_id) = self.rings.first_ringing_id() {
1177
self.accept_ring(ring_id, AcceptMode::Audio, cx);
1196
self.accept_ring(ring_id, mode, cx);
1178
1197
}
1179
1198
}
1180
1199
@@ -897,6 +897,13 @@ impl AppState {897
}897
}898
}898
}899
899
900
pub fn toggle_call_fit(&mut self, mri: &str, cx: &mut Context<Self>) {901
if let Some(call) = self.call.as_mut() {902
call.model.toggle_fit(mri);903
cx.notify();904
}905
}906
900
pub fn toggle_call_captions(&mut self, _cx: &mut Context<Self>) {907
pub fn toggle_call_captions(&mut self, _cx: &mut Context<Self>) {901
let Some(call) = self908
let Some(call) = self902
.call909
.call@@ -926,6 +933,18 @@ impl AppState {926
cx.notify();933
cx.notify();927
}934
}928
935
936
pub fn toggle_call_background_blur(&mut self, cx: &mut Context<Self>) {937
if self.call.is_none() {938
return;939
}940
let pick = if self.call_background == BackgroundPick::Blur {941
BackgroundPick::None942
} else {943
BackgroundPick::Blur944
};945
self.set_call_background(pick, cx);946
}947
929
pub(super) fn send_background_command(&mut self, cx: &mut Context<Self>) {948
pub(super) fn send_background_command(&mut self, cx: &mut Context<Self>) {930
let pick = self.call_background.clone();949
let pick = self.call_background.clone();931
if let Some(choice) = self.call_backgrounds.choice_for(&pick) {950
if let Some(choice) = self.call_backgrounds.choice_for(&pick) {@@ -1172,9 +1191,9 @@ impl AppState {1172
}1191
}1173
}1192
}1174
1193
1175
pub fn accept_ringing_call(&mut self, cx: &mut Context<Self>) {1194
pub fn accept_ringing_call(&mut self, mode: AcceptMode, cx: &mut Context<Self>) {1176
if let Some(ring_id) = self.rings.first_ringing_id() {1195
if let Some(ring_id) = self.rings.first_ringing_id() {1177
self.accept_ring(ring_id, AcceptMode::Audio, cx);1196
self.accept_ring(ring_id, mode, cx);1178
}1197
}1179
}1198
}1180
1199
@@ -58,6 +58,10 @@ impl AppState {
58
58
self.change_call_view(|view| view.chat_bubbles = !view.chat_bubbles, cx);
59
59
}
60
60
61
pub fn toggle_call_hide_timer(&mut self, cx: &mut Context<Self>) {
62
self.change_call_view(|view| view.hide_timer = !view.hide_timer, cx);
63
}
64
61
65
pub fn set_call_hide_me(&mut self, hidden: bool, cx: &mut Context<Self>) {
62
66
if let Some(call) = self.call.as_mut() {
63
67
call.model.view.hide_me = hidden;
@@ -58,6 +58,10 @@ impl AppState {58
self.change_call_view(|view| view.chat_bubbles = !view.chat_bubbles, cx);58
self.change_call_view(|view| view.chat_bubbles = !view.chat_bubbles, cx);59
}59
}60
60
61
pub fn toggle_call_hide_timer(&mut self, cx: &mut Context<Self>) {62
self.change_call_view(|view| view.hide_timer = !view.hide_timer, cx);63
}64
61
pub fn set_call_hide_me(&mut self, hidden: bool, cx: &mut Context<Self>) {65
pub fn set_call_hide_me(&mut self, hidden: bool, cx: &mut Context<Self>) {62
if let Some(call) = self.call.as_mut() {66
if let Some(call) = self.call.as_mut() {63
call.model.view.hide_me = hidden;67
call.model.view.hide_me = hidden;@@ -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,@@ -56,7 +56,7 @@ pub mod urgent_ack;
56
56
57
57
pub use app_ui_kit::render;
58
58
pub use app_base::{
59
APP_NAME, appearance, avatar_image, channel_files, crash_log, demo_cards, demo_chart_cards, demo_gifs,
59
APP_NAME, appearance, autostart, avatar_image, channel_files, crash_log, demo_cards, demo_chart_cards, demo_gifs,
60
60
demo_input_cards, demo_library, demo_recap, diagnostics, downloads, format, frame_log, fuzzy,
61
61
emoticons, image_clipboard, image_view_math, inline_image, presence_link, read_state, recap, remote_image, runtime, schedule_time,
62
62
single_instance, stickers, theme, translation, updater, user_activity, zoom,
@@ -56,7 +56,7 @@ pub mod urgent_ack;56
56
57
pub use app_ui_kit::render;57
pub use app_ui_kit::render;58
pub use app_base::{58
pub use app_base::{59
APP_NAME, appearance, avatar_image, channel_files, crash_log, demo_cards, demo_chart_cards, demo_gifs,59
APP_NAME, appearance, autostart, avatar_image, channel_files, crash_log, demo_cards, demo_chart_cards, demo_gifs,60
demo_input_cards, demo_library, demo_recap, diagnostics, downloads, format, frame_log, fuzzy,60
demo_input_cards, demo_library, demo_recap, diagnostics, downloads, format, frame_log, fuzzy,61
emoticons, image_clipboard, image_view_math, inline_image, presence_link, read_state, recap, remote_image, runtime, schedule_time,61
emoticons, image_clipboard, image_view_math, inline_image, presence_link, read_state, recap, remote_image, runtime, schedule_time,62
single_instance, stickers, theme, translation, updater, user_activity, zoom,62
single_instance, stickers, theme, translation, updater, user_activity, zoom,@@ -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)];@@ -716,6 +716,7 @@ mod frames {
716
716
switcher_query: None,
717
717
composer_text: None,
718
718
reply_to_last: false,
719
launched_by_autostart: false,
719
720
};
720
721
let window = gpui_kit::open_window(WindowOptions::default(), cx, move |window, cx| {
721
722
cx.new(|cx| AppShell::new(state, None, startup, window, cx))
@@ -716,6 +716,7 @@ mod frames {716
switcher_query: None,716
switcher_query: None,717
composer_text: None,717
composer_text: None,718
reply_to_last: false,718
reply_to_last: false,719
launched_by_autostart: false,719
};720
};720
let window = gpui_kit::open_window(WindowOptions::default(), cx, move |window, cx| {721
let window = gpui_kit::open_window(WindowOptions::default(), cx, move |window, cx| {721
cx.new(|cx| AppShell::new(state, None, startup, window, cx))722
cx.new(|cx| AppShell::new(state, None, startup, window, cx))@@ -49,6 +49,7 @@ struct Arguments {
49
49
composer_text: Option<String>,
50
50
reply_to_last: bool,
51
51
channels_tab: bool,
52
autostart: bool,
52
53
demo_sync: Option<Duration>,
53
54
}
54
55
@@ -66,6 +67,7 @@ fn parse_arguments() -> Arguments {
66
67
"--type" => arguments.composer_text = input.next(),
67
68
"--reply-last" => arguments.reply_to_last = true,
68
69
"--channels-tab" => arguments.channels_tab = true,
70
autostart::AUTOSTART_FLAG => arguments.autostart = true,
69
71
"--demo-sync" => {
70
72
arguments.demo_sync = input
71
73
.next()
@@ -235,6 +237,7 @@ fn main() {
235
237
switcher_query: arguments.switcher_query,
236
238
composer_text: arguments.composer_text,
237
239
reply_to_last: arguments.reply_to_last,
240
launched_by_autostart: arguments.autostart,
238
241
};
239
242
let (main_window, _) = gpui_kit::open_window(options, cx, move |window, cx| {
240
243
cx.new(|cx| AppShell::new(state, open_target, startup, window, cx))
@@ -247,7 +250,9 @@ fn main() {
247
250
}
248
251
})
249
252
.detach();
250
cx.activate(true);
253
if !arguments.autostart {
254
cx.activate(true);
255
}
251
256
cx.spawn(async move |cx| {
252
257
loop {
253
258
app_base::native_dumps::heartbeat();
@@ -49,6 +49,7 @@ struct Arguments {49
composer_text: Option<String>,49
composer_text: Option<String>,50
reply_to_last: bool,50
reply_to_last: bool,51
channels_tab: bool,51
channels_tab: bool,52
autostart: bool,52
demo_sync: Option<Duration>,53
demo_sync: Option<Duration>,53
}54
}54
55
@@ -66,6 +67,7 @@ fn parse_arguments() -> Arguments {66
"--type" => arguments.composer_text = input.next(),67
"--type" => arguments.composer_text = input.next(),67
"--reply-last" => arguments.reply_to_last = true,68
"--reply-last" => arguments.reply_to_last = true,68
"--channels-tab" => arguments.channels_tab = true,69
"--channels-tab" => arguments.channels_tab = true,70
autostart::AUTOSTART_FLAG => arguments.autostart = true,69
"--demo-sync" => {71
"--demo-sync" => {70
arguments.demo_sync = input72
arguments.demo_sync = input71
.next()73
.next()@@ -235,6 +237,7 @@ fn main() {235
switcher_query: arguments.switcher_query,237
switcher_query: arguments.switcher_query,236
composer_text: arguments.composer_text,238
composer_text: arguments.composer_text,237
reply_to_last: arguments.reply_to_last,239
reply_to_last: arguments.reply_to_last,240
launched_by_autostart: arguments.autostart,238
};241
};239
let (main_window, _) = gpui_kit::open_window(options, cx, move |window, cx| {242
let (main_window, _) = gpui_kit::open_window(options, cx, move |window, cx| {240
cx.new(|cx| AppShell::new(state, open_target, startup, window, cx))243
cx.new(|cx| AppShell::new(state, open_target, startup, window, cx))@@ -247,7 +250,9 @@ fn main() {247
}250
}248
})251
})249
.detach();252
.detach();250
cx.activate(true);253
if !arguments.autostart {254
cx.activate(true);255
}251
cx.spawn(async move |cx| {256
cx.spawn(async move |cx| {252
loop {257
loop {253
app_base::native_dumps::heartbeat();258
app_base::native_dumps::heartbeat();@@ -32,6 +32,7 @@ use crate::activity::ActivityCenter;
32
32
use crate::agent_api::{self, pending::PendingProposal};
33
33
use crate::agents::{AgentRun, AgentRunsEvent, RunState};
34
34
use crate::app_state::{AppEvent, AppState, selection_for};
35
use crate::autostart::{self, StartupSettings};
35
36
use crate::appearance::AppIcon;
36
37
use crate::call::DemoScene;
37
38
use crate::data::{self, Directory, PresenceKind};
@@ -77,6 +78,7 @@ pub struct NotificationCenter {
77
78
main_window: AnyWindowHandle,
78
79
main_native: Option<NativeHandle>,
79
80
settings: Settings,
81
startup: StartupSettings,
80
82
stack: ToastStack,
81
83
tracker: IncomingTracker,
82
84
throttle: SoundThrottle,
@@ -152,6 +154,7 @@ impl NotificationCenter {
152
154
main_window: window.window_handle(),
153
155
main_native: platform::native_handle(window),
154
156
settings,
157
startup: StartupSettings::load(&app.read(cx).store, !app.read(cx).mode.demo),
155
158
stack: ToastStack::default(),
156
159
tracker: IncomingTracker::new(Utc::now()),
157
160
throttle: SoundThrottle::default(),
@@ -270,6 +273,36 @@ impl NotificationCenter {
270
273
self.stack.get(id).map(|toast| toast.reply_text.clone())
271
274
}
272
275
276
pub fn startup(&self) -> StartupSettings {
277
self.startup
278
}
279
280
pub fn set_auto_start(&mut self, enabled: bool, cx: &mut Context<Self>) {
281
if !self.demo_mode
282
&& let Err(error) = autostart::set_enabled(crate::APP_NAME, enabled)
283
{
284
self.app.update(cx, |state, cx| {
285
state.raise_notice(format!("Auto-start could not be changed: {error}"), None, cx)
286
});
287
return;
288
}
289
self.startup.auto_start = enabled;
290
cx.notify();
291
}
292
293
pub fn set_open_in_background(&mut self, enabled: bool, cx: &mut Context<Self>) {
294
self.startup.open_in_background = enabled;
295
self.startup.save_background(&self.app.read(cx).store);
296
cx.notify();
297
}
298
299
pub fn start_in_background(&self, window: &mut Window) {
300
match (&self.tray, self.main_native) {
301
(Some(_), Some(native)) => platform::hide_window(native),
302
_ => window.minimize_window(),
303
}
304
}
305
273
306
pub fn intercept_close(&self, _cx: &App) -> bool {
274
307
match (self.settings.close_to_tray, &self.tray, self.main_native) {
275
308
(true, Some(_), Some(native)) => {
@@ -32,6 +32,7 @@ use crate::activity::ActivityCenter;32
use crate::agent_api::{self, pending::PendingProposal};32
use crate::agent_api::{self, pending::PendingProposal};33
use crate::agents::{AgentRun, AgentRunsEvent, RunState};33
use crate::agents::{AgentRun, AgentRunsEvent, RunState};34
use crate::app_state::{AppEvent, AppState, selection_for};34
use crate::app_state::{AppEvent, AppState, selection_for};35
use crate::autostart::{self, StartupSettings};35
use crate::appearance::AppIcon;36
use crate::appearance::AppIcon;36
use crate::call::DemoScene;37
use crate::call::DemoScene;37
use crate::data::{self, Directory, PresenceKind};38
use crate::data::{self, Directory, PresenceKind};@@ -77,6 +78,7 @@ pub struct NotificationCenter {77
main_window: AnyWindowHandle,78
main_window: AnyWindowHandle,78
main_native: Option<NativeHandle>,79
main_native: Option<NativeHandle>,79
settings: Settings,80
settings: Settings,81
startup: StartupSettings,80
stack: ToastStack,82
stack: ToastStack,81
tracker: IncomingTracker,83
tracker: IncomingTracker,82
throttle: SoundThrottle,84
throttle: SoundThrottle,@@ -152,6 +154,7 @@ impl NotificationCenter {152
main_window: window.window_handle(),154
main_window: window.window_handle(),153
main_native: platform::native_handle(window),155
main_native: platform::native_handle(window),154
settings,156
settings,157
startup: StartupSettings::load(&app.read(cx).store, !app.read(cx).mode.demo),155
stack: ToastStack::default(),158
stack: ToastStack::default(),156
tracker: IncomingTracker::new(Utc::now()),159
tracker: IncomingTracker::new(Utc::now()),157
throttle: SoundThrottle::default(),160
throttle: SoundThrottle::default(),@@ -270,6 +273,36 @@ impl NotificationCenter {270
self.stack.get(id).map(|toast| toast.reply_text.clone())273
self.stack.get(id).map(|toast| toast.reply_text.clone())271
}274
}272
275
276
pub fn startup(&self) -> StartupSettings {277
self.startup278
}279
280
pub fn set_auto_start(&mut self, enabled: bool, cx: &mut Context<Self>) {281
if !self.demo_mode282
&& let Err(error) = autostart::set_enabled(crate::APP_NAME, enabled)283
{284
self.app.update(cx, |state, cx| {285
state.raise_notice(format!("Auto-start could not be changed: {error}"), None, cx)286
});287
return;288
}289
self.startup.auto_start = enabled;290
cx.notify();291
}292
293
pub fn set_open_in_background(&mut self, enabled: bool, cx: &mut Context<Self>) {294
self.startup.open_in_background = enabled;295
self.startup.save_background(&self.app.read(cx).store);296
cx.notify();297
}298
299
pub fn start_in_background(&self, window: &mut Window) {300
match (&self.tray, self.main_native) {301
(Some(_), Some(native)) => platform::hide_window(native),302
_ => window.minimize_window(),303
}304
}305
273
pub fn intercept_close(&self, _cx: &App) -> bool {306
pub fn intercept_close(&self, _cx: &App) -> bool {274
match (self.settings.close_to_tray, &self.tray, self.main_native) {307
match (self.settings.close_to_tray, &self.tray, self.main_native) {275
(true, Some(_), Some(native)) => {308
(true, Some(_), Some(native)) => {@@ -5,6 +5,7 @@ use gpui_kit::component::{
5
5
menu::{DropdownMenu as _, PopupMenuItem},
6
6
v_flex,
7
7
};
8
use gpui_kit::prelude::FluentBuilder as _;
8
9
use gpui_kit::*;
9
10
use teams_core::{ChatSettingChange, TranslationBehavior};
10
11
@@ -21,14 +22,50 @@ const BEHAVIORS: [(&str, TranslationBehavior); 3] = [
21
22
("Never translate", TranslationBehavior::Never),
22
23
];
23
24
const CHIP_HEIGHT: f32 = 24.;
25
const DISABLED_OPACITY: f32 = 0.4;
24
26
const LANGUAGE_MENU_HEIGHT: f32 = 320.;
25
27
28
fn startup_rows(center: &Entity<NotificationCenter>, cx: &App) -> [Stateful<Div>; 2] {
29
let startup = center.read(cx).startup();
30
let (auto_start_center, background_center) = (center.clone(), center.clone());
31
[
32
toggle_row(
33
"settings-auto-start",
34
"Auto-start Teams",
35
"",
36
theme::text_muted(),
37
startup.auto_start,
38
)
39
.on_click(move |_, _, cx| {
40
auto_start_center.update(cx, |center, cx| {
41
center.set_auto_start(!startup.auto_start, cx)
42
})
43
}),
44
toggle_row(
45
"settings-open-in-background",
46
"Open application in background",
47
"",
48
theme::text_muted(),
49
startup.open_in_background,
50
)
51
.when(!startup.auto_start, |row| row.opacity(DISABLED_OPACITY))
52
.when(startup.auto_start, |row| {
53
row.on_click(move |_, _, cx| {
54
background_center.update(cx, |center, cx| {
55
center.set_open_in_background(!startup.open_in_background, cx)
56
})
57
})
58
}),
59
]
60
}
61
26
62
pub fn render(center: &Entity<NotificationCenter>, app: &Entity<AppState>, cx: &App) -> Div {
27
63
let close_to_tray = center.read(cx).settings().close_to_tray;
28
64
let toggle_center = center.clone();
29
65
v_flex()
30
66
.w_full()
31
67
.child(caption("SYSTEM"))
68
.children(startup_rows(center, cx))
32
69
.child(
33
70
toggle_row(
34
71
"settings-close-to-tray",
@@ -5,6 +5,7 @@ use gpui_kit::component::{5
menu::{DropdownMenu as _, PopupMenuItem},5
menu::{DropdownMenu as _, PopupMenuItem},6
v_flex,6
v_flex,7
};7
};8
use gpui_kit::prelude::FluentBuilder as _;8
use gpui_kit::*;9
use gpui_kit::*;9
use teams_core::{ChatSettingChange, TranslationBehavior};10
use teams_core::{ChatSettingChange, TranslationBehavior};10
11
@@ -21,14 +22,50 @@ const BEHAVIORS: [(&str, TranslationBehavior); 3] = [21
("Never translate", TranslationBehavior::Never),22
("Never translate", TranslationBehavior::Never),22
];23
];23
const CHIP_HEIGHT: f32 = 24.;24
const CHIP_HEIGHT: f32 = 24.;25
const DISABLED_OPACITY: f32 = 0.4;24
const LANGUAGE_MENU_HEIGHT: f32 = 320.;26
const LANGUAGE_MENU_HEIGHT: f32 = 320.;25
27
28
fn startup_rows(center: &Entity<NotificationCenter>, cx: &App) -> [Stateful<Div>; 2] {29
let startup = center.read(cx).startup();30
let (auto_start_center, background_center) = (center.clone(), center.clone());31
[32
toggle_row(33
"settings-auto-start",34
"Auto-start Teams",35
"",36
theme::text_muted(),37
startup.auto_start,38
)39
.on_click(move |_, _, cx| {40
auto_start_center.update(cx, |center, cx| {41
center.set_auto_start(!startup.auto_start, cx)42
})43
}),44
toggle_row(45
"settings-open-in-background",46
"Open application in background",47
"",48
theme::text_muted(),49
startup.open_in_background,50
)51
.when(!startup.auto_start, |row| row.opacity(DISABLED_OPACITY))52
.when(startup.auto_start, |row| {53
row.on_click(move |_, _, cx| {54
background_center.update(cx, |center, cx| {55
center.set_open_in_background(!startup.open_in_background, cx)56
})57
})58
}),59
]60
}61
26
pub fn render(center: &Entity<NotificationCenter>, app: &Entity<AppState>, cx: &App) -> Div {62
pub fn render(center: &Entity<NotificationCenter>, app: &Entity<AppState>, cx: &App) -> Div {27
let close_to_tray = center.read(cx).settings().close_to_tray;63
let close_to_tray = center.read(cx).settings().close_to_tray;28
let toggle_center = center.clone();64
let toggle_center = center.clone();29
v_flex()65
v_flex()30
.w_full()66
.w_full()31
.child(caption("SYSTEM"))67
.child(caption("SYSTEM"))68
.children(startup_rows(center, cx))32
.child(69
.child(33
toggle_row(70
toggle_row(34
"settings-close-to-tray",71
"settings-close-to-tray",@@ -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
@@ -249,6 +249,22 @@ pub fn tile_menu(
249
249
pin_app.update(cx, |state, cx| state.toggle_call_pin(&pin_mri, cx))
250
250
}),
251
251
);
252
if model.is_one_to_one()
253
|| model
254
.tiles
255
.iter()
256
.any(|tile| tile.mri == mri && tile.has_video)
257
{
258
let (fit_app, fit_mri) = (app.clone(), mri.to_owned());
259
let fitted = model.is_fitted(mri);
260
popup = popup.item(
261
PopupMenuItem::new(if fitted { "Fill frame" } else { "Fit to frame" })
262
.icon(if fitted { IconName::Expand } else { IconName::Shrink })
263
.on_click(move |_, _, cx| {
264
fit_app.update(cx, |state, cx| state.toggle_call_fit(&fit_mri, cx))
265
}),
266
);
267
}
252
268
if organizes {
253
269
let (spotlight_app, spotlight_mri) = (app.clone(), mri.to_owned());
254
270
popup = popup.item(
@@ -249,6 +249,22 @@ pub fn tile_menu(249
pin_app.update(cx, |state, cx| state.toggle_call_pin(&pin_mri, cx))249
pin_app.update(cx, |state, cx| state.toggle_call_pin(&pin_mri, cx))250
}),250
}),251
);251
);252
if model.is_one_to_one()253
|| model254
.tiles255
.iter()256
.any(|tile| tile.mri == mri && tile.has_video)257
{258
let (fit_app, fit_mri) = (app.clone(), mri.to_owned());259
let fitted = model.is_fitted(mri);260
popup = popup.item(261
PopupMenuItem::new(if fitted { "Fill frame" } else { "Fit to frame" })262
.icon(if fitted { IconName::Expand } else { IconName::Shrink })263
.on_click(move |_, _, cx| {264
fit_app.update(cx, |state, cx| state.toggle_call_fit(&fit_mri, cx))265
}),266
);267
}252
if organizes {268
if organizes {253
let (spotlight_app, spotlight_mri) = (app.clone(), mri.to_owned());269
let (spotlight_app, spotlight_mri) = (app.clone(), mri.to_owned());254
popup = popup.item(270
popup = popup.item(@@ -97,6 +97,7 @@ struct TileExtras {
97
97
reaction: Option<(Reaction, u64)>,
98
98
spotlight: bool,
99
99
pinned: bool,
100
fitted: bool,
100
101
}
101
102
102
103
fn hand_badge(position: usize, own: bool) -> Div {
@@ -172,6 +173,8 @@ pub fn status_line(model: &CallModel, now: Instant) -> (String, Hsla) {
172
173
(model.connecting_text().to_owned(), theme::text_muted())
173
174
} else if model.is_reconnecting() {
174
175
("Reconnecting...".to_owned(), theme::amber())
176
} else if model.view.hide_timer {
177
(String::new(), theme::text_muted())
175
178
} else {
176
179
(model.timer_text(now), theme::text_muted())
177
180
}
@@ -253,7 +256,11 @@ fn video_tile(
253
256
.child(
254
257
img(ImageSource::Render(image))
255
258
.size_full()
256
.object_fit(ObjectFit::Cover)
259
.object_fit(if extras.fitted {
260
ObjectFit::Contain
261
} else {
262
ObjectFit::Cover
263
})
257
264
.rounded(px(TILE_RADIUS)),
258
265
)
259
266
.child(
@@ -992,6 +999,7 @@ pub(super) fn plain_person_tile(
992
999
.map(|chip| (chip.reaction.clone(), chip.serial)),
993
1000
spotlight: remote.spotlight.is_some(),
994
1001
pinned: model.is_pinned(&remote.mri),
1002
fitted: model.is_fitted(&remote.mri),
995
1003
};
996
1004
person_tile_body(state, model, remote, size, now, &extras)
997
1005
}
@@ -1081,6 +1089,7 @@ pub(super) fn plain_own_tile(
1081
1089
reaction: model.own_chip(now).map(|chip| (chip.reaction.clone(), chip.serial)),
1082
1090
spotlight: model.own_spotlight.is_some(),
1083
1091
pinned: model.is_pinned(own_mri),
1092
fitted: false,
1084
1093
};
1085
1094
own_tile_body(state, model, size, now, &extras)
1086
1095
}
@@ -97,6 +97,7 @@ struct TileExtras {97
reaction: Option<(Reaction, u64)>,97
reaction: Option<(Reaction, u64)>,98
spotlight: bool,98
spotlight: bool,99
pinned: bool,99
pinned: bool,100
fitted: bool,100
}101
}101
102
102
fn hand_badge(position: usize, own: bool) -> Div {103
fn hand_badge(position: usize, own: bool) -> Div {@@ -172,6 +173,8 @@ pub fn status_line(model: &CallModel, now: Instant) -> (String, Hsla) {172
(model.connecting_text().to_owned(), theme::text_muted())173
(model.connecting_text().to_owned(), theme::text_muted())173
} else if model.is_reconnecting() {174
} else if model.is_reconnecting() {174
("Reconnecting...".to_owned(), theme::amber())175
("Reconnecting...".to_owned(), theme::amber())176
} else if model.view.hide_timer {177
(String::new(), theme::text_muted())175
} else {178
} else {176
(model.timer_text(now), theme::text_muted())179
(model.timer_text(now), theme::text_muted())177
}180
}@@ -253,7 +256,11 @@ fn video_tile(253
.child(256
.child(254
img(ImageSource::Render(image))257
img(ImageSource::Render(image))255
.size_full()258
.size_full()256
.object_fit(ObjectFit::Cover)259
.object_fit(if extras.fitted {260
ObjectFit::Contain261
} else {262
ObjectFit::Cover263
})257
.rounded(px(TILE_RADIUS)),264
.rounded(px(TILE_RADIUS)),258
)265
)259
.child(266
.child(@@ -992,6 +999,7 @@ pub(super) fn plain_person_tile(992
.map(|chip| (chip.reaction.clone(), chip.serial)),999
.map(|chip| (chip.reaction.clone(), chip.serial)),993
spotlight: remote.spotlight.is_some(),1000
spotlight: remote.spotlight.is_some(),994
pinned: model.is_pinned(&remote.mri),1001
pinned: model.is_pinned(&remote.mri),1002
fitted: model.is_fitted(&remote.mri),995
};1003
};996
person_tile_body(state, model, remote, size, now, &extras)1004
person_tile_body(state, model, remote, size, now, &extras)997
}1005
}@@ -1081,6 +1089,7 @@ pub(super) fn plain_own_tile(1081
reaction: model.own_chip(now).map(|chip| (chip.reaction.clone(), chip.serial)),1089
reaction: model.own_chip(now).map(|chip| (chip.reaction.clone(), chip.serial)),1082
spotlight: model.own_spotlight.is_some(),1090
spotlight: model.own_spotlight.is_some(),1083
pinned: model.is_pinned(own_mri),1091
pinned: model.is_pinned(own_mri),1092
fitted: false,1084
};1093
};1085
own_tile_body(state, model, size, now, &extras)1094
own_tile_body(state, model, size, now, &extras)1086
}1095
}@@ -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,
@@ -248,6 +248,14 @@ pub fn enter_starts_line(behavior: EnterKeyBehavior, shift: bool, secondary: boo
248
248
behavior == EnterKeyBehavior::NewLine && !shift && !secondary
249
249
}
250
250
251
pub fn enter_behavior(setting: EnterKeyBehavior, expanded: bool) -> EnterKeyBehavior {
252
if expanded {
253
EnterKeyBehavior::NewLine
254
} else {
255
setting
256
}
257
}
258
251
259
pub fn up_arrow_event(behavior: UpArrowBehavior) -> Option<ComposerEvent> {
252
260
match behavior {
253
261
UpArrowBehavior::EditLastMessage => Some(ComposerEvent::EditLast),
@@ -3103,6 +3111,9 @@ impl Render for Composer {
3103
3111
.on_action(cx.listener(|this, _: &ToggleFormatBar, window, cx| {
3104
3112
this.toggle_format_bar(window, cx)
3105
3113
}))
3114
.on_action(cx.listener(|_, _: &EditLastMessage, _, cx| {
3115
cx.emit(ComposerEvent::EditLast)
3116
}))
3106
3117
.on_action(cx.listener(|this, _: &InsertTableLine, window, cx| {
3107
3118
this.open_table_menu(TableLineMenu::Insert, window, cx);
3108
3119
}))
@@ -3227,7 +3238,10 @@ impl Render for Composer {
3227
3238
this.accept_popup(window, cx);
3228
3239
cx.stop_propagation();
3229
3240
} else if enter_starts_line(
3230
this.app.read(cx).account_chat_settings().enter_key,
3241
enter_behavior(
3242
this.app.read(cx).account_chat_settings().enter_key,
3243
this.format_bar_open() && !this.app.read(cx).markdown_mode,
3244
),
3231
3245
action.shift,
3232
3246
action.secondary,
3233
3247
) {
@@ -3419,8 +3433,8 @@ impl Render for Composer {
3419
3433
#[cfg(test)]
3420
3434
mod tests {
3421
3435
use super::{
3422
ComposerEvent, EnterKeyBehavior, UpArrowBehavior, active_mention, enter_starts_line,
3423
submitted_text, up_arrow_event,
3436
ComposerEvent, EnterKeyBehavior, UpArrowBehavior, active_mention, enter_behavior,
3437
enter_starts_line, submitted_text, up_arrow_event,
3424
3438
};
3425
3439
3426
3440
#[test]
@@ -3431,6 +3445,22 @@ mod tests {
3431
3445
assert!(!enter_starts_line(EnterKeyBehavior::Send, false, false));
3432
3446
}
3433
3447
3448
#[test]
3449
fn expanded_compose_box_starts_a_line_on_enter_like_teams() {
3450
assert_eq!(
3451
enter_behavior(EnterKeyBehavior::Send, true),
3452
EnterKeyBehavior::NewLine
3453
);
3454
assert_eq!(
3455
enter_behavior(EnterKeyBehavior::Send, false),
3456
EnterKeyBehavior::Send
3457
);
3458
assert_eq!(
3459
enter_behavior(EnterKeyBehavior::NewLine, false),
3460
EnterKeyBehavior::NewLine
3461
);
3462
}
3463
3434
3464
#[test]
3435
3465
fn up_arrow_follows_the_account_setting() {
3436
3466
assert!(matches!(
@@ -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,@@ -248,6 +248,14 @@ pub fn enter_starts_line(behavior: EnterKeyBehavior, shift: bool, secondary: boo248
behavior == EnterKeyBehavior::NewLine && !shift && !secondary248
behavior == EnterKeyBehavior::NewLine && !shift && !secondary249
}249
}250
250
251
pub fn enter_behavior(setting: EnterKeyBehavior, expanded: bool) -> EnterKeyBehavior {252
if expanded {253
EnterKeyBehavior::NewLine254
} else {255
setting256
}257
}258
251
pub fn up_arrow_event(behavior: UpArrowBehavior) -> Option<ComposerEvent> {259
pub fn up_arrow_event(behavior: UpArrowBehavior) -> Option<ComposerEvent> {252
match behavior {260
match behavior {253
UpArrowBehavior::EditLastMessage => Some(ComposerEvent::EditLast),261
UpArrowBehavior::EditLastMessage => Some(ComposerEvent::EditLast),@@ -3103,6 +3111,9 @@ impl Render for Composer {3103
.on_action(cx.listener(|this, _: &ToggleFormatBar, window, cx| {3111
.on_action(cx.listener(|this, _: &ToggleFormatBar, window, cx| {3104
this.toggle_format_bar(window, cx)3112
this.toggle_format_bar(window, cx)3105
}))3113
}))3114
.on_action(cx.listener(|_, _: &EditLastMessage, _, cx| {3115
cx.emit(ComposerEvent::EditLast)3116
}))3106
.on_action(cx.listener(|this, _: &InsertTableLine, window, cx| {3117
.on_action(cx.listener(|this, _: &InsertTableLine, window, cx| {3107
this.open_table_menu(TableLineMenu::Insert, window, cx);3118
this.open_table_menu(TableLineMenu::Insert, window, cx);3108
}))3119
}))@@ -3227,7 +3238,10 @@ impl Render for Composer {3227
this.accept_popup(window, cx);3238
this.accept_popup(window, cx);3228
cx.stop_propagation();3239
cx.stop_propagation();3229
} else if enter_starts_line(3240
} else if enter_starts_line(3230
this.app.read(cx).account_chat_settings().enter_key,3241
enter_behavior(3242
this.app.read(cx).account_chat_settings().enter_key,3243
this.format_bar_open() && !this.app.read(cx).markdown_mode,3244
),3231
action.shift,3245
action.shift,3232
action.secondary,3246
action.secondary,3233
) {3247
) {@@ -3419,8 +3433,8 @@ impl Render for Composer {3419
#[cfg(test)]3433
#[cfg(test)]3420
mod tests {3434
mod tests {3421
use super::{3435
use super::{3422
ComposerEvent, EnterKeyBehavior, UpArrowBehavior, active_mention, enter_starts_line,3436
ComposerEvent, EnterKeyBehavior, UpArrowBehavior, active_mention, enter_behavior,3423
submitted_text, up_arrow_event,3437
enter_starts_line, submitted_text, up_arrow_event,3424
};3438
};3425
3439
3426
#[test]3440
#[test]@@ -3431,6 +3445,22 @@ mod tests {3431
assert!(!enter_starts_line(EnterKeyBehavior::Send, false, false));3445
assert!(!enter_starts_line(EnterKeyBehavior::Send, false, false));3432
}3446
}3433
3447
3448
#[test]3449
fn expanded_compose_box_starts_a_line_on_enter_like_teams() {3450
assert_eq!(3451
enter_behavior(EnterKeyBehavior::Send, true),3452
EnterKeyBehavior::NewLine3453
);3454
assert_eq!(3455
enter_behavior(EnterKeyBehavior::Send, false),3456
EnterKeyBehavior::Send3457
);3458
assert_eq!(3459
enter_behavior(EnterKeyBehavior::NewLine, false),3460
EnterKeyBehavior::NewLine3461
);3462
}3463
3434
#[test]3464
#[test]3435
fn up_arrow_follows_the_account_setting() {3465
fn up_arrow_follows_the_account_setting() {3436
assert!(matches!(3466
assert!(matches!(@@ -1265,6 +1265,11 @@ impl ConversationView {
1265
1265
.update(cx, |composer, cx| composer.focus(window, cx));
1266
1266
}
1267
1267
1268
pub fn focus_composer(&mut self, window: &mut Window, cx: &mut Context<Self>) {
1269
self.composer
1270
.update(cx, |composer, cx| composer.focus(window, cx));
1271
}
1272
1268
1273
pub fn reply_to_latest_from_others(&mut self, window: &mut Window, cx: &mut Context<Self>) {
1269
1274
let key = self
1270
1275
.rows
@@ -1265,6 +1265,11 @@ impl ConversationView {1265
.update(cx, |composer, cx| composer.focus(window, cx));1265
.update(cx, |composer, cx| composer.focus(window, cx));1266
}1266
}1267
1267
1268
pub fn focus_composer(&mut self, window: &mut Window, cx: &mut Context<Self>) {1269
self.composer1270
.update(cx, |composer, cx| composer.focus(window, cx));1271
}1272
1268
pub fn reply_to_latest_from_others(&mut self, window: &mut Window, cx: &mut Context<Self>) {1273
pub fn reply_to_latest_from_others(&mut self, window: &mut Window, cx: &mut Context<Self>) {1269
let key = self1274
let key = self1270
.rows1275
.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, PopOutSelectedChat, OpenLobbyList, OpenSaved, PreviousConversation, PushToTalk,
26
28
Scope, ShowShortcuts, StartAudioCall, StartVideoCall, ToggleCallCamera, ToggleCallFullscreen,
@@ -77,6 +79,7 @@ pub struct Startup {
77
79
pub switcher_query: Option<String>,
78
80
pub composer_text: Option<String>,
79
81
pub reply_to_last: bool,
82
pub launched_by_autostart: bool,
80
83
}
81
84
82
85
pub const SIDEBAR_HIDDEN_BELOW: f32 = 960.;
@@ -357,7 +360,18 @@ impl AppShell {
357
360
switcher_query,
358
361
composer_text,
359
362
reply_to_last,
363
launched_by_autostart,
360
364
} = startup;
365
if shell
366
.notifications
367
.read(cx)
368
.startup()
369
.starts_hidden(launched_by_autostart)
370
{
371
cx.defer_in(window, |this, window, cx| {
372
this.notifications.read(cx).start_in_background(window)
373
});
374
}
361
375
if let Some(query) = switcher_query {
362
376
shell.toggle_switcher(&query, window, cx);
363
377
}
@@ -920,10 +934,11 @@ impl Render for AppShell {
920
934
.flatten(),
921
935
cx.listener(|this, _, window, cx| this.toggle_switcher("", window, cx)),
922
936
);
923
div()
937
let shell = div()
924
938
.id("app-shell")
925
939
.key_context("AppShell")
926
.track_focus(&self.focus_handle)
940
.track_focus(&self.focus_handle);
941
self.team_keys(shell, cx)
927
942
.on_action(cx.listener(|this, _: &OpenSwitcher, window, cx| {
928
943
this.toggle_switcher("", window, cx);
929
944
}))
@@ -1034,10 +1049,6 @@ impl Render for AppShell {
1034
1049
this.sidebar
1035
1050
.update(cx, |sidebar, cx| sidebar.select_adjacent(Step::Next, cx));
1036
1051
}))
1037
.on_action(cx.listener(|this, _: &AcceptCall, _, cx| {
1038
this.state
1039
.update(cx, |state, cx| state.accept_ringing_call(cx));
1040
}))
1041
1052
.on_action(cx.listener(|this, _: &DeclineCall, _, cx| {
1042
1053
this.state
1043
1054
.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, PopOutSelectedChat, OpenLobbyList, OpenSaved, PreviousConversation, PushToTalk,27
OpenAgents, OpenCallsTab, OpenSettings, OpenChannelsTab, OpenChatFilter, OpenChatsTab, PopOutSelectedChat, OpenLobbyList, OpenSaved, PreviousConversation, PushToTalk,26
Scope, ShowShortcuts, StartAudioCall, StartVideoCall, ToggleCallCamera, ToggleCallFullscreen,28
Scope, ShowShortcuts, StartAudioCall, StartVideoCall, ToggleCallCamera, ToggleCallFullscreen,@@ -77,6 +79,7 @@ pub struct Startup {77
pub switcher_query: Option<String>,79
pub switcher_query: Option<String>,78
pub composer_text: Option<String>,80
pub composer_text: Option<String>,79
pub reply_to_last: bool,81
pub reply_to_last: bool,82
pub launched_by_autostart: bool,80
}83
}81
84
82
pub const SIDEBAR_HIDDEN_BELOW: f32 = 960.;85
pub const SIDEBAR_HIDDEN_BELOW: f32 = 960.;@@ -357,7 +360,18 @@ impl AppShell {357
switcher_query,360
switcher_query,358
composer_text,361
composer_text,359
reply_to_last,362
reply_to_last,363
launched_by_autostart,360
} = startup;364
} = startup;365
if shell366
.notifications367
.read(cx)368
.startup()369
.starts_hidden(launched_by_autostart)370
{371
cx.defer_in(window, |this, window, cx| {372
this.notifications.read(cx).start_in_background(window)373
});374
}361
if let Some(query) = switcher_query {375
if let Some(query) = switcher_query {362
shell.toggle_switcher(&query, window, cx);376
shell.toggle_switcher(&query, window, cx);363
}377
}@@ -920,10 +934,11 @@ impl Render for AppShell {920
.flatten(),934
.flatten(),921
cx.listener(|this, _, window, cx| this.toggle_switcher("", window, cx)),935
cx.listener(|this, _, window, cx| this.toggle_switcher("", window, cx)),922
);936
);923
div()937
let shell = div()924
.id("app-shell")938
.id("app-shell")925
.key_context("AppShell")939
.key_context("AppShell")926
.track_focus(&self.focus_handle)940
.track_focus(&self.focus_handle);941
self.team_keys(shell, cx)927
.on_action(cx.listener(|this, _: &OpenSwitcher, window, cx| {942
.on_action(cx.listener(|this, _: &OpenSwitcher, window, cx| {928
this.toggle_switcher("", window, cx);943
this.toggle_switcher("", window, cx);929
}))944
}))@@ -1034,10 +1049,6 @@ impl Render for AppShell {1034
this.sidebar1049
this.sidebar1035
.update(cx, |sidebar, cx| sidebar.select_adjacent(Step::Next, cx));1050
.update(cx, |sidebar, cx| sidebar.select_adjacent(Step::Next, cx));1036
}))1051
}))1037
.on_action(cx.listener(|this, _: &AcceptCall, _, cx| {1038
this.state1039
.update(cx, |state, cx| state.accept_ringing_call(cx));1040
}))1041
.on_action(cx.listener(|this, _: &DeclineCall, _, cx| {1052
.on_action(cx.listener(|this, _: &DeclineCall, _, cx| {1042
this.state1053
this.state1043
.update(cx, |state, cx| state.decline_ringing_call(cx));1054
.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
}@@ -1,16 +1,18 @@
1
use gpui_kit::component::input::Enter;
1
2
use gpui_kit::*;
2
3
3
4
use super::actions::{
4
COMPOSER_KEY_CONTEXT as COMPOSER_CONTEXT, EditLink, InsertTableLine, NewChat, OpenSwitcher,
5
PastePlainText, RemoveTableLine, ReplyToHovered, ScheduleSend, ToggleBold, ToggleCallMute,
6
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,
7
9
ToggleUnderline, SetParagraph, SetHeading1, SetHeading2, SetHeading3, ToggleCodeBlock,
8
10
ToggleQuote,
9
11
};
10
12
11
13
const TEXT_FIELD_CONTEXT: &str = "Input";
12
14
const OUTSIDE_COMPOSER_CONTEXT: &str = "!Composer";
13
const OUTSIDE_TEXT_FIELD_CONTEXT: &str = "!Input";
15
const OUTSIDE_TEXT_FIELD_CONTEXT: &str = "!Input && !Composer";
14
16
const ALTERNATE_KEYS: &[(&str, &str)] = &[
15
17
("Zoom in on shared content", "alt-shift-+"),
16
18
("Insert column or row", "ctrl-alt-+"),
@@ -41,6 +43,18 @@ actions!(
41
43
PreviousConversation,
42
44
NextConversation,
43
45
JumpToLastReadOrNewest,
46
GoToComposeBox,
47
ReplyToLastMessage,
48
PreviousUnreadConversation,
49
NextUnreadConversation,
50
SetPresenceAvailable,
51
SetPresenceBusy,
52
SetPresenceDoNotDisturb,
53
SetPresenceBeRightBack,
54
SetPresenceAway,
55
AcceptAudioCall,
56
ToggleBackgroundBlur,
57
ToggleLiveCaptions,
44
58
AcceptCall,
45
59
DeclineCall,
46
60
JoinMeetingFromToast,
@@ -131,6 +145,11 @@ pub const SHORTCUTS: &[Shortcut] = &[
131
145
shortcut!(General, OutsideComposer, "Zoom in", "ctrl-=", Some("cmd-="), ZoomIn),
132
146
shortcut!(General, GlobalOverTextFields, "Zoom out", "ctrl--", Some("cmd--"), ZoomOut),
133
147
shortcut!(General, GlobalOverTextFields, "Reset zoom level", "ctrl-0", Some("cmd-0"), ZoomReset),
148
shortcut!(General, Global, "Set presence status to Available", "alt-shift-q", None, SetPresenceAvailable),
149
shortcut!(General, Global, "Set presence status to Busy", "alt-shift-y", None, SetPresenceBusy),
150
shortcut!(General, Global, "Set presence status to Do Not Disturb", "alt-shift-u", None, SetPresenceDoNotDisturb),
151
shortcut!(General, Global, "Set presence status to Be Right Back", "alt-shift-k", None, SetPresenceBeRightBack),
152
shortcut!(General, Global, "Set presence status to Away", "alt-shift-w", None, SetPresenceAway),
134
153
shortcut!(Navigation, GlobalOverTextFields, "Open Activity", "ctrl-1", Some("cmd-1"), OpenActivity),
135
154
shortcut!(Navigation, GlobalOverTextFields, "Show Chats", "ctrl-2", Some("cmd-2"), OpenChatsTab),
136
155
shortcut!(Navigation, GlobalOverTextFields, "Show Channels", "ctrl-3", Some("cmd-3"), OpenChannelsTab),
@@ -139,6 +158,10 @@ pub const SHORTCUTS: &[Shortcut] = &[
139
158
shortcut!(Navigation, GlobalOverTextFields, "Open Agents", "ctrl-6", Some("cmd-6"), OpenAgents),
140
159
shortcut!(Navigation, GlobalOverTextFields, "Previous chat or channel", "alt-up", None, PreviousConversation),
141
160
shortcut!(Navigation, GlobalOverTextFields, "Next chat or channel", "alt-down", None, NextConversation),
161
shortcut!(Navigation, GlobalOverTextFields, "Go to previous unread conversation", "ctrl-alt-up", None, PreviousUnreadConversation),
162
shortcut!(Navigation, GlobalOverTextFields, "Go to next unread conversation", "ctrl-alt-down", None, NextUnreadConversation),
163
shortcut!(Navigation, GlobalOverTextFields, "Go to a specific chat or channel", "ctrl-g", Some("cmd-g"), OpenSwitcher),
164
shortcut!(Navigation, Global, "Go to compose box", "ctrl-r", Some("cmd-r"), GoToComposeBox),
142
165
shortcut!(Navigation, GlobalOverTextFields, "Open filter", "ctrl-shift-f", Some("cmd-shift-f"), OpenChatFilter),
143
166
shortcut!(Navigation, OutsideTextFields, "Filter chat list by unread chats only", "ctrl-alt-u", None, FilterUnreadChats),
144
167
shortcut!(Navigation, OutsideTextFields, "Filter chat list by chats only", "ctrl-alt-c", None, FilterNonMeetingChats),
@@ -147,11 +170,14 @@ pub const SHORTCUTS: &[Shortcut] = &[
147
170
shortcut!(Navigation, OutsideTextFields, "Remove all filters in the chat list", "ctrl-alt-z", None, ClearChatFilters),
148
171
shortcut!(Composer, GlobalOverTextFields, "Find in chat", "ctrl-f", Some("cmd-f"), FindInChat),
149
172
shortcut!(Composer, Global, "Reply to the message under the pointer", "alt-r", None, ReplyToHovered),
173
shortcut!(Composer, Global, "Reply to the last message", "alt-shift-r", None, ReplyToLastMessage),
174
shortcut!(Composer, Composer, "Edit last message", "ctrl-up", Some("cmd-up"), EditLastMessage),
150
175
shortcut!(Composer, Global, "Jump to last read or newest message", "ctrl-j", Some("cmd-j"), JumpToLastReadOrNewest),
151
176
shortcut!(Composer, Composer, "Bold", "ctrl-b", Some("cmd-b"), ToggleBold),
152
177
shortcut!(Composer, Composer, "Italic", "ctrl-i", Some("cmd-i"), ToggleItalic),
153
178
shortcut!(Composer, Composer, "Underline", "ctrl-u", Some("cmd-u"), ToggleUnderline),
154
shortcut!(Composer, Composer, "Format", "ctrl-shift-x", Some("cmd-shift-x"), ToggleFormatBar),
179
shortcut!(Composer, Composer, "Expand compose box", "ctrl-shift-x", Some("cmd-shift-x"), ToggleFormatBar),
180
shortcut!(Composer, Composer, "Send (expanded compose box)", "ctrl-enter", Some("cmd-enter"), Enter { secondary: true, shift: false }),
155
181
shortcut!(Composer, Composer, "Strikethrough", "ctrl-alt-x", None, ToggleStrike),
156
182
shortcut!(Composer, Composer, "Superscript", "ctrl-shift-=", None, ToggleSuperscript),
157
183
shortcut!(Composer, Composer, "Subscript", "ctrl-=", None, ToggleSubscript),
@@ -167,14 +193,17 @@ pub const SHORTCUTS: &[Shortcut] = &[
167
193
shortcut!(Composer, Composer, "Heading 2", "ctrl-alt-2", None, SetHeading2),
168
194
shortcut!(Composer, Composer, "Heading 3", "ctrl-alt-3", None, SetHeading3),
169
195
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),
196
shortcut!(Calls, GlobalOverTextFields, "Accept video call", "ctrl-shift-a", Some("cmd-shift-a"), AcceptCall),
197
shortcut!(Calls, GlobalOverTextFields, "Accept audio call", "ctrl-shift-s", Some("cmd-shift-s"), AcceptAudioCall),
198
shortcut!(Calls, GlobalOverTextFields, "Decline call", "ctrl-shift-d", Some("cmd-shift-d"), DeclineCall),
172
199
shortcut!(Calls, GlobalOverTextFields, "Join the meeting from its reminder", "ctrl-shift-j", Some("cmd-shift-j"), JoinMeetingFromToast),
173
200
shortcut!(Calls, GlobalOverTextFields, "Hang up or leave", "ctrl-shift-h", Some("cmd-shift-h"), HangUpCall),
174
201
shortcut!(Calls, GlobalOverTextFields, "Mute or unmute", "ctrl-shift-m", None, ToggleCallMute),
175
202
shortcut!(Calls, GlobalOverTextFields, "Turn camera on or off", "ctrl-shift-o", Some("cmd-shift-o"), ToggleCallCamera),
176
203
shortcut!(Calls, GlobalOverTextFields, "Open the share menu or stop sharing", "ctrl-shift-e", Some("cmd-shift-e"), ToggleCallShare),
177
204
shortcut!(Calls, GlobalOverTextFields, "Raise or lower hand", "ctrl-shift-k", Some("cmd-shift-k"), ToggleCallHand),
205
shortcut!(Calls, GlobalOverTextFields, "Toggle background blur", "ctrl-shift-p", Some("cmd-shift-p"), ToggleBackgroundBlur),
206
shortcut!(Calls, GlobalOverTextFields, "Toggle live captions", "alt-shift-c", None, ToggleLiveCaptions),
178
207
shortcut!(Calls, GlobalOverTextFields, "Open the lobby list", "ctrl-shift-y", Some("cmd-shift-y"), OpenLobbyList),
179
208
shortcut!(Calls, GlobalOverTextFields, "Start an audio call in this chat", "alt-shift-a", None, StartAudioCall),
180
209
shortcut!(Calls, GlobalOverTextFields, "Start a video call in this chat", "alt-shift-v", None, StartVideoCall),
@@ -379,6 +408,43 @@ mod tests {
379
408
}
380
409
}
381
410
411
#[gpui_kit::test]
412
fn teams_message_presence_and_call_keys_resolve(cx: &mut TestAppContext) {
413
registered(cx);
414
let action_of = |label: &str| {
415
action_name(
416
SHORTCUTS
417
.iter()
418
.find(|shortcut| shortcut.label == label)
419
.unwrap(),
420
)
421
};
422
let typing = ["AppShell", "Composer", "Input"];
423
for (keys, label) in [
424
("ctrl-r", "Go to compose box"),
425
("alt-shift-r", "Reply to the last message"),
426
("ctrl-up", "Edit last message"),
427
("ctrl-alt-up", "Go to previous unread conversation"),
428
("ctrl-alt-down", "Go to next unread conversation"),
429
("ctrl-g", "Go to a specific chat or channel"),
430
("alt-shift-q", "Set presence status to Available"),
431
("alt-shift-y", "Set presence status to Busy"),
432
("alt-shift-u", "Set presence status to Do Not Disturb"),
433
("alt-shift-k", "Set presence status to Be Right Back"),
434
("alt-shift-w", "Set presence status to Away"),
435
("ctrl-shift-a", "Accept video call"),
436
("ctrl-shift-s", "Accept audio call"),
437
("ctrl-shift-p", "Toggle background blur"),
438
("alt-shift-c", "Toggle live captions"),
439
] {
440
assert_eq!(
441
bound_action(cx, keys, &typing),
442
Some(action_of(label)),
443
"{keys}"
444
);
445
}
446
}
447
382
448
#[test]
383
449
fn every_group_lists_shortcuts_and_keys_read_like_teams() {
384
450
for group in Group::ALL {
@@ -444,7 +510,8 @@ mod tests {
444
510
)
445
511
};
446
512
for (keys, label) in [
447
("ctrl-shift-x", "Format"),
513
("ctrl-shift-x", "Expand compose box"),
514
("ctrl-enter", "Send (expanded compose box)"),
448
515
("ctrl-alt-x", "Strikethrough"),
449
516
("ctrl-alt-=", "Insert column or row"),
450
517
("ctrl-alt-+", "Insert column or row"),
@@ -1,16 +1,18 @@1
use gpui_kit::component::input::Enter;1
use gpui_kit::*;2
use gpui_kit::*;2
3
3
use super::actions::{4
use super::actions::{4
COMPOSER_KEY_CONTEXT as COMPOSER_CONTEXT, EditLink, InsertTableLine, NewChat, OpenSwitcher,5
COMPOSER_KEY_CONTEXT as COMPOSER_CONTEXT, EditLastMessage, EditLink, InsertTableLine, NewChat,5
PastePlainText, RemoveTableLine, ReplyToHovered, ScheduleSend, ToggleBold, ToggleCallMute,6
OpenSwitcher, PastePlainText, RemoveTableLine, ReplyToHovered, ScheduleSend, ToggleBold,6
ToggleCode, ToggleFormatBar, ToggleItalic, ToggleStrike, ToggleSubscript, ToggleSuperscript,7
ToggleCallMute, ToggleCode, ToggleFormatBar, ToggleItalic, ToggleStrike, ToggleSubscript,8
ToggleSuperscript,7
ToggleUnderline, SetParagraph, SetHeading1, SetHeading2, SetHeading3, ToggleCodeBlock,9
ToggleUnderline, SetParagraph, SetHeading1, SetHeading2, SetHeading3, ToggleCodeBlock,8
ToggleQuote,10
ToggleQuote,9
};11
};10
12
11
const TEXT_FIELD_CONTEXT: &str = "Input";13
const TEXT_FIELD_CONTEXT: &str = "Input";12
const OUTSIDE_COMPOSER_CONTEXT: &str = "!Composer";14
const OUTSIDE_COMPOSER_CONTEXT: &str = "!Composer";13
const OUTSIDE_TEXT_FIELD_CONTEXT: &str = "!Input";15
const OUTSIDE_TEXT_FIELD_CONTEXT: &str = "!Input && !Composer";14
const ALTERNATE_KEYS: &[(&str, &str)] = &[16
const ALTERNATE_KEYS: &[(&str, &str)] = &[15
("Zoom in on shared content", "alt-shift-+"),17
("Zoom in on shared content", "alt-shift-+"),16
("Insert column or row", "ctrl-alt-+"),18
("Insert column or row", "ctrl-alt-+"),@@ -41,6 +43,18 @@ actions!(41
PreviousConversation,43
PreviousConversation,42
NextConversation,44
NextConversation,43
JumpToLastReadOrNewest,45
JumpToLastReadOrNewest,46
GoToComposeBox,47
ReplyToLastMessage,48
PreviousUnreadConversation,49
NextUnreadConversation,50
SetPresenceAvailable,51
SetPresenceBusy,52
SetPresenceDoNotDisturb,53
SetPresenceBeRightBack,54
SetPresenceAway,55
AcceptAudioCall,56
ToggleBackgroundBlur,57
ToggleLiveCaptions,44
AcceptCall,58
AcceptCall,45
DeclineCall,59
DeclineCall,46
JoinMeetingFromToast,60
JoinMeetingFromToast,@@ -131,6 +145,11 @@ pub const SHORTCUTS: &[Shortcut] = &[131
shortcut!(General, OutsideComposer, "Zoom in", "ctrl-=", Some("cmd-="), ZoomIn),145
shortcut!(General, OutsideComposer, "Zoom in", "ctrl-=", Some("cmd-="), ZoomIn),132
shortcut!(General, GlobalOverTextFields, "Zoom out", "ctrl--", Some("cmd--"), ZoomOut),146
shortcut!(General, GlobalOverTextFields, "Zoom out", "ctrl--", Some("cmd--"), ZoomOut),133
shortcut!(General, GlobalOverTextFields, "Reset zoom level", "ctrl-0", Some("cmd-0"), ZoomReset),147
shortcut!(General, GlobalOverTextFields, "Reset zoom level", "ctrl-0", Some("cmd-0"), ZoomReset),148
shortcut!(General, Global, "Set presence status to Available", "alt-shift-q", None, SetPresenceAvailable),149
shortcut!(General, Global, "Set presence status to Busy", "alt-shift-y", None, SetPresenceBusy),150
shortcut!(General, Global, "Set presence status to Do Not Disturb", "alt-shift-u", None, SetPresenceDoNotDisturb),151
shortcut!(General, Global, "Set presence status to Be Right Back", "alt-shift-k", None, SetPresenceBeRightBack),152
shortcut!(General, Global, "Set presence status to Away", "alt-shift-w", None, SetPresenceAway),134
shortcut!(Navigation, GlobalOverTextFields, "Open Activity", "ctrl-1", Some("cmd-1"), OpenActivity),153
shortcut!(Navigation, GlobalOverTextFields, "Open Activity", "ctrl-1", Some("cmd-1"), OpenActivity),135
shortcut!(Navigation, GlobalOverTextFields, "Show Chats", "ctrl-2", Some("cmd-2"), OpenChatsTab),154
shortcut!(Navigation, GlobalOverTextFields, "Show Chats", "ctrl-2", Some("cmd-2"), OpenChatsTab),136
shortcut!(Navigation, GlobalOverTextFields, "Show Channels", "ctrl-3", Some("cmd-3"), OpenChannelsTab),155
shortcut!(Navigation, GlobalOverTextFields, "Show Channels", "ctrl-3", Some("cmd-3"), OpenChannelsTab),@@ -139,6 +158,10 @@ pub const SHORTCUTS: &[Shortcut] = &[139
shortcut!(Navigation, GlobalOverTextFields, "Open Agents", "ctrl-6", Some("cmd-6"), OpenAgents),158
shortcut!(Navigation, GlobalOverTextFields, "Open Agents", "ctrl-6", Some("cmd-6"), OpenAgents),140
shortcut!(Navigation, GlobalOverTextFields, "Previous chat or channel", "alt-up", None, PreviousConversation),159
shortcut!(Navigation, GlobalOverTextFields, "Previous chat or channel", "alt-up", None, PreviousConversation),141
shortcut!(Navigation, GlobalOverTextFields, "Next chat or channel", "alt-down", None, NextConversation),160
shortcut!(Navigation, GlobalOverTextFields, "Next chat or channel", "alt-down", None, NextConversation),161
shortcut!(Navigation, GlobalOverTextFields, "Go to previous unread conversation", "ctrl-alt-up", None, PreviousUnreadConversation),162
shortcut!(Navigation, GlobalOverTextFields, "Go to next unread conversation", "ctrl-alt-down", None, NextUnreadConversation),163
shortcut!(Navigation, GlobalOverTextFields, "Go to a specific chat or channel", "ctrl-g", Some("cmd-g"), OpenSwitcher),164
shortcut!(Navigation, Global, "Go to compose box", "ctrl-r", Some("cmd-r"), GoToComposeBox),142
shortcut!(Navigation, GlobalOverTextFields, "Open filter", "ctrl-shift-f", Some("cmd-shift-f"), OpenChatFilter),165
shortcut!(Navigation, GlobalOverTextFields, "Open filter", "ctrl-shift-f", Some("cmd-shift-f"), OpenChatFilter),143
shortcut!(Navigation, OutsideTextFields, "Filter chat list by unread chats only", "ctrl-alt-u", None, FilterUnreadChats),166
shortcut!(Navigation, OutsideTextFields, "Filter chat list by unread chats only", "ctrl-alt-u", None, FilterUnreadChats),144
shortcut!(Navigation, OutsideTextFields, "Filter chat list by chats only", "ctrl-alt-c", None, FilterNonMeetingChats),167
shortcut!(Navigation, OutsideTextFields, "Filter chat list by chats only", "ctrl-alt-c", None, FilterNonMeetingChats),@@ -147,11 +170,14 @@ pub const SHORTCUTS: &[Shortcut] = &[147
shortcut!(Navigation, OutsideTextFields, "Remove all filters in the chat list", "ctrl-alt-z", None, ClearChatFilters),170
shortcut!(Navigation, OutsideTextFields, "Remove all filters in the chat list", "ctrl-alt-z", None, ClearChatFilters),148
shortcut!(Composer, GlobalOverTextFields, "Find in chat", "ctrl-f", Some("cmd-f"), FindInChat),171
shortcut!(Composer, GlobalOverTextFields, "Find in chat", "ctrl-f", Some("cmd-f"), FindInChat),149
shortcut!(Composer, Global, "Reply to the message under the pointer", "alt-r", None, ReplyToHovered),172
shortcut!(Composer, Global, "Reply to the message under the pointer", "alt-r", None, ReplyToHovered),173
shortcut!(Composer, Global, "Reply to the last message", "alt-shift-r", None, ReplyToLastMessage),174
shortcut!(Composer, Composer, "Edit last message", "ctrl-up", Some("cmd-up"), EditLastMessage),150
shortcut!(Composer, Global, "Jump to last read or newest message", "ctrl-j", Some("cmd-j"), JumpToLastReadOrNewest),175
shortcut!(Composer, Global, "Jump to last read or newest message", "ctrl-j", Some("cmd-j"), JumpToLastReadOrNewest),151
shortcut!(Composer, Composer, "Bold", "ctrl-b", Some("cmd-b"), ToggleBold),176
shortcut!(Composer, Composer, "Bold", "ctrl-b", Some("cmd-b"), ToggleBold),152
shortcut!(Composer, Composer, "Italic", "ctrl-i", Some("cmd-i"), ToggleItalic),177
shortcut!(Composer, Composer, "Italic", "ctrl-i", Some("cmd-i"), ToggleItalic),153
shortcut!(Composer, Composer, "Underline", "ctrl-u", Some("cmd-u"), ToggleUnderline),178
shortcut!(Composer, Composer, "Underline", "ctrl-u", Some("cmd-u"), ToggleUnderline),154
shortcut!(Composer, Composer, "Format", "ctrl-shift-x", Some("cmd-shift-x"), ToggleFormatBar),179
shortcut!(Composer, Composer, "Expand compose box", "ctrl-shift-x", Some("cmd-shift-x"), ToggleFormatBar),180
shortcut!(Composer, Composer, "Send (expanded compose box)", "ctrl-enter", Some("cmd-enter"), Enter { secondary: true, shift: false }),155
shortcut!(Composer, Composer, "Strikethrough", "ctrl-alt-x", None, ToggleStrike),181
shortcut!(Composer, Composer, "Strikethrough", "ctrl-alt-x", None, ToggleStrike),156
shortcut!(Composer, Composer, "Superscript", "ctrl-shift-=", None, ToggleSuperscript),182
shortcut!(Composer, Composer, "Superscript", "ctrl-shift-=", None, ToggleSuperscript),157
shortcut!(Composer, Composer, "Subscript", "ctrl-=", None, ToggleSubscript),183
shortcut!(Composer, Composer, "Subscript", "ctrl-=", None, ToggleSubscript),@@ -167,14 +193,17 @@ pub const SHORTCUTS: &[Shortcut] = &[167
shortcut!(Composer, Composer, "Heading 2", "ctrl-alt-2", None, SetHeading2),193
shortcut!(Composer, Composer, "Heading 2", "ctrl-alt-2", None, SetHeading2),168
shortcut!(Composer, Composer, "Heading 3", "ctrl-alt-3", None, SetHeading3),194
shortcut!(Composer, Composer, "Heading 3", "ctrl-alt-3", None, SetHeading3),169
shortcut!(Composer, Composer, "Paragraph", "ctrl-alt-p", None, SetParagraph),195
shortcut!(Composer, Composer, "Paragraph", "ctrl-alt-p", None, SetParagraph),170
shortcut!(Calls, GlobalOverTextFields, "Accept incoming call", "ctrl-shift-a", Some("cmd-shift-a"), AcceptCall),196
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),197
shortcut!(Calls, GlobalOverTextFields, "Accept audio call", "ctrl-shift-s", Some("cmd-shift-s"), AcceptAudioCall),198
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),199
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),200
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),201
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),202
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),203
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),204
shortcut!(Calls, GlobalOverTextFields, "Raise or lower hand", "ctrl-shift-k", Some("cmd-shift-k"), ToggleCallHand),205
shortcut!(Calls, GlobalOverTextFields, "Toggle background blur", "ctrl-shift-p", Some("cmd-shift-p"), ToggleBackgroundBlur),206
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),207
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),208
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),209
shortcut!(Calls, GlobalOverTextFields, "Start a video call in this chat", "alt-shift-v", None, StartVideoCall),@@ -379,6 +408,43 @@ mod tests {379
}408
}380
}409
}381
410
411
#[gpui_kit::test]412
fn teams_message_presence_and_call_keys_resolve(cx: &mut TestAppContext) {413
registered(cx);414
let action_of = |label: &str| {415
action_name(416
SHORTCUTS417
.iter()418
.find(|shortcut| shortcut.label == label)419
.unwrap(),420
)421
};422
let typing = ["AppShell", "Composer", "Input"];423
for (keys, label) in [424
("ctrl-r", "Go to compose box"),425
("alt-shift-r", "Reply to the last message"),426
("ctrl-up", "Edit last message"),427
("ctrl-alt-up", "Go to previous unread conversation"),428
("ctrl-alt-down", "Go to next unread conversation"),429
("ctrl-g", "Go to a specific chat or channel"),430
("alt-shift-q", "Set presence status to Available"),431
("alt-shift-y", "Set presence status to Busy"),432
("alt-shift-u", "Set presence status to Do Not Disturb"),433
("alt-shift-k", "Set presence status to Be Right Back"),434
("alt-shift-w", "Set presence status to Away"),435
("ctrl-shift-a", "Accept video call"),436
("ctrl-shift-s", "Accept audio call"),437
("ctrl-shift-p", "Toggle background blur"),438
("alt-shift-c", "Toggle live captions"),439
] {440
assert_eq!(441
bound_action(cx, keys, &typing),442
Some(action_of(label)),443
"{keys}"444
);445
}446
}447
382
#[test]448
#[test]383
fn every_group_lists_shortcuts_and_keys_read_like_teams() {449
fn every_group_lists_shortcuts_and_keys_read_like_teams() {384
for group in Group::ALL {450
for group in Group::ALL {@@ -444,7 +510,8 @@ mod tests {444
)510
)445
};511
};446
for (keys, label) in [512
for (keys, label) in [447
("ctrl-shift-x", "Format"),513
("ctrl-shift-x", "Expand compose box"),514
("ctrl-enter", "Send (expanded compose box)"),448
("ctrl-alt-x", "Strikethrough"),515
("ctrl-alt-x", "Strikethrough"),449
("ctrl-alt-=", "Insert column or row"),516
("ctrl-alt-=", "Insert column or row"),450
("ctrl-alt-+", "Insert column or row"),517
("ctrl-alt-+", "Insert column or row"),