mirror of
https://github.com/zen-browser/desktop.git
synced 2026-04-21 14:55:37 +00:00
Display web panels at the sidebar works!
This commit is contained in:
@@ -138,4 +138,6 @@ pref('dom.security.sanitizer.enabled', true);
|
||||
// Pref to enable the new profiles (TODO: Check this out!)
|
||||
//pref("browser.profiles.enabled", true);
|
||||
|
||||
// Zen Sidebar
|
||||
pref('zen.sidebar.data', "{\"data\":{\"p1\":{\"url\":\"https://google.com\"}},\"index\":[\"p1\"]}");
|
||||
pref('zen.sidebar.enabled', true);
|
||||
54
src/browser/base/content/ZenSidebarManager.mjs
Normal file
54
src/browser/base/content/ZenSidebarManager.mjs
Normal file
@@ -0,0 +1,54 @@
|
||||
|
||||
var ZenSidebarManager = {
|
||||
_sidebarElement: null,
|
||||
|
||||
init() {
|
||||
this.update();
|
||||
},
|
||||
|
||||
update() {
|
||||
this._updateWebPanels();
|
||||
},
|
||||
|
||||
_updateWebPanels() {
|
||||
if (Services.prefs.getBoolPref("zen.sidebar.enabled")) {
|
||||
this.sidebarElement.removeAttribute("hidden");
|
||||
} else {
|
||||
this.sidebarElement.setAttribute("hidden", "true");
|
||||
return;
|
||||
}
|
||||
|
||||
let services = Services.prefs.getStringPref("zen.sidebar.data");
|
||||
if (services === "") {
|
||||
return;
|
||||
}
|
||||
let data = JSON.parse(services);
|
||||
if (!data.data || !data.index) {
|
||||
return;
|
||||
}
|
||||
for (let site of data.index) {
|
||||
let panel = data.data[site];
|
||||
if (!panel || !panel.url) {
|
||||
continue;
|
||||
}
|
||||
let button = document.createXULElement("toolbarbutton");
|
||||
button.classList.add("zen-sidebar-panel-button", "toolbarbutton-1", "chromeclass-toolbar-additional");
|
||||
button.setAttribute("flex", "1");
|
||||
button.style.listStyleImage = this._getWebPanelIcon(panel.url);
|
||||
this.sidebarElement.appendChild(button);
|
||||
}
|
||||
},
|
||||
|
||||
_getWebPanelIcon(url) {
|
||||
return `url(page-icon:${url})`;
|
||||
},
|
||||
|
||||
get sidebarElement() {
|
||||
if (!this._sidebarElement) {
|
||||
this._sidebarElement = document.getElementById("zen-sidebar-panels-wrapper");
|
||||
}
|
||||
return this._sidebarElement;
|
||||
}
|
||||
};
|
||||
|
||||
ZenSidebarManager.init();
|
||||
@@ -1,5 +1,5 @@
|
||||
diff --git a/browser/base/content/browser.css b/browser/base/content/browser.css
|
||||
index 8a2a20280954eb9db144a723f477e7afc603fda3..b6eb4fe9de2077420e1f750cb9662f883f95d300 100644
|
||||
index c9ebddb7f5c57d00c06bdf303a23085818c78259..f97c3e808d1c42cbce1a538ab7aeefa91ad27893 100644
|
||||
--- a/browser/base/content/browser.css
|
||||
+++ b/browser/base/content/browser.css
|
||||
@@ -2,6 +2,8 @@
|
||||
@@ -11,7 +11,7 @@ index 8a2a20280954eb9db144a723f477e7afc603fda3..b6eb4fe9de2077420e1f750cb9662f88
|
||||
@namespace html url("http://www.w3.org/1999/xhtml");
|
||||
|
||||
:root,
|
||||
@@ -156,8 +158,6 @@ panelview:not([visible]) {
|
||||
@@ -157,8 +159,6 @@ panelview:not([visible]) {
|
||||
flex: 100 100;
|
||||
max-width: 225px;
|
||||
min-width: var(--tab-min-width);
|
||||
@@ -20,7 +20,7 @@ index 8a2a20280954eb9db144a723f477e7afc603fda3..b6eb4fe9de2077420e1f750cb9662f88
|
||||
}
|
||||
|
||||
:root[uidensity=touch] .tabbrowser-tab:not([pinned]) {
|
||||
@@ -658,7 +658,7 @@ toolbar:not(#TabsToolbar) > #personal-bookmarks {
|
||||
@@ -659,7 +659,7 @@ toolbar:not(#TabsToolbar) > #personal-bookmarks {
|
||||
#urlbar[usertyping] > #urlbar-input-container > #page-action-buttons > #urlbar-zoom-button,
|
||||
#urlbar:not([usertyping]) > #urlbar-input-container > #urlbar-go-button,
|
||||
#urlbar:not([focused]) > #urlbar-input-container > #urlbar-go-button {
|
||||
@@ -29,7 +29,7 @@ index 8a2a20280954eb9db144a723f477e7afc603fda3..b6eb4fe9de2077420e1f750cb9662f88
|
||||
}
|
||||
|
||||
#nav-bar:not([keyNav=true]) #identity-box,
|
||||
@@ -1319,13 +1319,13 @@ printpreview-pagination:focus-within,
|
||||
@@ -1244,13 +1244,13 @@ printpreview-pagination:focus-within,
|
||||
|
||||
|
||||
#sidebar-box {
|
||||
@@ -46,7 +46,7 @@ index 8a2a20280954eb9db144a723f477e7afc603fda3..b6eb4fe9de2077420e1f750cb9662f88
|
||||
list-style-image: var(--webextension-menuitem-image, inherit);
|
||||
-moz-context-properties: fill;
|
||||
fill: currentColor;
|
||||
@@ -1526,3 +1526,42 @@ toolbar[keyNav=true]:not([collapsed=true], [customizing=true]) toolbartabstop {
|
||||
@@ -1451,3 +1451,42 @@ toolbar[keyNav=true]:not([collapsed=true], [customizing=true]) toolbartabstop {
|
||||
/**
|
||||
* End Dialogs
|
||||
*/
|
||||
|
||||
@@ -1,8 +1,16 @@
|
||||
diff --git a/browser/base/content/browser.xhtml b/browser/base/content/browser.xhtml
|
||||
index 1dcdd02cd1bfe24c9f32304511f3dd675fc9265c..753d0b60e0877507b531a415461fa8a9c843dcbd 100644
|
||||
index 1dcdd02cd1bfe24c9f32304511f3dd675fc9265c..e81ccd535dc3dbcb485d39001b879970d7648693 100644
|
||||
--- a/browser/base/content/browser.xhtml
|
||||
+++ b/browser/base/content/browser.xhtml
|
||||
@@ -165,9 +165,13 @@
|
||||
@@ -144,6 +144,7 @@
|
||||
window.addEventListener("DOMContentLoaded",
|
||||
gBrowserInit.onDOMContentLoaded.bind(gBrowserInit), { once: true });
|
||||
</script>
|
||||
+#include zen-scripts.inc.xhtml
|
||||
</head>
|
||||
<html:body xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
# All sets except for popupsets (commands, keys, and stringbundles)
|
||||
@@ -165,9 +166,13 @@
|
||||
</vbox>
|
||||
</html:template>
|
||||
|
||||
|
||||
@@ -1,7 +1,16 @@
|
||||
diff --git a/browser/base/content/navigator-toolbox.inc.xhtml b/browser/base/content/navigator-toolbox.inc.xhtml
|
||||
index fc19910726f2925505f6e71add034c82af36b63e..df0c170ae44c0d51e2c60777c8f845c6b58a2a26 100644
|
||||
index fc19910726f2925505f6e71add034c82af36b63e..29c40b6b8915fdd7c7066b53b72b6c0617513146 100644
|
||||
--- a/browser/base/content/navigator-toolbox.inc.xhtml
|
||||
+++ b/browser/base/content/navigator-toolbox.inc.xhtml
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
<hbox class="titlebar-spacer" type="pre-tabs"/>
|
||||
|
||||
- <hbox flex="1" align="end" class="toolbar-items">
|
||||
+ <hbox flex="1" align="start" class="toolbar-items">
|
||||
<toolbartabstop/>
|
||||
<hbox id="TabsToolbar-customization-target" flex="1">
|
||||
<toolbarbutton id="firefox-view-button"
|
||||
@@ -50,21 +50,24 @@
|
||||
aria-multiselectable="true"
|
||||
setfocus="false"
|
||||
|
||||
7
src/browser/base/content/zen-scripts.inc.xhtml
Normal file
7
src/browser/base/content/zen-scripts.inc.xhtml
Normal file
@@ -0,0 +1,7 @@
|
||||
<script type="text/javascript">
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
import("chrome://browser/content/ZenSidebarManager.mjs").then(({ gZenBrowserManagerSidebar }) => {
|
||||
window.gZenBrowserManagerSidebar = gZenBrowserManagerSidebar
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -1,3 +1,4 @@
|
||||
content/browser/zen-browser-places.js (content/zen-browser-places.js)
|
||||
content/browser/zen-browser-places.js (content/zen-browser-places.js)
|
||||
content/browser/zen-browser.js (content/zen-browser.js)
|
||||
content/browser/zenThemeModifier.js (content/zenThemeModifier.js)
|
||||
content/browser/zenThemeModifier.js (content/zenThemeModifier.js)
|
||||
content/browser/ZenSidebarManager.mjs (content/ZenSidebarManager.mjs)
|
||||
@@ -1,3 +1,4 @@
|
||||
#include zen-sidebar-panels.inc.xhtml
|
||||
<toolbar id="zen-sidebar-icons-wrapper">
|
||||
<toolbarbutton class="toolbarbutton-1 zen-sidebar-action-button chromeclass-toolbar-additional subviewbutton-nav" badge="true" closemenu="none" removable="true" delegatesanchor="true" cui-areatype="toolbar" id="zen-profile-button" data-l10n-id="toolbar-button-account" onclick="ZenProfileDialogUI.showSubView(this, event)">
|
||||
<html:div class="zen-side-bar-profiles-button-panel-correction"></html:div>
|
||||
|
||||
2
src/browser/base/content/zen-sidebar-panels.inc.xhtml
Normal file
2
src/browser/base/content/zen-sidebar-panels.inc.xhtml
Normal file
@@ -0,0 +1,2 @@
|
||||
<hbox id="zen-sidebar-panels-wrapper" hidden="true">
|
||||
</hbox>
|
||||
@@ -1,25 +1,8 @@
|
||||
diff --git a/browser/components/BrowserGlue.sys.mjs b/browser/components/BrowserGlue.sys.mjs
|
||||
index f4ea0c87a35a19c09f811576201a7adb865ed74c..30f81ad02cd90f478945845b4d8a47da5f3601f0 100644
|
||||
index f4ea0c87a35a19c09f811576201a7adb865ed74c..89e44ab4d3b6f0ce0ecf89c4b8b484b7da5fa2ea 100644
|
||||
--- a/browser/components/BrowserGlue.sys.mjs
|
||||
+++ b/browser/components/BrowserGlue.sys.mjs
|
||||
@@ -27,6 +27,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
|
||||
BrowserUsageTelemetry: "resource:///modules/BrowserUsageTelemetry.sys.mjs",
|
||||
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.sys.mjs",
|
||||
BuiltInThemes: "resource:///modules/BuiltInThemes.sys.mjs",
|
||||
+ ZenSidebarManager: "resource:///modules/ZenSidebarManager.sys.mjs",
|
||||
ContextualIdentityService:
|
||||
"resource://gre/modules/ContextualIdentityService.sys.mjs",
|
||||
Corroborate: "resource://gre/modules/Corroborate.sys.mjs",
|
||||
@@ -1446,6 +1447,8 @@ BrowserGlue.prototype = {
|
||||
|
||||
AboutHomeStartupCache.init();
|
||||
|
||||
+ lazy.ZenSidebarManager.init();
|
||||
+
|
||||
Services.obs.notifyObservers(null, "browser-ui-startup-complete");
|
||||
},
|
||||
|
||||
@@ -4436,6 +4439,7 @@ BrowserGlue.prototype = {
|
||||
@@ -4436,6 +4436,7 @@ BrowserGlue.prototype = {
|
||||
},
|
||||
|
||||
async _maybeShowDefaultBrowserPrompt() {
|
||||
@@ -27,7 +10,7 @@ index f4ea0c87a35a19c09f811576201a7adb865ed74c..30f81ad02cd90f478945845b4d8a47da
|
||||
// Highest priority is about:welcome window modal experiment
|
||||
// Second highest priority is the upgrade dialog, which can include a "primary
|
||||
// browser" request and is limited in various ways, e.g., major upgrades.
|
||||
@@ -4894,6 +4898,16 @@ BrowserGlue.prototype = {
|
||||
@@ -4894,6 +4895,16 @@ BrowserGlue.prototype = {
|
||||
"nsIObserver",
|
||||
"nsISupportsWeakReference",
|
||||
]),
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
|
||||
export var ZenSidebarManager = {
|
||||
init() {
|
||||
this.update();
|
||||
},
|
||||
|
||||
update() {
|
||||
let services = Services.prefs.getStringPref("zen.sidebar.data");
|
||||
if (services === "") {
|
||||
return;
|
||||
}
|
||||
let data = JSON.parse(services);
|
||||
if (!data.data || !data.index) {
|
||||
return;
|
||||
}
|
||||
console.log(data.data)
|
||||
},
|
||||
};
|
||||
@@ -1,5 +1,5 @@
|
||||
diff --git a/browser/components/moz.build b/browser/components/moz.build
|
||||
index 0f91b90fb0ce4eac232d71ad4f9ff82ab7316635..f1596aa7d0ab7e058d3482c0dac8ab10157f8bc8 100644
|
||||
index 0f91b90fb0ce4eac232d71ad4f9ff82ab7316635..82aa7bb8bd41b061ac861d3fbabbf9f9879a2091 100644
|
||||
--- a/browser/components/moz.build
|
||||
+++ b/browser/components/moz.build
|
||||
@@ -72,6 +72,9 @@ DIRS += [
|
||||
@@ -12,11 +12,3 @@ index 0f91b90fb0ce4eac232d71ad4f9ff82ab7316635..f1596aa7d0ab7e058d3482c0dac8ab10
|
||||
DIRS += ["build"]
|
||||
|
||||
|
||||
@@ -118,3 +121,7 @@ if CONFIG["MOZ_UPDATER"]:
|
||||
MARIONETTE_MANIFESTS += ["tests/marionette/manifest.toml"]
|
||||
|
||||
XPCSHELL_TESTS_MANIFESTS += ["tests/unit/xpcshell.toml"]
|
||||
+
|
||||
+EXTRA_JS_MODULES += [
|
||||
+ "ZenSidebarManager.sys.mjs",
|
||||
+]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
diff --git a/browser/themes/shared/tabs.css b/browser/themes/shared/tabs.css
|
||||
index eb92f71e5942a19618fd74492354de78ac03bacf..51dbf4a694e2ac22fb02abcd405db579966c1bdc 100644
|
||||
index eb92f71e5942a19618fd74492354de78ac03bacf..28d23667991c9feff7a379acaa5f7c7928fb14cf 100644
|
||||
--- a/browser/themes/shared/tabs.css
|
||||
+++ b/browser/themes/shared/tabs.css
|
||||
@@ -67,7 +67,7 @@
|
||||
@@ -11,7 +11,15 @@ index eb92f71e5942a19618fd74492354de78ac03bacf..51dbf4a694e2ac22fb02abcd405db579
|
||||
--tab-overflow-pinned-tabs-width: 0px;
|
||||
padding-inline: var(--tab-overflow-pinned-tabs-width) 0;
|
||||
/* Use a bigger flex value than the searchbar to prevent it from
|
||||
@@ -633,7 +633,7 @@
|
||||
@@ -618,6 +618,7 @@
|
||||
.titlebar-spacer[type="pre-tabs"],
|
||||
.titlebar-spacer[type="post-tabs"] {
|
||||
width: 40px;
|
||||
+ display: none !important;
|
||||
}
|
||||
|
||||
@media (max-width: 500px) {
|
||||
@@ -633,7 +634,7 @@
|
||||
toolbarbutton:not(#firefox-view-button),
|
||||
toolbarpaletteitem:not(#wrapper-firefox-view-button)
|
||||
) + #tabbrowser-tabs {
|
||||
|
||||
@@ -207,6 +207,12 @@ button.popup-notification-dropmarker {
|
||||
padding: 5px 0;
|
||||
margin-right: 0 !important;
|
||||
-moz-window-dragging: no-drag;
|
||||
|
||||
display: grid;
|
||||
grid-template-rows: repeat(3, auto);
|
||||
justify-items: center;
|
||||
|
||||
--zen-sidebar-action-button-width: 40px;
|
||||
}
|
||||
|
||||
#navigator-toolbox[inlinedwithsidebar="true"] #TabsToolbar {
|
||||
|
||||
32
src/browser/themes/shared/zen-sidebar-panels.css
Normal file
32
src/browser/themes/shared/zen-sidebar-panels.css
Normal file
@@ -0,0 +1,32 @@
|
||||
|
||||
#zen-sidebar-panels-wrapper {
|
||||
min-height: 500px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.zen-sidebar-panel-button {
|
||||
width: var(--zen-sidebar-action-button-width);
|
||||
height: var(--zen-sidebar-action-button-width);
|
||||
max-height: var(--zen-sidebar-action-button-width);
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.zen-sidebar-panel-button image {
|
||||
border-radius: 15px !important;
|
||||
background: var(--toolbarbutton-hover-background);
|
||||
}
|
||||
|
||||
.zen-sidebar-panel-button:hover image {
|
||||
background: color-mix(in srgb, var(--toolbarbutton-hover-background) 12%, transparent);
|
||||
}
|
||||
|
||||
.zen-sidebar-panel-button {
|
||||
margin-bottom: 5px !important;
|
||||
}
|
||||
@@ -1,3 +1,6 @@
|
||||
|
||||
@import url("zen-sidebar-panels.css");
|
||||
|
||||
:root {
|
||||
--sidebar-background-color: var(--toolbar-bgcolor) !important;
|
||||
--zen-sidebar-box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
|
||||
@@ -47,8 +50,8 @@
|
||||
}
|
||||
|
||||
.zen-sidebar-action-button {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
width: var(--zen-sidebar-action-button-width);
|
||||
height: var(--zen-sidebar-action-button-width);
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
display: flex;
|
||||
@@ -56,7 +59,14 @@
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
#TabsToolbar .toolbarbutton-1 > :is(.toolbarbutton-icon, .toolbarbutton-badge-stack),
|
||||
#TabsToolbar .toolbarbutton-1 {
|
||||
width: var(--zen-sidebar-action-button-width);
|
||||
height: var(--zen-sidebar-action-button-width);
|
||||
margin-left: auto !important;
|
||||
margin-right: auto !important;
|
||||
}
|
||||
|
||||
#TabsToolbar .toolbarbutton-1:not(.zen-sidebar-panel-button) > :is(.toolbarbutton-icon, .toolbarbutton-badge-stack),
|
||||
.zen-sidebar-action-button {
|
||||
border-radius: 100px !important;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
skin/classic/browser/zen-browser-shared.css (../shared/zen-browser-shared.css)
|
||||
skin/classic/browser/zen-sidebar.css (../shared/zen-sidebar.css)
|
||||
skin/classic/browser/zen-panel-ui.css (../shared/zen-panel-ui.css)
|
||||
skin/classic/browser/zen-sidebar-panels.css (../shared/zen-sidebar-panels.css)
|
||||
skin/classic/browser/preferences/zen-preferences.css (../shared/preferences/zen-preferences.css)
|
||||
|
||||
#include zen-icons/jar.inc.mn
|
||||
@@ -242,6 +242,7 @@ toolbarbutton:not(:is(
|
||||
.subviewbutton-iconic,
|
||||
.zen-sidebar-action-button,
|
||||
.all-tabs-close-button,
|
||||
.zen-sidebar-panel-button,
|
||||
#PanelUI-zen-profiles-managePrfs
|
||||
)),
|
||||
#PanelUI-zen-profiles menuitem {
|
||||
|
||||
Reference in New Issue
Block a user