Allow hiding the new & close tab buttons

Closes #137
This commit is contained in:
TrickyPR 2023-07-13 21:03:30 +10:00
parent d6aef43320
commit ba90c3bf73
10 changed files with 79 additions and 20 deletions

View File

@ -7,15 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## 1.0.0-a.77
### Added
- Vertical tabs: Open new tab w/ clipboard contents on space middle click
- The new tab & close tab buttons can now be hidden
### Changed
- Vertical tabs: New tab button no longer has text
- Partial `:has` support is enabled (this is intended for userchrome use only)
### Feature
- Vertical tabs: Open new tab w/ clipboard contents on space middle click
### Fixed
- Pinned vertical tabs are no longer positioned. Sorta defeats their purpose, but it stops a semi-major bug

View File

@ -103,3 +103,8 @@ pref('accessibility.force_disabled', 0);
// This feature isn't stable / performant, but I am going to enable it anyway
// specifically to get vertical tab styling to work with minimal jank
pref('layout.css.has-selector.enabled', true);
// Allow for showing and hiding of assorted tab buttons at the users
// digression
pref('pulse.tabs.show.close', true);
pref('pulse.tabs.show.new', true);

View File

@ -8,6 +8,9 @@ const VERTICAL_TABS_POSITION = 'pulse.tabs.vertical'
const VERTICAL_TABS_COLLAPSE = 'pulse.tabs.vertical.collapse'
const VERTICAL_TABS_WIDTH = 'pulse.tabs.vertical.width'
const SHOW_CLOSE_BUTTON = 'pulse.tabs.show.close'
const SHOW_NEW_TAB = 'pulse.tabs.show.new'
/**
* @param {HTMLElement} toInsertAfter This is the element that I want to insert content after
* @param {HTMLElement} toInsert The element to insert
@ -56,6 +59,14 @@ var VerticalTabs = {
return Services.prefs.getBoolPref(VERTICAL_TABS_POSITION, false)
},
get showCloseButton() {
return Services.prefs.getBoolPref(SHOW_CLOSE_BUTTON, true)
},
get showNewTab() {
return Services.prefs.getBoolPref(SHOW_NEW_TAB, true)
},
/**
* @return {HTMLElement?}
*/
@ -109,6 +120,17 @@ var VerticalTabs = {
this.tabBrowserTabs = document.getElementById('tabbrowser-tabs')
Services.prefs.addObserver(VERTICAL_TABS_POSITION, this)
Services.prefs.addObserver(SHOW_CLOSE_BUTTON, this)
Services.prefs.addObserver(SHOW_NEW_TAB, this)
document.documentElement.setAttribute(
'show-tab-close',
this.showCloseButton ? 'true' : 'false'
)
document.documentElement.setAttribute(
'show-tab-new',
this.showNewTab ? 'true' : 'false'
)
if (this.verticalTabsEnabled) {
this.enableVerticalTabs()
@ -241,6 +263,17 @@ var VerticalTabs = {
)
}
if (data === SHOW_CLOSE_BUTTON || data === SHOW_NEW_TAB) {
document.documentElement.setAttribute(
'show-tab-close',
this.showCloseButton ? 'true' : 'false'
)
document.documentElement.setAttribute(
'show-tab-new',
this.showNewTab ? 'true' : 'false'
)
}
break
}
},

View File

@ -1,8 +1,8 @@
diff --git a/browser/components/preferences/main.inc.xhtml b/browser/components/preferences/main.inc.xhtml
index a9a1511a8da36140be93264effe683e5d5007f11..839ba020d4b2b4e5672f357377840bb2dd9362e9 100644
index 8f87b2f5d9b22d2607534d608749c3924199d3d0..2fb92229fafb937dec2dcdad1606b17390834ed7 100644
--- a/browser/components/preferences/main.inc.xhtml
+++ b/browser/components/preferences/main.inc.xhtml
@@ -61,6 +61,14 @@
@@ -72,6 +72,19 @@
hidden="true">
<label><html:h2 data-l10n-id="tabs-group-header"/></label>
@ -13,11 +13,16 @@ index a9a1511a8da36140be93264effe683e5d5007f11..839ba020d4b2b4e5672f357377840bb2
+ <checkbox id="verticalTabsCollapse" preference="pulse.tabs.vertical.collapse"
+ data-l10n-id="preferences-vertical-tabs-collapse" />
+ </vbox>
+
+ <checkbox id="showNewTab" preference="pulse.tabs.show.new"
+ data-l10n-id="preferences-show-new-tab" />
+ <checkbox id="showCloseTab" preference="pulse.tabs.show.close"
+ data-l10n-id="preferences-show-close-tab" />
+
<checkbox id="ctrlTabRecentlyUsedOrder" data-l10n-id="ctrl-tab-recently-used-order"
preference="browser.ctrlTab.sortByRecentlyUsed"/>
@@ -122,6 +130,22 @@
@@ -137,6 +150,22 @@
<html:h1 data-l10n-id="language-and-appearance-header"/>
</hbox>

View File

@ -1,8 +1,8 @@
diff --git a/browser/components/preferences/main.js b/browser/components/preferences/main.js
index 1ce4ba85a0df22b4176443c9003669577b6a230c..7447e19c3ddf2d40fe87ffcd945fdb5c00bd3e97 100644
index 3f5db88709610537280ab4fae1d64364adf4d8bc..43cbc29e5b0d831a9a35a81ee5748098819fe97e 100644
--- a/browser/components/preferences/main.js
+++ b/browser/components/preferences/main.js
@@ -161,6 +161,13 @@ Preferences.addAll([
@@ -162,6 +162,15 @@ Preferences.addAll([
// Media
{ id: "media.hardwaremediakeys.enabled", type: "bool" },
@ -13,6 +13,8 @@ index 1ce4ba85a0df22b4176443c9003669577b6a230c..7447e19c3ddf2d40fe87ffcd945fdb5c
+
+ { id: "pulse.tabs.vertical", type: "bool" },
+ { id: "pulse.tabs.vertical.collapse", type: "bool" },
+ { id: "pulse.tabs.show.new", type: "bool" },
+ { id: "pulse.tabs.show.close", type: "bool" },
]);
if (AppConstants.HAVE_SHELL_SERVICE) {

View File

@ -1,8 +1,8 @@
diff --git a/browser/locales/en-US/browser/preferences/preferences.ftl b/browser/locales/en-US/browser/preferences/preferences.ftl
index f24485700321defc69cd57099ede164701b9b3ec..8061f090bf6d2fb29c4824d5d1a812688abfafb4 100644
index 829c18c5e16379fede509970fe056a52a16acf56..62c1716ff105c78ee1ec78dba3f7f2e8d4ae95f4 100644
--- a/browser/locales/en-US/browser/preferences/preferences.ftl
+++ b/browser/locales/en-US/browser/preferences/preferences.ftl
@@ -1432,3 +1432,18 @@ httpsonly-radio-disabled =
@@ -1551,3 +1551,21 @@ preferences-doh-manage-exceptions =
desktop-folder-name = Desktop
downloads-folder-name = Downloads
choose-download-folder-title = Choose Download Folder:
@ -20,4 +20,7 @@ index f24485700321defc69cd57099ede164701b9b3ec..8061f090bf6d2fb29c4824d5d1a81268
+preferences-vertical-tabs-collapse =
+ .label = Collapse tabs
+
+
+preferences-show-new-tab =
+ .label = Show the new tab button
+preferences-show-close-tab =
+ .label = Show the close tab button

View File

@ -7,7 +7,8 @@
# be specified once. As a result, the source file paths are relative
# to the location of the actual manifest.
skin/classic/browser/pulse/sidebar_tabs.css (../pulse/sidebar_tabs.css)
skin/classic/browser/pulse/vertical_tabs.css (../pulse/vertical_tabs.css)
skin/classic/browser/pulse/downloads.css (../pulse/content/downloads.css)
skin/classic/browser/addons/shared.css (../pulse/addons/shared.css)
skin/classic/browser/pulse/sidebar_tabs.css (../pulse/sidebar_tabs.css)
skin/classic/browser/pulse/tab_tweaks.css (../pulse/tab_tweaks.css)
skin/classic/browser/pulse/vertical_tabs.css (../pulse/vertical_tabs.css)
skin/classic/browser/pulse/downloads.css (../pulse/content/downloads.css)
skin/classic/browser/addons/shared.css (../pulse/addons/shared.css)

View File

@ -0,0 +1,8 @@
html[show-tab-close='false'] .tab-close-button {
display: none !important;
}
html[show-tab-new='false'] #new-tab-button,
html[show-tab-new='false'] #browser #new-tab-button {
display: none !important;
}

View File

@ -56,8 +56,8 @@
}
/** On collapse hover of tabs or splitter, the max width should increase again */
#browser #TabsToolbar[collapse='true']:hover,
#TabsToolbar[collapse='true']:has(+ #verticaltabs-splitter:hover) {
#browser #TabsToolbar[collapse='true']:hover
/* #TabsToolbar[collapse='true']:has(+ #verticaltabs-splitter:hover) */ {
max-width: var(--vertical-tabs-max-width);
}

View File

@ -1,12 +1,13 @@
diff --git a/browser/themes/shared/browser-shared.css b/browser/themes/shared/browser-shared.css
index b3f83092c310fe2378f79d5a07726ad8c215e2a3..d54dba549d4d3808671e03cc7747248186b1abdf 100644
index 983aae77e5f4da3bbb37625ab597ad536d609ec0..9adbff1d6968012357a49b7edae69daf5738f3e4 100644
--- a/browser/themes/shared/browser-shared.css
+++ b/browser/themes/shared/browser-shared.css
@@ -23,6 +23,9 @@
@@ -23,6 +23,10 @@
@import url("chrome://browser/skin/customizableui/customizeMode.css");
@import url("chrome://browser/skin/UITour.css");
+@import url("chrome://browser/skin/pulse/sidebar_tabs.css");
+@import url("chrome://browser/skin/pulse/tab_tweaks.css");
+@import url("chrome://browser/skin/pulse/vertical_tabs.css");
+
@namespace html url("http://www.w3.org/1999/xhtml");