Refactor tab management and styles for improved functionality and user experience

This commit is contained in:
mr. M
2025-02-23 21:53:07 +01:00
parent c4480f208f
commit 12891ab238
6 changed files with 33 additions and 20 deletions

View File

@@ -547,10 +547,10 @@ jobs:
GITHUB_REPOSITORY: ${{ github.repository }} GITHUB_REPOSITORY: ${{ github.repository }}
- name: Release - name: Release
uses: marvinpinto/action-automatic-releases@master uses: softprops/action-gh-release@v2
if: ${{ inputs.update_branch == 'release' }} if: ${{ inputs.update_branch == 'release' }}
with: with:
token: '${{ secrets.DEPLOY_KEY }}' token: ${{ secrets.DEPLOY_KEY }}
tag_name: ${{ needs.build-data.outputs.version }} tag_name: ${{ needs.build-data.outputs.version }}
prerelease: false prerelease: false
fail_on_unmatched_files: false fail_on_unmatched_files: false

View File

@@ -173,7 +173,7 @@ pref('zen.tab-unloader.excluded-urls', "example.com,example.org");
pref('zen.pinned-tab-manager.debug', false); pref('zen.pinned-tab-manager.debug', false);
pref('zen.pinned-tab-manager.restore-pinned-tabs-to-pinned-url', false); pref('zen.pinned-tab-manager.restore-pinned-tabs-to-pinned-url', false);
pref('zen.pinned-tab-manager.close-shortcut-behavior', 'unload-switch'); pref('zen.pinned-tab-manager.close-shortcut-behavior', 'reset-unload-switch');
// TODO: Check this out! // TODO: Check this out!
pref("browser.profiles.enabled", false); pref("browser.profiles.enabled", false);

View File

@@ -558,7 +558,7 @@
width: -moz-available; width: -moz-available;
} }
&[zen-pinned-changed='true'] > .tab-stack > .tab-content > .tab-icon-stack { &[zen-pinned-changed='true']:not([zen-essential]) > .tab-stack > .tab-content > .tab-icon-stack {
position: absolute; position: absolute;
top: 50%; top: 50%;
transform: translateY(-50%); transform: translateY(-50%);
@@ -572,11 +572,11 @@
} }
} }
&[zen-pinned-changed='true'] .tab-reset-pin-button image { &[zen-pinned-changed='true']:not([zen-essential]) .tab-reset-pin-button image {
opacity: 0; opacity: 0;
} }
&[zen-pinned-changed='true'] .tab-reset-pin-button:hover { &[zen-pinned-changed='true']:not([zen-essential]) .tab-reset-pin-button:hover {
& ~ .tab-label-container .tab-reset-pin-label { & ~ .tab-label-container .tab-reset-pin-label {
max-height: 10px; max-height: 10px;
opacity: 0.6; opacity: 0.6;

View File

@@ -412,7 +412,7 @@ button.popup-notification-dropmarker {
:root[zen-single-toolbar='true'] { :root[zen-single-toolbar='true'] {
#urlbar[open] { #urlbar[open] {
min-width: 35vw; min-width: min(90%, 40rem);
} }
&[zen-right-side='true'] #urlbar[open]:not([zen-floating-urlbar='true']) { &[zen-right-side='true'] #urlbar[open]:not([zen-floating-urlbar='true']) {

View File

@@ -437,7 +437,6 @@
async _removePinnedAttributes(tab, isClosing = false) { async _removePinnedAttributes(tab, isClosing = false) {
tab.removeAttribute('zen-has-static-label'); tab.removeAttribute('zen-has-static-label');
if (!tab.getAttribute('zen-pin-id') || this._temporarilyUnpiningEssential) { if (!tab.getAttribute('zen-pin-id') || this._temporarilyUnpiningEssential) {
this._temporarilyUnpiningEssential = false;
return; return;
} }
@@ -587,23 +586,31 @@
const tabs = tab ? [tab] : TabContextMenu.contextTab.multiselected ? gBrowser.selectedTabs : [TabContextMenu.contextTab]; const tabs = tab ? [tab] : TabContextMenu.contextTab.multiselected ? gBrowser.selectedTabs : [TabContextMenu.contextTab];
for (let i = 0; i < tabs.length; i++) { for (let i = 0; i < tabs.length; i++) {
const tab = tabs[i]; const tab = tabs[i];
if (tab.hasAttribute('zen-essential')) {
continue;
}
tab.setAttribute('zen-essential', 'true'); tab.setAttribute('zen-essential', 'true');
if (tab.hasAttribute('zen-workspace-id')) { if (tab.hasAttribute('zen-workspace-id')) {
tab.removeAttribute('zen-workspace-id'); tab.removeAttribute('zen-workspace-id');
} }
if (tab.pinned) { if (tab.pinned && tab.hasAttribute('zen-pin-id')) {
this._temporarilyUnpiningEssential = true; const pin = this._pinsCache.find((pin) => pin.uuid === tab.getAttribute('zen-pin-id'));
gBrowser.unpinTab(tab); if (pin) {
pin.isEssential = true;
ZenPinnedTabsStorage.savePin(pin);
} }
document.getElementById('zen-essentials-container').appendChild(tab);
gBrowser.tabContainer._invalidateCachedTabs();
} else {
gBrowser.pinTab(tab); gBrowser.pinTab(tab);
this.resetPinChangedUrl(tab); }
this.onTabIconChanged(tab); this.onTabIconChanged(tab);
this._onTabMove(tab); this._onTabMove(tab);
} }
gZenUIManager.updateTabsToolbar(); gZenUIManager.updateTabsToolbar();
} }
removeEssentials(tab) { removeEssentials(tab, unpin = true) {
const tabs = tab ? [tab] : TabContextMenu.contextTab.multiselected ? gBrowser.selectedTabs : [TabContextMenu.contextTab]; const tabs = tab ? [tab] : TabContextMenu.contextTab.multiselected ? gBrowser.selectedTabs : [TabContextMenu.contextTab];
for (let i = 0; i < tabs.length; i++) { for (let i = 0; i < tabs.length; i++) {
const tab = tabs[i]; const tab = tabs[i];
@@ -611,7 +618,14 @@
if (ZenWorkspaces.workspaceEnabled && ZenWorkspaces.getActiveWorkspaceFromCache.uuid) { if (ZenWorkspaces.workspaceEnabled && ZenWorkspaces.getActiveWorkspaceFromCache.uuid) {
tab.setAttribute('zen-workspace-id', ZenWorkspaces.getActiveWorkspaceFromCache.uuid); tab.setAttribute('zen-workspace-id', ZenWorkspaces.getActiveWorkspaceFromCache.uuid);
} }
if (unpin) {
gBrowser.unpinTab(tab); gBrowser.unpinTab(tab);
} else {
const pinContainer = ZenWorkspaces.pinnedTabsContainer;
pinContainer.prepend(tab);
gBrowser.tabContainer._invalidateCachedTabs();
this._onTabMove(tab);
}
} }
gZenUIManager.updateTabsToolbar(); gZenUIManager.updateTabsToolbar();
} }
@@ -685,8 +699,7 @@
gBrowser.pinTab(draggedTab); gBrowser.pinTab(draggedTab);
moved = true; moved = true;
} else if (draggedTab.hasAttribute('zen-essential')) { } else if (draggedTab.hasAttribute('zen-essential')) {
this.removeEssentials(draggedTab); this.removeEssentials(draggedTab, false);
gBrowser.pinTab(draggedTab);
moved = true; moved = true;
} }
} }

View File

@@ -1,5 +1,5 @@
diff --git a/browser/components/tabbrowser/content/tab.js b/browser/components/tabbrowser/content/tab.js diff --git a/browser/components/tabbrowser/content/tab.js b/browser/components/tabbrowser/content/tab.js
index d41c486c02a6f09dcff5741a59ad8b617294c481..5d3d4556ccb1fd28ada75df22f2c1ec8f56b05b1 100644 index d41c486c02a6f09dcff5741a59ad8b617294c481..efa900725f32d8606ba6d3bb8bff2d0dcb511e78 100644
--- a/browser/components/tabbrowser/content/tab.js --- a/browser/components/tabbrowser/content/tab.js
+++ b/browser/components/tabbrowser/content/tab.js +++ b/browser/components/tabbrowser/content/tab.js
@@ -16,6 +16,7 @@ @@ -16,6 +16,7 @@
@@ -71,10 +71,10 @@ index d41c486c02a6f09dcff5741a59ad8b617294c481..5d3d4556ccb1fd28ada75df22f2c1ec8
} }
+ +
+ if (event.target.classList.contains("tab-reset-pin-button")) { + if (event.target.classList.contains("tab-reset-pin-button")) {
+ gZenPinnedTabManager._onTabResetPinButton(event, this); + gZenPinnedTabManager._onTabResetPinButton(event, this, 'reset');
+ gBrowser.tabContainer._blockDblClick = true; + gBrowser.tabContainer._blockDblClick = true;
+ } else if (event.target.classList.contains("tab-reset-button")) { + } else if (event.target.classList.contains("tab-reset-button")) {
+ gZenPinnedTabManager._onCloseTabShortcut(event, this, 'unload-switch'); + gZenPinnedTabManager._onCloseTabShortcut(event, this);
+ gBrowser.tabContainer._blockDblClick = true; + gBrowser.tabContainer._blockDblClick = true;
+ } + }
} }