Summary
Add a chrome.contextMenus entry so users can right-click on any page and switch profiles (or toggle a specific extension) without opening the popup.
Motivation
The popup is the only way to switch profiles today. For users on multiple monitors or with the extension icon hidden behind Chrome's "puzzle piece" pinning menu, opening the popup is 2 clicks + a small target. A right-click context menu on the page itself is a single fluent gesture and always available regardless of icon visibility.
Proposed change
Manifest additions:
"permissions": ["management", "storage", "contextMenus"]
In the service worker (js/migration.js or a new background.js):
chrome.runtime.onInstalled.addListener(rebuildMenu);
chrome.storage.onChanged.addListener((changes) => {
if (changes.profiles) rebuildMenu();
});
async function rebuildMenu() {
await chrome.contextMenus.removeAll();
chrome.contextMenus.create({
id: 'extensity-root',
title: 'Extensity',
contexts: ['page', 'action'],
});
const { profiles = {} } = await chrome.storage.sync.get('profiles');
for (const name of Object.keys(profiles)) {
chrome.contextMenus.create({
id: `switch:${name}`,
parentId: 'extensity-root',
title: `Switch to: ${name}`,
contexts: ['page', 'action'],
});
}
}
chrome.contextMenus.onClicked.addListener((info) => {
if (info.menuItemId.startsWith('switch:')) {
const name = info.menuItemId.slice('switch:'.length);
// reuse existing profile-apply logic
applyProfileByName(name);
}
});
contexts: ['action'] scopes an additional right-click on the toolbar icon itself — same menu, from the icon.
Additive, not overlapping
Notes
- Adds one new permission (
contextMenus). Chrome shows this on update; the copy in the permission dialog is minimal.
- MV3-compatible;
contextMenus API works from a service worker with the chrome.runtime.onInstalled bootstrap pattern shown above.
- Doesn't require polling —
chrome.storage.onChanged rebuilds the menu when the profile list changes.
Thanks for the great work on Extensity!
Summary
Add a
chrome.contextMenusentry so users can right-click on any page and switch profiles (or toggle a specific extension) without opening the popup.Motivation
The popup is the only way to switch profiles today. For users on multiple monitors or with the extension icon hidden behind Chrome's "puzzle piece" pinning menu, opening the popup is 2 clicks + a small target. A right-click context menu on the page itself is a single fluent gesture and always available regardless of icon visibility.
Proposed change
Manifest additions:
In the service worker (
js/migration.jsor a newbackground.js):contexts: ['action']scopes an additional right-click on the toolbar icon itself — same menu, from the icon.Additive, not overlapping
context menu,right-click,contextMenus— 0 hits).Notes
contextMenus). Chrome shows this on update; the copy in the permission dialog is minimal.contextMenusAPI works from a service worker with thechrome.runtime.onInstalledbootstrap pattern shown above.chrome.storage.onChangedrebuilds the menu when the profile list changes.Thanks for the great work on Extensity!