feat: Add Essentials Toolbar

This commit introduces a new Essentials Toolbar feature to Zen. It provides a more streamlined and organized way for users to access frequently used bookmakrs directly from the sidebar.

- Added `ZenEssentialsToolbar.mjs` to provide the logic for the toolbar.
- Updated the sidebar CSS (`zen-sidebar.css`) to style the Essentials Toolbar.
- Modified `ZenStartup.mjs` to initialize the Essentials Toolbar.
- Made changes to `browserPlacesViews-js.patch` to integrate with existing bookmark functionality.
- Added a new preference `zen.essentials.enabled` to enable/disable the Essentials Toolbar.
This commit is contained in:
Kristijan Ribarić
2024-11-02 20:08:00 +01:00
parent 984fa08f14
commit a21511b683
7 changed files with 118 additions and 1 deletions

View File

@@ -0,0 +1,30 @@
diff --git a/browser/components/places/content/browserPlacesViews.js b/browser/components/places/content/browserPlacesViews.js
index 1bfa0af16178c9b42172bc1b1e0249d28ff8e9e6..e7e76a6d548b32887c1d39053e42c5e3dafbb839 100644
--- a/browser/components/places/content/browserPlacesViews.js
+++ b/browser/components/places/content/browserPlacesViews.js
@@ -393,6 +393,7 @@ class PlacesViewBase {
"scheme",
PlacesUIUtils.guessUrlSchemeForUI(aPlacesNode.uri)
);
+ element.addEventListener("command", gZenGlanceManager.openGlanceForBookmark.bind(gZenGlanceManager));
} else if (PlacesUtils.containerTypes.includes(type)) {
element = document.createXULElement("menu");
element.setAttribute("container", "true");
@@ -1087,6 +1088,8 @@ class PlacesToolbar extends PlacesViewBase {
"scheme",
PlacesUIUtils.guessUrlSchemeForUI(aChild.uri)
);
+ button.hidden = ZenWorkspaces.isBookmarkInAnotherWorkspace(aChild);
+ button.addEventListener("command", gZenGlanceManager.openGlanceForBookmark.bind(gZenGlanceManager));
}
}
@@ -2235,7 +2238,7 @@ this.PlacesPanelview = class PlacesPanelview extends PlacesViewBase {
PlacesUIUtils.guessUrlSchemeForUI(placesNode.uri)
);
element.setAttribute("label", PlacesUIUtils.getBestTitle(placesNode));
-
+ element.addEventListener("command", gZenGlanceManager.openGlanceForBookmark.bind(gZenGlanceManager));
let icon = placesNode.icon;
if (icon) {
element.setAttribute("image", icon);

View File

@@ -1099,5 +1099,10 @@ Preferences.addAll([
id: "zen.view.compact.color-sidebar",
type: "bool",
default: true,
},
{
id: "zen.essentials.enabled",
type: "bool",
default: true,
}
]);