Add tab group close command

This commit is contained in:
2026-05-08 10:49:45 -04:00
parent a05b662fd6
commit 475be06edc
4 changed files with 88 additions and 1 deletions
@@ -216,6 +216,9 @@ impl BrowserCore {
"sleep-tab-group" | "sleep tab group" | "discard-tab-group" | "discard tab group" => {
Ok(self.discard_active_tab_group()?.is_some())
}
"close-tab-group" | "close tab group" | "archive-tab-group" | "archive tab group" => {
Ok(self.close_active_tab_group()?.is_some())
}
"downloads" | "open-downloads" | "open downloads" => {
self.open_tab(downloads_url()?);
Ok(true)
@@ -93,6 +93,25 @@ impl BrowserCore {
Ok(Some(tab_ids.len()))
}
pub fn close_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.clear_tab_group(tab_id)?;
}
self.tab_groups.retain(|group| group.id() != &group_id);
for tab_id in &tab_ids {
self.close_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);