From b10313ac479b157e39e265f54679fd04c29d99e9 Mon Sep 17 00:00:00 2001 From: mauro-balades Date: Tue, 24 Sep 2024 21:20:48 +0200 Subject: [PATCH] Refactor ZenKeyboardShortcuts to fix platform-specific key behavior and add l10n support --- src/ZenKeyboardShortcuts.mjs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ZenKeyboardShortcuts.mjs b/src/ZenKeyboardShortcuts.mjs index fa90df3..fed31c3 100644 --- a/src/ZenKeyboardShortcuts.mjs +++ b/src/ZenKeyboardShortcuts.mjs @@ -173,7 +173,7 @@ class KeyShortcutModifiers { str += 'Shift+'; } if (this.#meta) { - str += AppConstants.platform == 'macosx' ? 'Cmd+' : 'Win+'; + str += AppConstants.platform == 'macosx' ? 'Meta+' : 'Win+'; } if (this.#accel) { if (AppConstants.platform == 'macosx') { @@ -346,7 +346,9 @@ class KeyShortcut { // shortcuts in mind, it will siply just override the shortcuts with whatever the default is. // note that this l10n id is not used for actually translating the key's label, but rather to // identify the default keybinds. - key.setAttribute('data-l10n-id', this.#l10nId); + if (this.#l10nId) { + key.setAttribute('data-l10n-id', this.#l10nId); + } key.setAttribute('modifiers', this.#modifiers.toString()); if (this.#action) { if (this.#action?.startsWith('code:')) {