From bdb06a1b15dcbad82a2aef9d70b73814f51b8069 Mon Sep 17 00:00:00 2001 From: Bauke Date: Sun, 20 Mar 2022 19:43:44 +0100 Subject: [PATCH] Add context menus to action button in Chromium. --- source/background-scripts/context-menus.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/background-scripts/context-menus.ts b/source/background-scripts/context-menus.ts index bf75481..8398085 100644 --- a/source/background-scripts/context-menus.ts +++ b/source/background-scripts/context-menus.ts @@ -4,6 +4,9 @@ import {Settings} from '../settings/settings.js'; import {updateBadge} from '../utilities/badge.js'; export async function initializeContextMenus(): Promise { + const actionContext = + import.meta.env.VITE_BROWSER === 'chromium' ? 'action' : 'browser_action'; + const contextMenus: browser.Menus.CreateCreatePropertiesType[] = [ { id: 'queue-add-new-link', @@ -13,12 +16,12 @@ export async function initializeContextMenus(): Promise { { id: 'queue-open-next-link-in-new-tab', title: 'Open next link in new tab', - contexts: ['browser_action'], + contexts: [actionContext], }, { id: 'queue-open-options-page', title: 'Open the extension page', - contexts: ['browser_action'], + contexts: [actionContext], }, ];