Skip to content

Commit

Permalink
Add css to change tab width
Browse files Browse the repository at this point in the history
  • Loading branch information
nicosomb committed Jul 15, 2024
1 parent bc98362 commit 02655b8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
3 changes: 3 additions & 0 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export default class ShrinkPinnedTabs extends Plugin {

onunload() {
console.log('Unloading Shrink pinned tabs plugin');
this.updateStyle()
}

async loadSettings() {
Expand All @@ -48,13 +49,15 @@ export default class ShrinkPinnedTabs extends Plugin {

// update the styles (at the start, or as the result of a settings change)
updateStyle = () => {
console.log('Update style');
const tabs = document.querySelectorAll('.workspace-tab-header:has(.mod-pinned)');
if (tabs != null) {
for (var i = 0; i < tabs.length; i++) {
const title = (tabs[i].querySelectorAll('.workspace-tab-header-inner-title'));
if (title != null) {
title[0].toggleClass('mod-pinned-hide', this.settings.hideTitle);
}
tabs[i].style.width = this.settings.tabWidth + 'px';
}
}
}
Expand Down
5 changes: 0 additions & 5 deletions styles.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
.workspace-tab-header:has(.mod-pinned) {
/* shrink if pinned */
max-width: 80px !important;
}

/* class to hide tab title */
.mod-pinned-hide {
display: none;
Expand Down

0 comments on commit 02655b8

Please sign in to comment.