From 02655b819d2db215e371b46507eacade2c8100ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Mon, 15 Jul 2024 14:27:58 +0200 Subject: [PATCH] Add css to change tab width --- main.ts | 3 +++ styles.css | 5 ----- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/main.ts b/main.ts index 2770461..4234fd0 100644 --- a/main.ts +++ b/main.ts @@ -34,6 +34,7 @@ export default class ShrinkPinnedTabs extends Plugin { onunload() { console.log('Unloading Shrink pinned tabs plugin'); + this.updateStyle() } async loadSettings() { @@ -48,6 +49,7 @@ 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++) { @@ -55,6 +57,7 @@ export default class ShrinkPinnedTabs extends Plugin { if (title != null) { title[0].toggleClass('mod-pinned-hide', this.settings.hideTitle); } + tabs[i].style.width = this.settings.tabWidth + 'px'; } } } diff --git a/styles.css b/styles.css index da8e653..e29f34b 100644 --- a/styles.css +++ b/styles.css @@ -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;