mirror of
https://github.com/zen-browser/desktop.git
synced 2025-10-05 17:36:34 +00:00
refactor: update workspace settings and improve CSS styles for better layout and responsiveness
This commit is contained in:
2
l10n
2
l10n
Submodule l10n updated: 7c14b58a28...778cb128c6
@@ -199,7 +199,6 @@ pref('zen.startup.smooth-scroll-in-tabs', true);
|
|||||||
|
|
||||||
// Zen Workspaces
|
// Zen Workspaces
|
||||||
pref('zen.workspaces.disabled_for_testing', false);
|
pref('zen.workspaces.disabled_for_testing', false);
|
||||||
pref('zen.workspaces.hide-deactivated-workspaces', false);
|
|
||||||
pref('zen.workspaces.hide-default-container-indicator', true);
|
pref('zen.workspaces.hide-default-container-indicator', true);
|
||||||
pref('zen.workspaces.force-container-workspace', false);
|
pref('zen.workspaces.force-container-workspace', false);
|
||||||
pref('zen.workspaces.open-new-tab-if-last-unpinned-tab-is-closed', false);
|
pref('zen.workspaces.open-new-tab-if-last-unpinned-tab-is-closed', false);
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#PanelUI-zen-gradient-generator {
|
#PanelUI-zen-gradient-generator {
|
||||||
--panel-width: 300px;
|
--panel-width: 320px;
|
||||||
--panel-padding: 10px;
|
--panel-padding: 10px;
|
||||||
min-width: var(--panel-width);
|
min-width: var(--panel-width);
|
||||||
}
|
}
|
||||||
|
@@ -474,9 +474,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
& #zen-workspaces-button {
|
& #zen-workspaces-button {
|
||||||
margin-left: 2px;
|
|
||||||
margin-right: 2px;
|
|
||||||
|
|
||||||
& .zen-workspace-sidebar-icon[no-icon='true'] {
|
& .zen-workspace-sidebar-icon[no-icon='true'] {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
@@ -20,11 +20,13 @@
|
|||||||
--toolbarbutton-hover-background: transparent !important;
|
--toolbarbutton-hover-background: transparent !important;
|
||||||
border-radius: var(--zen-button-border-radius) !important;
|
border-radius: var(--zen-button-border-radius) !important;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
padding: 2px;
|
|
||||||
appearance: unset !important;
|
appearance: unset !important;
|
||||||
height: fit-content;
|
height: fit-content;
|
||||||
gap: 3px;
|
gap: 3px;
|
||||||
|
|
||||||
|
container-type: inline-size;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
& toolbarbutton {
|
& toolbarbutton {
|
||||||
margin: auto;
|
margin: auto;
|
||||||
width: 25px;
|
width: 25px;
|
||||||
@@ -34,8 +36,44 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
@media (-moz-bool-pref: 'zen.workspaces.hide-deactivated-workspaces') {
|
& .zen-workspace-icon[no-icon='true'] {
|
||||||
&:not([active='true']):not(:hover) {
|
width: 6px;
|
||||||
|
height: 6px;
|
||||||
|
background: light-dark(rgba(0, 0, 0, 0.4), rgba(255, 255, 255, 0.4));
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
filter: grayscale(1);
|
||||||
|
opacity: 0.5;
|
||||||
|
transition:
|
||||||
|
filter 0.2s,
|
||||||
|
opacity 0.2s,
|
||||||
|
width 0.1s;
|
||||||
|
|
||||||
|
&[active='true'],
|
||||||
|
&:hover {
|
||||||
|
filter: grayscale(0);
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: var(--zen-toolbar-element-bg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&[overflow] {
|
||||||
|
gap: 0 !important;
|
||||||
|
|
||||||
|
& toolbarbutton {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
& toolbarbutton:not([active='true']),
|
||||||
|
&:has(toolbarbutton:hover) toolbarbutton[active='true'] {
|
||||||
|
&:not(:hover) {
|
||||||
|
width: min(var(--zen-overflowed-workspace-button-width), 25px);
|
||||||
|
min-width: 10px;
|
||||||
|
|
||||||
&::after {
|
&::after {
|
||||||
content: '';
|
content: '';
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@@ -58,33 +96,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
& .zen-workspace-icon[no-icon='true'] {
|
|
||||||
width: 6px;
|
|
||||||
height: 6px;
|
|
||||||
background: light-dark(rgba(0, 0, 0, 0.4), rgba(255, 255, 255, 0.4));
|
|
||||||
border-radius: 50%;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media not (-moz-bool-pref: 'zen.workspaces.hide-deactivated-workspaces') {
|
|
||||||
& {
|
|
||||||
filter: grayscale(1);
|
|
||||||
opacity: 0.5;
|
|
||||||
transition:
|
|
||||||
filter 0.2s,
|
|
||||||
opacity 0.2s;
|
|
||||||
}
|
|
||||||
|
|
||||||
&[active='true'],
|
|
||||||
&:hover {
|
|
||||||
filter: grayscale(0);
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
background-color: var(--zen-toolbar-element-bg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,8 +129,6 @@
|
|||||||
|
|
||||||
& #zen-workspaces-button {
|
& #zen-workspaces-button {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
white-space: nowrap;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 0.5ch;
|
gap: 0.5ch;
|
||||||
}
|
}
|
||||||
|
@@ -500,9 +500,8 @@
|
|||||||
const centerPosition = { x: rect.width / 2, y: rect.height / 2 };
|
const centerPosition = { x: rect.width / 2, y: rect.height / 2 };
|
||||||
|
|
||||||
const harmonyAngles = getColorHarmonyType(dots.length + (action === 'add' ? 1 : action === 'remove' ? -1 : 0), this.dots);
|
const harmonyAngles = getColorHarmonyType(dots.length + (action === 'add' ? 1 : action === 'remove' ? -1 : 0), this.dots);
|
||||||
if (!harmonyAngles || harmonyAngles.angles.length === 0) return dots;
|
|
||||||
|
|
||||||
this.useAlgo = harmonyAngles.type;
|
this.useAlgo = harmonyAngles.type;
|
||||||
|
if (!harmonyAngles || harmonyAngles.angles.length === 0) return dots;
|
||||||
|
|
||||||
let primaryDot = dots.find((dot) => dot.ID === 0);
|
let primaryDot = dots.find((dot) => dot.ID === 0);
|
||||||
if (!primaryDot) return [];
|
if (!primaryDot) return [];
|
||||||
@@ -638,7 +637,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let colorPositions = this.calculateCompliments(this.dots, 'remove', this.useAlgo);
|
let colorPositions = this.calculateCompliments(this.dots, 'remove');
|
||||||
this.handleColorPositions(colorPositions);
|
this.handleColorPositions(colorPositions);
|
||||||
this.updateCurrentWorkspace();
|
this.updateCurrentWorkspace();
|
||||||
return;
|
return;
|
||||||
@@ -780,7 +779,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let colorPositions = this.calculateCompliments(this.dots, 'remove', this.useAlgo);
|
let colorPositions = this.calculateCompliments(this.dots, 'remove');
|
||||||
this.handleColorPositions(colorPositions);
|
this.handleColorPositions(colorPositions);
|
||||||
|
|
||||||
this.updateCurrentWorkspace();
|
this.updateCurrentWorkspace();
|
||||||
|
@@ -58,16 +58,8 @@ class ZenMediaController {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
window.addEventListener('TabClose', (event) => {
|
const onTabDiscardedOrClosed = this.onTabDiscardedOrClosed.bind(this);
|
||||||
const linkedBrowser = event.target.linkedBrowser;
|
window.addEventListener('TabClose', onTabDiscardedOrClosed);
|
||||||
if (!linkedBrowser?.browsingContext?.mediaController) return;
|
|
||||||
this.deinitMediaController(
|
|
||||||
linkedBrowser.browsingContext.mediaController,
|
|
||||||
true,
|
|
||||||
linkedBrowser.browserId === this._currentBrowser?.browserId,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
window.addEventListener('DOMAudioPlaybackStarted', (event) => {
|
window.addEventListener('DOMAudioPlaybackStarted', (event) => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@@ -89,6 +81,17 @@ class ZenMediaController {
|
|||||||
window.addEventListener('DOMAudioPlaybackStopped', () => this.updateMuteState());
|
window.addEventListener('DOMAudioPlaybackStopped', () => this.updateMuteState());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onTabDiscardedOrClosed(event) {
|
||||||
|
const linkedBrowser = event.target.linkedBrowser;
|
||||||
|
if (!linkedBrowser?.browsingContext?.mediaController) return;
|
||||||
|
this.deinitMediaController(
|
||||||
|
linkedBrowser.browsingContext.mediaController,
|
||||||
|
true,
|
||||||
|
linkedBrowser.browserId === this._currentBrowser?.browserId,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
async deinitMediaController(mediaController, shouldForget = true, shouldOverride = true, shouldHide = true) {
|
async deinitMediaController(mediaController, shouldForget = true, shouldOverride = true, shouldHide = true) {
|
||||||
if (!mediaController) return;
|
if (!mediaController) return;
|
||||||
|
|
||||||
|
@@ -22,8 +22,6 @@
|
|||||||
'TabAttrModified',
|
'TabAttrModified',
|
||||||
'TabPinned',
|
'TabPinned',
|
||||||
'TabUnpinned',
|
'TabUnpinned',
|
||||||
'TabBrowserInserted',
|
|
||||||
'TabBrowserDiscarded',
|
|
||||||
'TabShow',
|
'TabShow',
|
||||||
'TabHide',
|
'TabHide',
|
||||||
'TabOpen',
|
'TabOpen',
|
||||||
@@ -150,8 +148,6 @@
|
|||||||
switch (action) {
|
switch (action) {
|
||||||
case 'TabPinned':
|
case 'TabPinned':
|
||||||
case 'TabUnpinned':
|
case 'TabUnpinned':
|
||||||
case 'TabBrowserInserted':
|
|
||||||
case 'TabBrowserDiscarded':
|
|
||||||
case 'TabShow':
|
case 'TabShow':
|
||||||
case 'TabHide':
|
case 'TabHide':
|
||||||
break;
|
break;
|
||||||
@@ -265,9 +261,9 @@
|
|||||||
tab.selected ||
|
tab.selected ||
|
||||||
(tab.multiselected && !ignoreTimestamp) ||
|
(tab.multiselected && !ignoreTimestamp) ||
|
||||||
(tab.hasAttribute('busy') && !ignoreTimestamp) ||
|
(tab.hasAttribute('busy') && !ignoreTimestamp) ||
|
||||||
tab.hasAttribute('pending') ||
|
|
||||||
!tab.linkedPanel ||
|
!tab.linkedPanel ||
|
||||||
tab.splitView ||
|
tab.splitView ||
|
||||||
|
tab.group?.hasAttribute('split-view-group') ||
|
||||||
tab.attention ||
|
tab.attention ||
|
||||||
tab.hasAttribute('glance-id') ||
|
tab.hasAttribute('glance-id') ||
|
||||||
tab.linkedBrowser?.zenModeActive ||
|
tab.linkedBrowser?.zenModeActive ||
|
||||||
@@ -293,8 +289,8 @@
|
|||||||
|
|
||||||
_tabPermitsUnload(tab, extraArgs) {
|
_tabPermitsUnload(tab, extraArgs) {
|
||||||
return typeof extraArgs.permitUnload === 'undefined'
|
return typeof extraArgs.permitUnload === 'undefined'
|
||||||
? !tab.linkedBrowser?.permitUnload()?.permitUnload
|
? tab.linkedBrowser?.permitUnload()?.permitUnload
|
||||||
: !extraArgs.permitUnload;
|
: extraArgs.permitUnload;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -77,6 +77,8 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
|||||||
);
|
);
|
||||||
ChromeUtils.defineLazyGetter(this, 'tabContainer', () => document.getElementById('tabbrowser-tabs'));
|
ChromeUtils.defineLazyGetter(this, 'tabContainer', () => document.getElementById('tabbrowser-tabs'));
|
||||||
this._activeWorkspace = Services.prefs.getStringPref('zen.workspaces.active', '');
|
this._activeWorkspace = Services.prefs.getStringPref('zen.workspaces.active', '');
|
||||||
|
|
||||||
|
window.addEventListener('resize', this.onWindowResize.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
async afterLoadInit() {
|
async afterLoadInit() {
|
||||||
@@ -599,6 +601,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('ZenWorkspaces: Error initializing theme picker', e);
|
console.error('ZenWorkspaces: Error initializing theme picker', e);
|
||||||
}
|
}
|
||||||
|
this.onWindowResize();
|
||||||
await this._selectStartPage();
|
await this._selectStartPage();
|
||||||
this._fixTabPositions();
|
this._fixTabPositions();
|
||||||
this._resolveInitialized();
|
this._resolveInitialized();
|
||||||
@@ -2368,4 +2371,21 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
|||||||
const workspace = workspaces.workspaces.find((workspace) => workspace.uuid === activeWorkspace);
|
const workspace = workspaces.workspaces.find((workspace) => workspace.uuid === activeWorkspace);
|
||||||
return workspace.containerTabId;
|
return workspace.containerTabId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onWindowResize() {
|
||||||
|
// Check if workspace icons overflow the parent container
|
||||||
|
const parent = document.getElementById('zen-workspaces-button');
|
||||||
|
if (!parent) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Once we are overflowing, we align the buttons to always stay inside the container,
|
||||||
|
// meaning we need to remove the overflow attribute to reset the width
|
||||||
|
parent.removeAttribute('overflow');
|
||||||
|
const overflow = parent.scrollWidth > parent.clientWidth;
|
||||||
|
parent.toggleAttribute('overflow', overflow);
|
||||||
|
// The maximum width a button has when it overflows based on the number of buttons
|
||||||
|
const numButtons = parent.children.length + 1; // +1 to exclude the active button
|
||||||
|
const maxWidth = 100 / numButtons;
|
||||||
|
parent.style.setProperty('--zen-overflowed-workspace-button-width', `${maxWidth}%`);
|
||||||
|
}
|
||||||
})();
|
})();
|
||||||
|
@@ -959,11 +959,6 @@ Preferences.addAll([
|
|||||||
type: 'int',
|
type: 'int',
|
||||||
default: 10,
|
default: 10,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
id: 'zen.workspaces.hide-deactivated-workspaces',
|
|
||||||
type: 'bool',
|
|
||||||
default: true,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
id: 'zen.pinned-tab-manager.restore-pinned-tabs-to-pinned-url',
|
id: 'zen.pinned-tab-manager.restore-pinned-tabs-to-pinned-url',
|
||||||
type: 'bool',
|
type: 'bool',
|
||||||
|
@@ -23,9 +23,6 @@
|
|||||||
<checkbox id="zenWorkspacesForceContainerTabsToWorkspace"
|
<checkbox id="zenWorkspacesForceContainerTabsToWorkspace"
|
||||||
data-l10n-id="zen-settings-workspaces-force-container-tabs-to-workspace"
|
data-l10n-id="zen-settings-workspaces-force-container-tabs-to-workspace"
|
||||||
preference="zen.workspaces.force-container-workspace"/>
|
preference="zen.workspaces.force-container-workspace"/>
|
||||||
<checkbox id="zenWorkspaceHideDeactivatedWorkspaces"
|
|
||||||
data-l10n-id="zen-settings-workspaces-hide-deactivated-workspaces"
|
|
||||||
preference="zen.workspaces.hide-deactivated-workspaces"/>
|
|
||||||
</groupbox>
|
</groupbox>
|
||||||
|
|
||||||
<hbox id="zenTabsUnloadCategory"
|
<hbox id="zenTabsUnloadCategory"
|
||||||
|
Reference in New Issue
Block a user