mirror of
https://github.com/zen-browser/desktop.git
synced 2026-08-29 01:41:33 +00:00
feat: close all unpinned tabs in active workspace, p=#10739
* feat: close all unpinned tabs using keyboard shortcut * feat: use toast instead of prompt * feat: add toolbarbutton to close all unpinned tabs in a workspace * feat: Fix bootstraping and other small nitpicks, b=no-bug, c=common, tabs, workspaces * feat: improve the site popup ui, p=#10765 * style: improve site popup top buttons * feat: add filled icons for permissions * style: align and resize items in the site popup * feat: site popup ui improvements and more permission icons * chore: Better organize preferences files, b=no-bug, c=compact-mode, folders, glance, kbs, media, mods, split-view, welcome, workspaces * feat: improve the site popup ui (part 2), p=#10768 * feat: Add a bounce to the glance element float and format, b=no-bug, c=common, glance * chore: Update workflows to use macos 26 SDK, b=no-bug, c=workflows * New Crowdin updates, p=#10769 * New translations zen-preferences.ftl (French) * New translations zen-preferences.ftl (Lithuanian) * New translations zen-workspaces.ftl (Lithuanian) * New translations zen-general.ftl (Lithuanian) * list shortcut in settings page, refactor code based on PR review * feat: show restore tabs shortcut in toast message * feat: Add toggle compact mode to the default placements, b=no-bug, c=common, glance * chore: Only run autopep8 if python files changed, b=no-bug, c=workflows * chore: Revert to the new folder animation, p=#10783, c=folders * feat: Use close icon for pinned reset if the preference says so, p=#10786, c=no-component * feat: Improve glance animation, p=#10790, c=glance * update l10n string * feat: Finished UI, b=no-bug, c=workspaces, common, tabs * chore: Fix lint, b=no-bug, c=workspaces --------- Co-authored-by: mr. m <mr.m@tuta.com> Co-authored-by: reizumi <reizumichan@protonmail.com> Co-authored-by: mr. m <91018726+mr-cheffy@users.noreply.github.com>
This commit is contained in:
@@ -1483,6 +1483,19 @@ var gZenWorkspaces = new (class extends nsZenMultiWindowFeature {
|
||||
});
|
||||
}
|
||||
|
||||
unpinnedTabsInWorkspace(workspaceID) {
|
||||
return Array.from(this.allStoredTabs).filter(
|
||||
(tab) => tab.getAttribute('zen-workspace-id') === workspaceID && tab.visible && !tab.pinned
|
||||
);
|
||||
}
|
||||
|
||||
#deleteAllUnpinnedTabsInWorkspace(tabs) {
|
||||
gBrowser.removeTabs(tabs, {
|
||||
animate: false,
|
||||
closeWindowWithLastTab: false,
|
||||
});
|
||||
}
|
||||
|
||||
async unloadWorkspace() {
|
||||
const workspaceId = this.#contextMenuData?.workspaceId || this.activeWorkspace;
|
||||
|
||||
@@ -2654,6 +2667,25 @@ var gZenWorkspaces = new (class extends nsZenMultiWindowFeature {
|
||||
this.tabContainer._invalidateCachedTabs();
|
||||
}
|
||||
|
||||
async closeAllUnpinnedTabs() {
|
||||
const workspaceId = this.#contextMenuData?.workspaceId || this.activeWorkspace;
|
||||
const unpinnedTabs = await this.unpinnedTabsInWorkspace(workspaceId);
|
||||
|
||||
if (!unpinnedTabs.length) return;
|
||||
|
||||
this.#deleteAllUnpinnedTabsInWorkspace(unpinnedTabs);
|
||||
|
||||
const restoreClosedTabsShortcut = gZenKeyboardShortcutsManager.getShortcutDisplayFromCommand(
|
||||
'History:RestoreLastClosedTabOrWindowOrSession'
|
||||
);
|
||||
|
||||
gZenUIManager.showToast('zen-workspaces-close-all-unpinned-tabs-toast', {
|
||||
l10nArgs: {
|
||||
shortcut: restoreClosedTabsShortcut,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
async contextDeleteWorkspace() {
|
||||
const workspaceId = this.#contextMenuData?.workspaceId || this.activeWorkspace;
|
||||
const [title, body] = await document.l10n.formatValues([
|
||||
|
||||
Reference in New Issue
Block a user