1
0
Fork 1
mirror of https://github.com/zen-browser/desktop.git synced 2025-07-09 16:45:30 +02:00

Refactor Zen Workspaces preferences and hide default container indicator

This commit is contained in:
mauro-balades 2024-09-11 23:44:47 +02:00
parent af98bb7758
commit 6d3b20062e
8 changed files with 46 additions and 11 deletions

2
l10n

@ -1 +1 @@
Subproject commit d875087d8795ee1bc91a00e007b358b163ab7386
Subproject commit f6bd0f902f7b030f43407d7613a70f5d83cb95b5

View file

@ -107,6 +107,7 @@ pref('zen.splitView.working', false);
// Zen Workspaces
pref('zen.workspaces.enabled', true);
pref('zen.workspaces.hide-default-container-indicator', true);
pref('zen.workspaces.icons', '["🌐", "📁", "📎", "📝", "📅", "📊"]');
// Zen Watermark

@ -1 +1 @@
Subproject commit b372ec2694039dc347b35d977afa0c5cd81a5ca2
Subproject commit c9c5c94e8d4d9f306bfe73fc79b153d9b979533e

View file

@ -199,7 +199,7 @@
display: none;
}
.tabbrowser-tab::after {
.tabbrowser-tab::before {
/* Containers */
background: var(--identity-tab-color, transparent);
border-radius: 2px;
@ -213,6 +213,12 @@
pointer-events: none;
}
@media (-moz-bool-pref: 'zen.workspaces.hide-default-container-indicator') {
.tabbrowser-tab[zenDefaultUserContextId='true']::before {
display: none;
}
}
.tabbrowser-tab {
margin-inline-start: 0;
margin: 0 auto;

View file

@ -604,4 +604,9 @@ Preferences.addAll([
type: 'bool',
default: false,
},
{
id: 'zen.workspaces.hide-default-container-indicator',
type: 'bool',
default: true,
},
]);

View file

@ -20,6 +20,11 @@
<checkbox id="zenWorkspacesActivate"
data-l10n-id="zen-settings-workspaces-enabled"
preference="zen.workspaces.enabled"/>
<box class="indent">
<checkbox id="zenWorkspacesHideDefaultContainer"
data-l10n-id="zen-settings-workspaces-hide-default-container-indicator"
preference="zen.workspaces.hide-default-container-indicator"/>
</box>
</groupbox>
</html:template>

View file

@ -1,12 +1,13 @@
diff --git a/browser/components/sessionstore/TabState.sys.mjs b/browser/components/sessionstore/TabState.sys.mjs
index 26f5671c849d9b0a126d79b07bc7d3d7870826ec..decc4c975507c9111df78dbc43434fa46d5f5e82 100644
index 26f5671c849d9b0a126d79b07bc7d3d7870826ec..26f80d69a28f1196096e67a0e628a69b5b367727 100644
--- a/browser/components/sessionstore/TabState.sys.mjs
+++ b/browser/components/sessionstore/TabState.sys.mjs
@@ -98,6 +98,8 @@ var TabStateInternal = {
@@ -98,6 +98,9 @@ var TabStateInternal = {
tabData.muteReason = tab.muteReason;
}
+ tabData.zenWorkspace = tab.getAttribute("zen-workspace-id");
+ tabData.zenDefaultUserContextId = tab.getAttribute("zenDefaultUserContextId");
+
tabData.searchMode = tab.ownerGlobal.gURLBar.getSearchMode(browser, true);

View file

@ -1,19 +1,30 @@
diff --git a/browser/components/tabbrowser/content/tabbrowser.js b/browser/components/tabbrowser/content/tabbrowser.js
index ef857bd81f2cd7c163ecc74ac1cf81a0b63ce838..24cf982dced9abdb412fac4abbf1428b983d16ff 100644
index ef857bd81f2cd7c163ecc74ac1cf81a0b63ce838..a9e4da68d8de456a757158a311296792a7781e8f 100644
--- a/browser/components/tabbrowser/content/tabbrowser.js
+++ b/browser/components/tabbrowser/content/tabbrowser.js
@@ -2704,6 +2704,10 @@
@@ -2704,6 +2704,11 @@
);
}
+ let hasZenDefaultUserContextId = false;
+ if (typeof ZenWorkspaces !== "undefined") {
+ userContextId = ZenWorkspaces.getContextIdIfNeeded(userContextId);
+ [userContextId, hasZenDefaultUserContextId] = ZenWorkspaces.getContextIdIfNeeded(userContextId);
+ }
+
if (!UserInteraction.running("browser.tabs.opening", window)) {
UserInteraction.start("browser.tabs.opening", "initting", window);
}
@@ -3248,6 +3252,11 @@
@@ -2771,6 +2776,9 @@
noInitialLabel,
skipBackgroundNotify,
});
+ if (hasZenDefaultUserContextId) {
+ t.setAttribute("zenDefaultUserContextId", "true");
+ }
if (insertTab) {
// insert the tab into the tab container in the correct position
this._insertTabAtIndex(t, {
@@ -3248,6 +3256,14 @@
) {
tabWasReused = true;
tab = this.selectedTab;
@ -21,22 +32,28 @@ index ef857bd81f2cd7c163ecc74ac1cf81a0b63ce838..24cf982dced9abdb412fac4abbf1428b
+ if (tabData.zenWorkspace) {
+ tab.setAttribute("zen-workspace-id", tabData.zenWorkspace);
+ }
+ if (tabData.zenDefaultUserContextId) {
+ tab.setAttribute("zenDefaultUserContextId", "true");
+ }
+
if (!tabData.pinned) {
this.unpinTab(tab);
} else {
@@ -3297,6 +3306,10 @@
@@ -3297,6 +3313,13 @@
preferredRemoteType,
});
+ if (tabData.zenWorkspace) {
+ tab.setAttribute("zen-workspace-id", tabData.zenWorkspace);
+ }
+ if (tabData.zenDefaultUserContextId) {
+ tab.setAttribute("zenDefaultUserContextId", "true");
+ }
+
if (select) {
tabToSelect = tab;
}
@@ -4184,6 +4197,7 @@
@@ -4184,6 +4207,7 @@
isLastTab ||
aTab.pinned ||
aTab.hidden ||