Skip to content

Commit

Permalink
Exclude pinned/hidden tabs when closing unstashed tabs
Browse files Browse the repository at this point in the history
Closes #445.
  • Loading branch information
josh-berry committed Feb 4, 2024
1 parent 920498c commit c27e03d
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/stash-list/window.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<a
class="action remove"
:title="`Close all unstashed tabs`"
@click.prevent.stop="remove"
@click.prevent.stop="removeUnstashed"
/>
<a
class="action remove stashed"
Expand Down Expand Up @@ -323,13 +323,16 @@ export default defineComponent({
});
},
async remove() {
async removeUnstashed() {
this.attempt(async () => {
// This filter keeps the active tab if it's the Tab Stash tab, or a
// new tab (so we can avoid creating new tabs unnecessarily).
const to_remove = this.tabs
.filter(t => !t.active || the.model.isURLStashable(t.url))
.filter(t => !the.model.bookmarks.isURLStashed(t.url));
const to_remove = this.tabs.filter(
t =>
!t.hidden &&
!t.pinned &&
// Keep the active tab if it's the Tab Stash tab
(!t.active || the.model.isURLStashable(t.url)) &&
!the.model.bookmarks.isURLStashed(t.url),
);
if (!(await this.confirmRemove(to_remove.length))) return;
await the.model.tabs.remove(to_remove.map(t => t.id));
});
Expand Down

0 comments on commit c27e03d

Please sign in to comment.