Skip to content

Commit 12891ab

Browse files
committed
Refactor tab management and styles for improved functionality and user experience
1 parent c4480f2 commit 12891ab

File tree

6 files changed

+33
-20
lines changed

6 files changed

+33
-20
lines changed

.github/workflows/build.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -547,10 +547,10 @@ jobs:
547547
GITHUB_REPOSITORY: ${{ github.repository }}
548548

549549
- name: Release
550-
uses: marvinpinto/action-automatic-releases@master
550+
uses: softprops/action-gh-release@v2
551551
if: ${{ inputs.update_branch == 'release' }}
552552
with:
553-
token: '${{ secrets.DEPLOY_KEY }}'
553+
token: ${{ secrets.DEPLOY_KEY }}
554554
tag_name: ${{ needs.build-data.outputs.version }}
555555
prerelease: false
556556
fail_on_unmatched_files: false

src/browser/app/profile/zen-browser.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ pref('zen.tab-unloader.excluded-urls', "example.com,example.org");
173173

174174
pref('zen.pinned-tab-manager.debug', false);
175175
pref('zen.pinned-tab-manager.restore-pinned-tabs-to-pinned-url', false);
176-
pref('zen.pinned-tab-manager.close-shortcut-behavior', 'unload-switch');
176+
pref('zen.pinned-tab-manager.close-shortcut-behavior', 'reset-unload-switch');
177177

178178
// TODO: Check this out!
179179
pref("browser.profiles.enabled", false);

src/browser/base/content/zen-styles/zen-tabs/vertical-tabs.css

+3-3
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@
558558
width: -moz-available;
559559
}
560560

561-
&[zen-pinned-changed='true'] > .tab-stack > .tab-content > .tab-icon-stack {
561+
&[zen-pinned-changed='true']:not([zen-essential]) > .tab-stack > .tab-content > .tab-icon-stack {
562562
position: absolute;
563563
top: 50%;
564564
transform: translateY(-50%);
@@ -572,11 +572,11 @@
572572
}
573573
}
574574

575-
&[zen-pinned-changed='true'] .tab-reset-pin-button image {
575+
&[zen-pinned-changed='true']:not([zen-essential]) .tab-reset-pin-button image {
576576
opacity: 0;
577577
}
578578

579-
&[zen-pinned-changed='true'] .tab-reset-pin-button:hover {
579+
&[zen-pinned-changed='true']:not([zen-essential]) .tab-reset-pin-button:hover {
580580
& ~ .tab-label-container .tab-reset-pin-label {
581581
max-height: 10px;
582582
opacity: 0.6;

src/browser/base/content/zen-styles/zen-urlbar.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ button.popup-notification-dropmarker {
412412

413413
:root[zen-single-toolbar='true'] {
414414
#urlbar[open] {
415-
min-width: 35vw;
415+
min-width: min(90%, 40rem);
416416
}
417417

418418
&[zen-right-side='true'] #urlbar[open]:not([zen-floating-urlbar='true']) {

src/browser/base/zen-components/ZenPinnedTabManager.mjs

+23-10
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,6 @@
437437
async _removePinnedAttributes(tab, isClosing = false) {
438438
tab.removeAttribute('zen-has-static-label');
439439
if (!tab.getAttribute('zen-pin-id') || this._temporarilyUnpiningEssential) {
440-
this._temporarilyUnpiningEssential = false;
441440
return;
442441
}
443442

@@ -587,31 +586,46 @@
587586
const tabs = tab ? [tab] : TabContextMenu.contextTab.multiselected ? gBrowser.selectedTabs : [TabContextMenu.contextTab];
588587
for (let i = 0; i < tabs.length; i++) {
589588
const tab = tabs[i];
589+
if (tab.hasAttribute('zen-essential')) {
590+
continue;
591+
}
590592
tab.setAttribute('zen-essential', 'true');
591593
if (tab.hasAttribute('zen-workspace-id')) {
592594
tab.removeAttribute('zen-workspace-id');
593595
}
594-
if (tab.pinned) {
595-
this._temporarilyUnpiningEssential = true;
596-
gBrowser.unpinTab(tab);
596+
if (tab.pinned && tab.hasAttribute('zen-pin-id')) {
597+
const pin = this._pinsCache.find((pin) => pin.uuid === tab.getAttribute('zen-pin-id'));
598+
if (pin) {
599+
pin.isEssential = true;
600+
ZenPinnedTabsStorage.savePin(pin);
601+
}
602+
document.getElementById('zen-essentials-container').appendChild(tab);
603+
gBrowser.tabContainer._invalidateCachedTabs();
604+
} else {
605+
gBrowser.pinTab(tab);
597606
}
598-
gBrowser.pinTab(tab);
599-
this.resetPinChangedUrl(tab);
600607
this.onTabIconChanged(tab);
601608
this._onTabMove(tab);
602609
}
603610
gZenUIManager.updateTabsToolbar();
604611
}
605612

606-
removeEssentials(tab) {
613+
removeEssentials(tab, unpin = true) {
607614
const tabs = tab ? [tab] : TabContextMenu.contextTab.multiselected ? gBrowser.selectedTabs : [TabContextMenu.contextTab];
608615
for (let i = 0; i < tabs.length; i++) {
609616
const tab = tabs[i];
610617
tab.removeAttribute('zen-essential');
611618
if (ZenWorkspaces.workspaceEnabled && ZenWorkspaces.getActiveWorkspaceFromCache.uuid) {
612619
tab.setAttribute('zen-workspace-id', ZenWorkspaces.getActiveWorkspaceFromCache.uuid);
613620
}
614-
gBrowser.unpinTab(tab);
621+
if (unpin) {
622+
gBrowser.unpinTab(tab);
623+
} else {
624+
const pinContainer = ZenWorkspaces.pinnedTabsContainer;
625+
pinContainer.prepend(tab);
626+
gBrowser.tabContainer._invalidateCachedTabs();
627+
this._onTabMove(tab);
628+
}
615629
}
616630
gZenUIManager.updateTabsToolbar();
617631
}
@@ -685,8 +699,7 @@
685699
gBrowser.pinTab(draggedTab);
686700
moved = true;
687701
} else if (draggedTab.hasAttribute('zen-essential')) {
688-
this.removeEssentials(draggedTab);
689-
gBrowser.pinTab(draggedTab);
702+
this.removeEssentials(draggedTab, false);
690703
moved = true;
691704
}
692705
}

src/browser/components/tabbrowser/content/tab-js.patch

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
diff --git a/browser/components/tabbrowser/content/tab.js b/browser/components/tabbrowser/content/tab.js
2-
index d41c486c02a6f09dcff5741a59ad8b617294c481..5d3d4556ccb1fd28ada75df22f2c1ec8f56b05b1 100644
2+
index d41c486c02a6f09dcff5741a59ad8b617294c481..efa900725f32d8606ba6d3bb8bff2d0dcb511e78 100644
33
--- a/browser/components/tabbrowser/content/tab.js
44
+++ b/browser/components/tabbrowser/content/tab.js
55
@@ -16,6 +16,7 @@
@@ -71,10 +71,10 @@ index d41c486c02a6f09dcff5741a59ad8b617294c481..5d3d4556ccb1fd28ada75df22f2c1ec8
7171
}
7272
+
7373
+ if (event.target.classList.contains("tab-reset-pin-button")) {
74-
+ gZenPinnedTabManager._onTabResetPinButton(event, this);
74+
+ gZenPinnedTabManager._onTabResetPinButton(event, this, 'reset');
7575
+ gBrowser.tabContainer._blockDblClick = true;
7676
+ } else if (event.target.classList.contains("tab-reset-button")) {
77-
+ gZenPinnedTabManager._onCloseTabShortcut(event, this, 'unload-switch');
77+
+ gZenPinnedTabManager._onCloseTabShortcut(event, this);
7878
+ gBrowser.tabContainer._blockDblClick = true;
7979
+ }
8080
}

0 commit comments

Comments
 (0)