Fixed reordering pinned tabs not saving their state

This commit is contained in:
mr. M
2024-12-18 19:27:23 +01:00
parent 0bd34061b9
commit 947251534f
3 changed files with 29 additions and 5 deletions

View File

@@ -83,6 +83,7 @@
#zen-appcontent-wrapper { #zen-appcontent-wrapper {
max-width: 100%; max-width: 100%;
min-width: 1px;
overflow-x: hidden; overflow-x: hidden;
z-index: 1; z-index: 1;
} }

View File

@@ -6,17 +6,18 @@ height: var(--zen-toolbar-height);
transition-delay: 0.2s; transition-delay: 0.2s;
& > * { & > * {
transition: transform 0.2s ease-out; transition: opacity 0.2s ease-out;
transition-delay: 0.2s;
} }
} }
&:not([zen-has-hover='true']):not([has-popup-menu]):not(:focus-within) { &:not([zen-has-hover='true']):not([has-popup-menu]):not(:focus-within) {
transition-delay: 0.1s; transition-delay: 0.2s;
height: var(--zen-element-separation); height: var(--zen-element-separation);
overflow: hidden; overflow: hidden;
opacity: 0; opacity: 0;
& > * { & > * {
transform: translateY(-100%); opacity: 0;
pointer-events: none; pointer-events: none;
} }
} }

View File

@@ -2,7 +2,7 @@
const lazy = {}; const lazy = {};
class ZenPinnedTabsObserver { class ZenPinnedTabsObserver {
static ALL_EVENTS = ['TabPinned', 'TabUnpinned']; static ALL_EVENTS = ['TabPinned', 'TabUnpinned', 'TabMove'];
#listeners = []; #listeners = [];
@@ -49,7 +49,6 @@
this._zenClickEventListener = this._onTabClick.bind(this); this._zenClickEventListener = this._onTabClick.bind(this);
ZenWorkspaces.addChangeListeners(this.onWorkspaceChange.bind(this)); ZenWorkspaces.addChangeListeners(this.onWorkspaceChange.bind(this));
} }
async onWorkspaceChange(newWorkspace, onInit) { async onWorkspaceChange(newWorkspace, onInit) {
@@ -271,12 +270,35 @@
delete tab._zenClickEventListener; delete tab._zenClickEventListener;
} }
break; break;
case "TabMove":
this._onTabMove(tab);
break;
default: default:
console.warn('ZenPinnedTabManager: Unhandled tab event', action); console.warn('ZenPinnedTabManager: Unhandled tab event', action);
break; break;
} }
} }
async _onTabMove(tab) {
if (!tab.pinned) {
return;
}
// Recollect pinned tabs and essentials after a tab move
const currentWorkspace = await ZenWorkspaces.getActiveWorkspace();
tab.position = tab._tPos;
for (let otherTab of gBrowser.tabs) {
if (otherTab.pinned && otherTab._tPos > tab.position) {
otherTab.position = otherTab._tPos;
await ZenPinnedTabsStorage.savePin(otherTab, false);
}
}
await ZenPinnedTabsStorage.savePin(tab);
}
_onTabClick(e) { _onTabClick(e) {
const tab = e.target?.closest("tab"); const tab = e.target?.closest("tab");
if (e.button === 1 && tab) { if (e.button === 1 && tab) {