Alt+Shift+Space shortcut to toggle restrictions enforcement for current tab (issue #129, thanks PF4Public for RFE).

This commit is contained in:
hackademix 2023-02-04 21:42:40 +01:00
parent 5a9a235fa9
commit 996ec4b3bc
No known key found for this signature in database
GPG Key ID: 231A83AFDA9C2434
3 changed files with 19 additions and 6 deletions

View File

@ -176,6 +176,9 @@
"EnforceForTab": {
"message": "Enable restrictions for this tab"
},
"toggleEnforcementForTab": {
"message": "Toggle restrictions enforcement for current tab"
},
"HighContrast": {
"message": "High contrast"
},

View File

@ -111,9 +111,19 @@
}
},
togglePermissions() {},
install() {
if ("command" in browser) {
async toggleEnforcementForTab() {
let [tab] = (await browser.tabs.query({
currentWindow: true,
active: true
}));
if (tab) {
let toggle = ns.unrestrictedTabs.has(tab.id) ? "delete" : "add";
ns.unrestrictedTabs[toggle](tab.id);
browser.tabs.reload(tab.id);
}
},
async install() {
if ("commands" in browser) {
// keyboard shortcuts
browser.commands.onCommand.addListener(cmd => {
if (cmd in Commands) {

View File

@ -144,10 +144,10 @@
"default": "Alt+Shift+N"
}
},
"togglePermissions": {
"description": "Toggle permissions",
"toggleEnforcementForTab": {
"description": "__MSG_toggleEnforcementForTab__",
"suggested_key": {
"default": "Ctrl+Shift+T"
"default": "Alt+Shift+Space"
}
}
}