Skip to content

Commit

Permalink
Setting to collapse tab groups by default [closes #163, closes #372]
Browse files Browse the repository at this point in the history
If a group hasn't been explicitly expanded or collapsed, the default can
now be changed so that such groups are always shown collapsed (until
explicitly expanded).

Thanks to @samca2 for the contribution!
  • Loading branch information
josh-berry committed Jul 8, 2023
2 parents fb64e84 + f08f4f5 commit 752fca8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/model/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ export const SYNC_DEF = {
is: anEnum("unstashed", "all"),
},

// How are new folders of tabs shown, expanded or collapsed?
show_new_folders: {
default: "expanded",
is: anEnum("expanded", "collapsed"),
},

// How big should the spacing/fonts be?
ui_metrics: {
default: "normal",
Expand Down
6 changes: 6 additions & 0 deletions src/options/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,12 @@
<option value="unstashed">Unstashed tabs only</option>
<option value="all">Stashed and unstashed tabs</option>
</select>
<label for="show_new_folders">Show new tab groups:</label>
<select id="show_new_folders" v-model="sync.show_new_folders">
<option value="expanded">Expanded</option>
<option value="collapsed">Collapsed</option>
</select>
</section>
<hr />
Expand Down
6 changes: 5 additions & 1 deletion src/stash-list/folder.vue
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,11 @@ export default defineComponent({
collapsed: {
get(): boolean {
return !!this.metadata.value?.collapsed;
if (this.metadata.value === undefined) {
return the.model.options.sync.state.show_new_folders === "collapsed";
}
return !!this.metadata.value.collapsed;
},
set(collapsed: boolean) {
the.model.bookmark_metadata.setCollapsed(this.metadata.key, collapsed);
Expand Down

1 comment on commit 752fca8

@AdrianSkar
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!! Thank you

Please sign in to comment.