From 057e3cc93e22fdadc49edba118940493df5a4a72 Mon Sep 17 00:00:00 2001 From: Alex Kontos Date: Thu, 28 Mar 2024 15:57:56 +0000 Subject: [PATCH] Add option to disable close button on tabs. --- waterfox/browser/app/profile/00-waterfox.js | 1 + waterfox/browser/components/WaterfoxGlue.sys.mjs | 9 +++++++++ waterfox/browser/themes/waterfox/general.css | 6 ++++++ 3 files changed, 16 insertions(+) diff --git a/waterfox/browser/app/profile/00-waterfox.js b/waterfox/browser/app/profile/00-waterfox.js index 1632778a5f62a..e893755de77ef 100644 --- a/waterfox/browser/app/profile/00-waterfox.js +++ b/waterfox/browser/app/profile/00-waterfox.js @@ -94,6 +94,7 @@ pref("browser.closeShortcut.disabled", false); // Extensibles prefs pref("browser.tabs.duplicateTab", true); +pref("browser.tabs.closeButtons", false); pref("browser.tabs.copyurl", true); pref("browser.tabs.copyallurls", false); pref("browser.tabs.copyurl.activetab", false); diff --git a/waterfox/browser/components/WaterfoxGlue.sys.mjs b/waterfox/browser/components/WaterfoxGlue.sys.mjs index 0faffcce0b356..e5b151468f9ca 100644 --- a/waterfox/browser/components/WaterfoxGlue.sys.mjs +++ b/waterfox/browser/components/WaterfoxGlue.sys.mjs @@ -177,6 +177,15 @@ export const WaterfoxGlue = { lazy.BrowserUtils.registerOrUnregisterSheet(uri, !isEnabled); } ); + this.styleSheetChanges = lazy.PrefUtils.addObserver( + "browser.tabs.closeButtons", + () => { + // Pref being true actually means we need to unload the sheet, so invert. + const uri = "chrome://browser/skin/waterfox/general.css"; + lazy.BrowserUtils.unregisterStylesheet(uri); + lazy.BrowserUtils.registerStylesheet(uri); + } + ) }, async getChromeManifest(manifest) { diff --git a/waterfox/browser/themes/waterfox/general.css b/waterfox/browser/themes/waterfox/general.css index 4ae6659711d85..2e4d19328db54 100644 --- a/waterfox/browser/themes/waterfox/general.css +++ b/waterfox/browser/themes/waterfox/general.css @@ -186,4 +186,10 @@ #main-window[inFullscreen] #tabs-sidebar-splitter { display: none !important; width: 0px !important; +} + +@supports -moz-bool-pref("browser.tabs.closeButtons") { + .tab-close-button { + display: none !important + } } \ No newline at end of file