Add tab group sleep command

This commit is contained in:
2026-05-08 10:40:24 -04:00
parent f167b7999b
commit a05b662fd6
4 changed files with 81 additions and 1 deletions
@@ -213,6 +213,9 @@ impl BrowserCore {
Ok(self.set_active_tab_group_collapsed(false)?.is_some())
}
"ungroup-tab" | "ungroup tab" => self.ungroup_active_tab(),
"sleep-tab-group" | "sleep tab group" | "discard-tab-group" | "discard tab group" => {
Ok(self.discard_active_tab_group()?.is_some())
}
"downloads" | "open-downloads" | "open downloads" => {
self.open_tab(downloads_url()?);
Ok(true)
@@ -80,6 +80,19 @@ impl BrowserCore {
Ok(true)
}
pub fn discard_active_tab_group(&mut self) -> Result<Option<usize>, CoreError> {
let Some(group_id) = self.active_tab_group_id()? else {
return Ok(None);
};
let tab_ids = self.active_space_group_tab_ids(&group_id);
for tab_id in &tab_ids {
self.discard_tab(tab_id)?;
}
Ok(Some(tab_ids.len()))
}
pub fn split_active_tab_group(&mut self) -> Result<Option<SplitId>, CoreError> {
let Some(group_id) = self.active_tab_group_id()? else {
return Ok(None);
@@ -269,6 +282,10 @@ impl BrowserCore {
)
}
fn active_space_group_tab_ids(&self, group_id: &TabGroupId) -> Vec<TabId> {
self.active_space_group_tabs(group_id).iter().map(|tab| tab.id().clone()).collect()
}
fn split_pane_space_id(
&self,
split_id: &SplitId,