Use Ctrl-Alt bindings for Firefox

This commit is contained in:
Dima Gerasimov 2019-06-29 17:37:31 +01:00 committed by Dmitrii Gerasimov
parent 9e287aa8d7
commit 823b2a11de
3 changed files with 31 additions and 13 deletions

View file

@ -58,7 +58,11 @@ jobs:
# TODO preserve apt cache.. # TODO preserve apt cache..
- run: sudo apt install python3-pip - run: sudo apt install python3-pip
- run: python3 -m pip install --user mypy pylint pytest - run: python3 -m pip install --user mypy pylint pytest
- run: sudo apt install httpie # only used for tests
# test only dependencies
- run: sudo apt install httpie
- run: python3 -m pip install --user selenium pyautogui
#
- run: - run:
name: pylint name: pylint

View file

@ -17,18 +17,10 @@
}, },
"commands": { "commands": {
"capture-simple": { "capture-simple": {
"description": "Quick capture: url, title and selection", "description": "Quick capture: url, title and selection"
"suggested_key": {
"default": "Ctrl+Shift+C",
"mac": "Command+Shift+C"
}
}, },
"_execute_browser_action": { "_execute_browser_action": {
"description": "Capture page, with extra information", "description": "Capture page, with extra information"
"suggested_key": {
"default": "Ctrl+Shift+Y",
"mac": "Command+Shift+Y"
}
} }
}, },
"manifest_version": 2, "manifest_version": 2,

View file

@ -26,17 +26,39 @@ if (env.ANY_HOST) {
permissions.push("https://*/capture"); permissions.push("https://*/capture");
} }
// Firefox wouldn't let you rebind its default shortcuts most of which use Shift
// On the other hand, Chrome wouldn't let you use Alt
const modifier = target === 'chrome' ? 'Shift' : 'Alt';
// ugh. declarative formats are shit.
const commandsExtra = {
"capture-simple": {
"suggested_key": {
"default": `Ctrl+${modifier}+C`,
"mac": `Command+${modifier}+C`
}
},
"_execute_browser_action": {
"suggested_key": {
"default": `Ctrl+${modifier}+Y`,
"mac": `Command+${modifier}+Y`
}
},
};
const manifestExtra = { const manifestExtra = {
name: pkg_name, name: pkg_name,
version: pkg.version, version: pkg.version,
description: pkg.description, description: pkg.description,
permissions: permissions, permissions: permissions,
commands: commandsExtra,
}; };
if (target == 'chrome') { if (target === 'chrome') {
manifestExtra.options_ui = {chrome_style: true}; manifestExtra.options_ui = {chrome_style: true};
} }
if (target == 'firefox') { if (target === 'firefox') {
manifestExtra.options_ui = {browser_style: true}; manifestExtra.options_ui = {browser_style: true};
manifestExtra.browser_action = {browser_style: true}; manifestExtra.browser_action = {browser_style: true};
} }