mirror of
https://github.com/zen-browser/desktop.git
synced 2025-07-10 05:35:29 +02:00
Rename workspaces button to workspace select button and adjust related styles for consistency
This commit is contained in:
parent
f000af56e7
commit
0b17ceda90
10 changed files with 37 additions and 50 deletions
|
@ -4,7 +4,7 @@ export var ZenCustomizableUI = new (class {
|
||||||
constructor() {}
|
constructor() {}
|
||||||
|
|
||||||
TYPE_TOOLBAR = 'toolbar';
|
TYPE_TOOLBAR = 'toolbar';
|
||||||
defaultSidebarIcons = ['zen-profile-button', 'zen-workspaces-button', 'downloads-button'];
|
defaultSidebarIcons = ['zen-profile-button', 'zen-workspace-select-button', 'downloads-button'];
|
||||||
|
|
||||||
startup(CustomizableUIInternal) {
|
startup(CustomizableUIInternal) {
|
||||||
CustomizableUIInternal.registerArea(
|
CustomizableUIInternal.registerArea(
|
||||||
|
@ -83,10 +83,6 @@ export var ZenCustomizableUI = new (class {
|
||||||
const newTab = window.document.getElementById('vertical-tabs-newtab-button');
|
const newTab = window.document.getElementById('vertical-tabs-newtab-button');
|
||||||
newTab.classList.add('zen-sidebar-action-button');
|
newTab.classList.add('zen-sidebar-action-button');
|
||||||
|
|
||||||
const wrapper = window.document.createXULElement('toolbarbutton');
|
|
||||||
wrapper.id = 'zen-workspaces-button';
|
|
||||||
window.document.getElementById('zen-sidebar-icons-wrapper').prepend(wrapper);
|
|
||||||
|
|
||||||
for (let id of this.defaultSidebarIcons) {
|
for (let id of this.defaultSidebarIcons) {
|
||||||
const elem = window.document.getElementById(id);
|
const elem = window.document.getElementById(id);
|
||||||
if (!elem) continue;
|
if (!elem) continue;
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
mode="icons">
|
mode="icons">
|
||||||
<toolbarbutton removable="true" class="chromeclass-toolbar-additional toolbarbutton-1 zen-sidebar-action-button" id="zen-expand-sidebar-button" data-l10n-id="sidebar-zen-expand" cui-areatype="toolbar" oncommand="gZenVerticalTabsManager.toggleExpand();"></toolbarbutton>
|
<toolbarbutton removable="true" class="chromeclass-toolbar-additional toolbarbutton-1 zen-sidebar-action-button" id="zen-expand-sidebar-button" data-l10n-id="sidebar-zen-expand" cui-areatype="toolbar" oncommand="gZenVerticalTabsManager.toggleExpand();"></toolbarbutton>
|
||||||
<toolbarbutton removable="true" class="toolbarbutton-1 zen-sidebar-action-button zen-compact-mode-ignore" id="zen-sidepanel-button" data-l10n-id="sidebar-zen-sidepanel" onclick="gZenBrowserManagerSidebar.toggle();"></toolbarbutton>
|
<toolbarbutton removable="true" class="toolbarbutton-1 zen-sidebar-action-button zen-compact-mode-ignore" id="zen-sidepanel-button" data-l10n-id="sidebar-zen-sidepanel" onclick="gZenBrowserManagerSidebar.toggle();"></toolbarbutton>
|
||||||
<toolbarbutton removable="true" id="zen-workspaces-button"></toolbarbutton>
|
<toolbarbutton removable="false" id="zen-workspace-select-button"></toolbarbutton>
|
||||||
<toolbarbutton id="zen-profile-button"
|
<toolbarbutton id="zen-profile-button"
|
||||||
class="zen-sidebar-action-button toolbarbutton-1 chromeclass-toolbar-additional"
|
class="zen-sidebar-action-button toolbarbutton-1 chromeclass-toolbar-additional"
|
||||||
delegatesanchor="true"
|
delegatesanchor="true"
|
||||||
|
|
|
@ -219,16 +219,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes zen-workspaces-button-active {
|
|
||||||
from {
|
|
||||||
bottom: -20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
to {
|
|
||||||
bottom: -2px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Mark: Zen Glance */
|
/* Mark: Zen Glance */
|
||||||
@keyframes zen-glance-overlay-animation {
|
@keyframes zen-glance-overlay-animation {
|
||||||
from {
|
from {
|
||||||
|
|
|
@ -20,7 +20,7 @@ xul|button {
|
||||||
border: 1px solid var(--zen-colors-border);
|
border: 1px solid var(--zen-colors-border);
|
||||||
}
|
}
|
||||||
|
|
||||||
button:not(#zen-workspaces-button):active {
|
button:not(#zen-workspace-select-button):active {
|
||||||
transform: scale(0.98);
|
transform: scale(0.98);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
#zen-workspaces-button .zen-workspace-sidebar-name {
|
#zen-workspace-select-button .zen-workspace-sidebar-name {
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
display: none;
|
display: none;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
|
@ -228,7 +228,7 @@
|
||||||
border-bottom: 0px solid transparent !important;
|
border-bottom: 0px solid transparent !important;
|
||||||
|
|
||||||
--tab-block-margin: 2px;
|
--tab-block-margin: 2px;
|
||||||
--tab-selected-bgcolor: light-dark(rgba(255, 255, 255, 0.75), rgba(0, 0, 0, 0.11));
|
--tab-selected-bgcolor: light-dark(rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.11));
|
||||||
grid-gap: 0 !important;
|
grid-gap: 0 !important;
|
||||||
|
|
||||||
&[overflow]::after,
|
&[overflow]::after,
|
||||||
|
@ -321,7 +321,7 @@
|
||||||
|
|
||||||
padding-top: var(--zen-element-separation);
|
padding-top: var(--zen-element-separation);
|
||||||
|
|
||||||
& > toolbarbutton:not(#zen-workspaces-button) {
|
& > toolbarbutton:not(#zen-workspace-select-button) {
|
||||||
padding: 0 !important;
|
padding: 0 !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -398,7 +398,7 @@
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
& #zen-workspaces-button[as-button='true'] {
|
& #zen-workspace-select-button[as-button='true'] {
|
||||||
width: calc(100% - 10px) !important;
|
width: calc(100% - 10px) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -406,7 +406,7 @@
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
& #zen-workspaces-button {
|
& #zen-workspace-select-button {
|
||||||
margin-left: 2px;
|
margin-left: 2px;
|
||||||
margin-right: 2px;
|
margin-right: 2px;
|
||||||
|
|
||||||
|
@ -453,7 +453,7 @@
|
||||||
bottom: calc(-0.5 * var(--zen-toolbox-padding));
|
bottom: calc(-0.5 * var(--zen-toolbox-padding));
|
||||||
}
|
}
|
||||||
|
|
||||||
& > *:not(tabs):not(#search-container):not(#zen-workspaces-button),
|
& > *:not(tabs):not(#search-container):not(#zen-workspace-select-button),
|
||||||
& #tabbrowser-arrowscrollbox-periphery > toolbarbutton {
|
& #tabbrowser-arrowscrollbox-periphery > toolbarbutton {
|
||||||
width: 100% !important;
|
width: 100% !important;
|
||||||
border-radius: var(--tab-border-radius) !important;
|
border-radius: var(--tab-border-radius) !important;
|
||||||
|
@ -656,7 +656,7 @@
|
||||||
margin-inline-end: 0 !important;
|
margin-inline-end: 0 !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
& #zen-workspaces-button {
|
& #zen-workspace-select-button {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
&:not([as-button='true']) {
|
&:not([as-button='true']) {
|
||||||
& toolbarbutton {
|
& toolbarbutton {
|
||||||
|
|
|
@ -106,7 +106,7 @@
|
||||||
|
|
||||||
--zen-toolbar-element-filter: brightness(0.95);
|
--zen-toolbar-element-filter: brightness(0.95);
|
||||||
@media (prefers-color-scheme: dark) {
|
@media (prefers-color-scheme: dark) {
|
||||||
--zen-toolbar-element-filter: brightness(1.2);
|
--zen-toolbar-element-filter: brightness(1.25);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Toolbar */
|
/* Toolbar */
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
@namespace html 'http://www.w3.org/1999/xhtml';
|
@namespace html 'http://www.w3.org/1999/xhtml';
|
||||||
|
|
||||||
#zen-workspaces-button {
|
#zen-workspace-select-button {
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -63,7 +63,7 @@
|
||||||
& {
|
& {
|
||||||
opacity: 0.4;
|
opacity: 0.4;
|
||||||
filter: grayscale(1);
|
filter: grayscale(1);
|
||||||
transition: opacity 0.2s;
|
transition: opacity 0.2s, filter 0.2s;
|
||||||
}
|
}
|
||||||
|
|
||||||
&[active='true'] {
|
&[active='true'] {
|
||||||
|
@ -105,7 +105,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#zen-workspaces-button .zen-workspace-sidebar-wrapper {
|
#zen-workspace-select-button .zen-workspace-sidebar-wrapper {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -114,7 +114,7 @@
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
#zen-workspaces-button .zen-workspace-sidebar-name {
|
#zen-workspace-select-button .zen-workspace-sidebar-name {
|
||||||
margin-left: 0.2rem;
|
margin-left: 0.2rem;
|
||||||
display: none;
|
display: none;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
@ -125,18 +125,18 @@
|
||||||
|
|
||||||
/** Keep these selectors in sync with the ones in vertical-tabs.css */
|
/** Keep these selectors in sync with the ones in vertical-tabs.css */
|
||||||
#navigator-toolbox {
|
#navigator-toolbox {
|
||||||
& #zen-workspaces-button[as-button='true'] {
|
& #zen-workspace-select-button[as-button='true'] {
|
||||||
width: calc(100% - var(--toolbarbutton-outer-padding));
|
width: calc(100% - var(--toolbarbutton-outer-padding));
|
||||||
margin: 2px;
|
margin: 2px;
|
||||||
min-width: calc(2 * var(--toolbarbutton-inner-padding) + 16px);
|
min-width: calc(2 * var(--toolbarbutton-inner-padding) + 16px);
|
||||||
height: calc(2 * var(--toolbarbutton-inner-padding) + 16px);
|
height: calc(2 * var(--toolbarbutton-inner-padding) + 16px);
|
||||||
}
|
}
|
||||||
|
|
||||||
& #zen-workspaces-button .zen-workspace-sidebar-name {
|
& #zen-workspace-select-button .zen-workspace-sidebar-name {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
& #zen-workspaces-button .zen-workspace-sidebar-icon {
|
& #zen-workspace-select-button .zen-workspace-sidebar-icon {
|
||||||
margin-inline-end: 5px;
|
margin-inline-end: 5px;
|
||||||
|
|
||||||
& [no-icon='true'] {
|
& [no-icon='true'] {
|
||||||
|
@ -144,11 +144,11 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
& #zen-workspaces-button .zen-workspace-sidebar-icon[no-icon='true'] + .zen-workspace-sidebar-name {
|
& #zen-workspace-select-button .zen-workspace-sidebar-icon[no-icon='true'] + .zen-workspace-sidebar-name {
|
||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
& #zen-workspaces-button {
|
& #zen-workspace-select-button {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
|
|
|
@ -14,16 +14,17 @@ XPCOMUtils.defineLazyPreferenceGetter(
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
|
ChromeUtils.defineLazyGetter(lazyCompactMode, 'mainAppWrapper', () => document.getElementById('zen-main-app-wrapper'));
|
||||||
|
|
||||||
var gZenCompactModeManager = {
|
var gZenCompactModeManager = {
|
||||||
_flashTimeouts: {},
|
_flashTimeouts: {},
|
||||||
_evenListeners: [],
|
_evenListeners: [],
|
||||||
_removeHoverFrames: {},
|
_removeHoverFrames: {},
|
||||||
|
_animating: false,
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
Services.prefs.addObserver('zen.tabs.vertical.right-side', this._updateSidebarIsOnRight.bind(this));
|
Services.prefs.addObserver('zen.tabs.vertical.right-side', this._updateSidebarIsOnRight.bind(this));
|
||||||
|
|
||||||
ChromeUtils.defineLazyGetter(this, 'mainAppWrapper', () => document.getElementById('zen-main-app-wrapper'));
|
|
||||||
|
|
||||||
this._canAnimateSidebar = Services.prefs.getBoolPref('zen.view.compact.animate-sidebar', true);
|
this._canAnimateSidebar = Services.prefs.getBoolPref('zen.view.compact.animate-sidebar', true);
|
||||||
|
|
||||||
gZenUIManager.addPopupTrackingAttribute(this.sidebar);
|
gZenUIManager.addPopupTrackingAttribute(this.sidebar);
|
||||||
|
@ -35,18 +36,19 @@ var gZenCompactModeManager = {
|
||||||
|
|
||||||
get preference() {
|
get preference() {
|
||||||
if (!document.documentElement.hasAttribute('zen-compact-mode')) {
|
if (!document.documentElement.hasAttribute('zen-compact-mode')) {
|
||||||
document.documentElement.setAttribute('zen-compact-mode', this.mainAppWrapper.getAttribute('zen-compact-mode'));
|
document.documentElement.setAttribute('zen-compact-mode', lazyCompactMode.mainAppWrapper.getAttribute('zen-compact-mode'));
|
||||||
}
|
}
|
||||||
return this.mainAppWrapper.getAttribute('zen-compact-mode') === 'true';
|
return lazyCompactMode.mainAppWrapper.getAttribute('zen-compact-mode') === 'true';
|
||||||
},
|
},
|
||||||
|
|
||||||
set preference(value) {
|
set preference(value) {
|
||||||
if (this.preference === value) {
|
if (this.preference === value || this._animating) {
|
||||||
|
// We dont want the user to be able to spam the button
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
// We use this element in order to make it persis across restarts, by using the XULStore.
|
// We use this element in order to make it persis across restarts, by using the XULStore.
|
||||||
// main-window can't store attributes other than window sizes, so we use this instead
|
// main-window can't store attributes other than window sizes, so we use this instead
|
||||||
this.mainAppWrapper.setAttribute('zen-compact-mode', value);
|
lazyCompactMode.mainAppWrapper.setAttribute('zen-compact-mode', value);
|
||||||
document.documentElement.setAttribute('zen-compact-mode', value);
|
document.documentElement.setAttribute('zen-compact-mode', value);
|
||||||
this._updateEvent();
|
this._updateEvent();
|
||||||
return value;
|
return value;
|
||||||
|
@ -69,11 +71,7 @@ var gZenCompactModeManager = {
|
||||||
|
|
||||||
flashSidebarIfNecessary(aInstant = false) {
|
flashSidebarIfNecessary(aInstant = false) {
|
||||||
if (!aInstant && this.preference && lazyCompactMode.COMPACT_MODE_FLASH_ENABLED && !gZenGlanceManager._animating) {
|
if (!aInstant && this.preference && lazyCompactMode.COMPACT_MODE_FLASH_ENABLED && !gZenGlanceManager._animating) {
|
||||||
try {
|
this.flashSidebar();
|
||||||
this.flashSidebar();
|
|
||||||
} catch (e) {
|
|
||||||
// Ignore errors
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -140,6 +138,7 @@ var gZenCompactModeManager = {
|
||||||
},
|
},
|
||||||
|
|
||||||
animateCompactMode() {
|
animateCompactMode() {
|
||||||
|
this._animating = true;
|
||||||
const isCompactMode = this.preference;
|
const isCompactMode = this.preference;
|
||||||
const canHideSidebar = Services.prefs.getBoolPref('zen.view.compact.hide-tabbar');
|
const canHideSidebar = Services.prefs.getBoolPref('zen.view.compact.hide-tabbar');
|
||||||
// Do this so we can get the correct width ONCE compact mode styled have been applied
|
// Do this so we can get the correct width ONCE compact mode styled have been applied
|
||||||
|
@ -175,6 +174,7 @@ var gZenCompactModeManager = {
|
||||||
this.sidebar.style.removeProperty('margin-right');
|
this.sidebar.style.removeProperty('margin-right');
|
||||||
this.sidebar.style.removeProperty('margin-left');
|
this.sidebar.style.removeProperty('margin-left');
|
||||||
this.sidebar.style.removeProperty('transform');
|
this.sidebar.style.removeProperty('transform');
|
||||||
|
this._animating = false;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.sidebar.style.removeProperty('transition');
|
this.sidebar.style.removeProperty('transition');
|
||||||
});
|
});
|
||||||
|
@ -210,6 +210,7 @@ var gZenCompactModeManager = {
|
||||||
this.sidebar.style.removeProperty('margin-right');
|
this.sidebar.style.removeProperty('margin-right');
|
||||||
this.sidebar.style.removeProperty('margin-left');
|
this.sidebar.style.removeProperty('margin-left');
|
||||||
this.sidebar.style.removeProperty('transform');
|
this.sidebar.style.removeProperty('transform');
|
||||||
|
this._animating = false;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.sidebar.style.removeProperty('transition');
|
this.sidebar.style.removeProperty('transition');
|
||||||
});
|
});
|
||||||
|
|
|
@ -879,7 +879,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||||
await this.changeWorkspace(workspace);
|
await this.changeWorkspace(workspace);
|
||||||
let panel = this.ownerWindow.document.getElementById('PanelUI-zen-workspaces');
|
let panel = this.ownerWindow.document.getElementById('PanelUI-zen-workspaces');
|
||||||
PanelMultiView.hidePopup(panel);
|
PanelMultiView.hidePopup(panel);
|
||||||
this.ownerWindow.document.getElementById('zen-workspaces-button').removeAttribute('open');
|
this.ownerWindow.document.getElementById('zen-workspace-select-button').removeAttribute('open');
|
||||||
}).bind(browser.ZenWorkspaces);
|
}).bind(browser.ZenWorkspaces);
|
||||||
return element;
|
return element;
|
||||||
};
|
};
|
||||||
|
@ -1025,7 +1025,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||||
if (!this.workspaceEnabled) {
|
if (!this.workspaceEnabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let target = event.target.closest('#zen-current-workspace-indicator') || document.getElementById('zen-workspaces-button');
|
let target = event.target.closest('#zen-current-workspace-indicator') || document.getElementById('zen-workspace-select-button');
|
||||||
let panel = document.getElementById('PanelUI-zen-workspaces');
|
let panel = document.getElementById('PanelUI-zen-workspaces');
|
||||||
await this._propagateWorkspaceData({
|
await this._propagateWorkspaceData({
|
||||||
ignoreStrip: true,
|
ignoreStrip: true,
|
||||||
|
@ -1040,8 +1040,8 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||||
async initializeWorkspacesButton() {
|
async initializeWorkspacesButton() {
|
||||||
if (!this.workspaceEnabled) {
|
if (!this.workspaceEnabled) {
|
||||||
return;
|
return;
|
||||||
} else if (document.getElementById('zen-workspaces-button')) {
|
} else if (document.getElementById('zen-workspace-select-button')) {
|
||||||
let button = document.getElementById('zen-workspaces-button');
|
let button = document.getElementById('zen-workspace-select-button');
|
||||||
button.removeAttribute('hidden');
|
button.removeAttribute('hidden');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1052,7 +1052,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||||
if (typeof browser.ZenWorkspaces === 'undefined') {
|
if (typeof browser.ZenWorkspaces === 'undefined') {
|
||||||
browser = window;
|
browser = window;
|
||||||
}
|
}
|
||||||
let button = browser.document.getElementById('zen-workspaces-button');
|
let button = browser.document.getElementById('zen-workspace-select-button');
|
||||||
|
|
||||||
while (button.firstChild) {
|
while (button.firstChild) {
|
||||||
button.firstChild.remove();
|
button.firstChild.remove();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue