mirror of
https://github.com/zen-browser/desktop.git
synced 2026-05-27 15:25:09 +00:00
no-bug: Add a New Boost urlbar action (gh-13884)
Signed-off-by: mr. m <91018726+mr-cheffy@users.noreply.github.com>
This commit is contained in:
@@ -81,6 +81,49 @@ const globalActionsTemplate = [
|
||||
return !tab.hasAttribute("zen-empty-tab") && tab.pinned;
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "New Boost",
|
||||
icon: "chrome://browser/skin/zen-icons/boost.svg",
|
||||
isAvailable: window => {
|
||||
if (!isNotEmptyTab(window)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Keep this action consistent with the rest of the Boosts UI.
|
||||
if (!Services.prefs.getBoolPref("zen.boosts.enabled", false)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const uri = window.gBrowser.currentURI;
|
||||
return !!uri?.schemeIs && (uri.schemeIs("http") || uri.schemeIs("https"));
|
||||
},
|
||||
command: window => {
|
||||
const uri = window.gBrowser.currentURI;
|
||||
if (!uri?.schemeIs || !(uri.schemeIs("http") || uri.schemeIs("https"))) {
|
||||
return;
|
||||
}
|
||||
|
||||
let domain = "";
|
||||
try {
|
||||
domain = uri.host;
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!domain) {
|
||||
return;
|
||||
}
|
||||
|
||||
const { gZenBoostsManager } = ChromeUtils.importESModule(
|
||||
"resource:///modules/zen/boosts/ZenBoostsManager.sys.mjs"
|
||||
);
|
||||
const boost = gZenBoostsManager.createNewBoost(domain);
|
||||
if (!boost) {
|
||||
return;
|
||||
}
|
||||
gZenBoostsManager.openBoostWindow(window, boost, uri);
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "Next Space",
|
||||
command: "cmd_zenWorkspaceForward",
|
||||
|
||||
Reference in New Issue
Block a user