chore: Enable keyboard shortcuts in Zen browser settings

This commit is contained in:
Mauro Balades
2024-08-09 16:28:06 +02:00
parent ab0e82790b
commit be8a7ef6a4
6 changed files with 37 additions and 9 deletions

View File

@@ -62,6 +62,28 @@ var gZenCKSSettings = {
this._currentAction = null;
this._initializeEvents();
this._initializeCKS();
this._addPrefObservers();
},
_addPrefObservers() {
Services.prefs.addObserver("zen.keyboard.shortcuts.disable-firefox", this.onDisableFirefoxShortcutsChange.bind(this));
},
async onDisableFirefoxShortcutsChange(event) {
let checked = Services.prefs.getBoolPref("zen.keyboard.shortcuts.disable-firefox");
if (checked) return;
let buttonIndex = await confirmRestartPrompt(
true,
1,
true,
false
);
if (buttonIndex == CONFIRM_RESTART_PROMPT_RESTART_NOW) {
Services.startup.quit(
Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestart
);
return;
}
},
_initializeCKS() {
@@ -228,5 +250,10 @@ Preferences.addAll([
id: "zen.theme.floating-urlbar",
type: "bool",
default: false,
},
{
id: "zen.keyboard.shortcuts.disable-firefox",
type: "bool",
default: false,
}
]);

View File

@@ -7,16 +7,14 @@
<html:h1 data-l10n-id="pane-zen-CKS-title"/>
</hbox>
<hbox id="zenCKSCategory"
class="subcategory"
hidden="true"
data-category="paneZenCKS">
</hbox>
<groupbox id="zenCKSGroup" data-category="paneZenCKS" hidden="true" class="highlighting-group">
<label><html:h2 data-l10n-id="zen-settings-CKS-header"/></label>
<description class="description-deemphasized" data-l10n-id="zen-settings-CKS-description" />
<vbox class="indent">
<checkbox id="zenKSCDisableFirefoxShortcuts"
data-l10n-id="zen-settings-CKS-disable-firefox"
preference="zen.keyboard.shortcuts.disable-firefox" />
</vbox>
<vbox id="zenCKSOptions-wrapper"></vbox>
</groupbox>