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

@@ -72,6 +72,7 @@ pref('zen.view.sidebar-expanded', false);
pref('zen.view.sidebar-expanded.show-button', true);
pref('zen.view.sidebar-expanded.max-width', 400);
pref('zen.keyboard.shortcuts', "{}");
pref('zen.keyboard.shortcuts.disable-firefox', false);
// Pref to enable the new profiles (TODO: Check this out!)
//pref("browser.profiles.enabled", true);

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>

View File

@@ -68,6 +68,8 @@ pane-settings-CKS-title = { -brand-short-name } Keyboard Shortcuts
zen-settings-CKS-header = Customize your keyboard shortcuts
zen-settings-CKS-description = Change the default keyboard shortcuts to your liking and improve your browsing experience
zen-settings-CKS-disable-firefox =
.label = Disable { -brand-short-name }'s default keyboard shortcuts
zen-cks-group-tab-action = Tab Actions
zen-cks-group-page-action = Page Actions

View File

@@ -200,7 +200,7 @@ groupbox h2 {
/* CKS */
#category-zen-CKS > .category-icon {
list-style-image: url("chrome://browser/skin/save.svg");
list-style-image: url("chrome://browser/skin/quickactions.svg");
}
.zenCKSOption-input {