Merge pull request #2758 from apostrophest/remove-sort-tabs-suggested-key
Remove suggested key for `sort_tabs`
This commit is contained in:
commit
9434147b48
2 changed files with 30 additions and 5 deletions
|
@ -35,10 +35,39 @@ const backgroundLogic = {
|
|||
browser.permissions.onRemoved.addListener(permissions => this.resetPermissions(permissions));
|
||||
|
||||
// Update Translation in Manifest
|
||||
browser.runtime.onInstalled.addListener(this.updateTranslationInManifest);
|
||||
browser.runtime.onInstalled.addListener((details) => {
|
||||
this.updateTranslationInManifest();
|
||||
this._undoDefault820SortTabsKeyboardShortcut(details);
|
||||
});
|
||||
browser.runtime.onStartup.addListener(this.updateTranslationInManifest);
|
||||
},
|
||||
|
||||
/**
|
||||
* One-time migration after updating from v8.2.0:
|
||||
* Unset the default keyboard shortcut (Ctrl+Comma) for the `sort_tabs`
|
||||
* command if it was set in v8.2.0 of this addon. If the user remapped
|
||||
* a different shortcut manually, retain their shortcut. Users who used
|
||||
* the default keyboard shortcut will need to manually set a shortcut.
|
||||
* See https://support.mozilla.org/en-US/kb/manage-extension-shortcuts-firefox
|
||||
*
|
||||
* @param {{reason: runtime.OnInstalledReason, previousVersion?: string}} details
|
||||
*/
|
||||
async _undoDefault820SortTabsKeyboardShortcut(details) {
|
||||
if (details.reason === "update" && details.previousVersion === "8.2.0") {
|
||||
const commands = await browser.commands.getAll();
|
||||
const sortTabsCommand = commands.find(command => command.name === "sort_tabs");
|
||||
if (sortTabsCommand) {
|
||||
const previouslySuggestedKeys = [
|
||||
"Ctrl+Comma", // "default"
|
||||
"MacCtrl+Comma", // "mac"
|
||||
];
|
||||
if (previouslySuggestedKeys.includes(sortTabsCommand.shortcut)) {
|
||||
browser.commands.reset("sort_tabs");
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
updateTranslationInManifest() {
|
||||
for (let index = 0; index < 10; index++) {
|
||||
const ajustedIndex = index + 1; // We want to start from 1 instead of 0 in the UI.
|
||||
|
|
|
@ -45,10 +45,6 @@
|
|||
"description": "__MSG_openContainerPanel__"
|
||||
},
|
||||
"sort_tabs": {
|
||||
"suggested_key": {
|
||||
"default": "Ctrl+Comma",
|
||||
"mac": "MacCtrl+Comma"
|
||||
},
|
||||
"description": "__MSG_sortTabsByContainer__"
|
||||
},
|
||||
"open_container_0": {
|
||||
|
|
Loading…
Add table
Reference in a new issue