From 2d62e7d9be20ab78cecff4e9553353d82133c8ae Mon Sep 17 00:00:00 2001 From: mauro-balades Date: Sun, 6 Oct 2024 14:03:17 +0200 Subject: [PATCH] Tried to fix macos shortcuts --- src/ZenKeyboardShortcuts.mjs | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/ZenKeyboardShortcuts.mjs b/src/ZenKeyboardShortcuts.mjs index fc8821c..e54990e 100644 --- a/src/ZenKeyboardShortcuts.mjs +++ b/src/ZenKeyboardShortcuts.mjs @@ -378,9 +378,15 @@ class KeyShortcut { key.setAttribute('command', this.#action); } } - key.setAttribute('disabled', this.#disabled); - key.setAttribute('reserved', this.#reserved); - key.setAttribute('internal', this.#internal); + if (this.#disabled) { + key.setAttribute('disabled', this.#disabled); + } + if (this.#reserved) { + key.setAttribute('reserved', this.#reserved); + } + if (this.#internal) { + key.setAttribute('internal', this.#internal); + } key.setAttribute('zen-keybind', 'true'); return key; @@ -731,7 +737,9 @@ class ZenKeyboardShortcutsVersioner { return newData; } - throw new Error('Unknown keyboar shortcuts version'); + console.error('Unknown keyboar shortcuts version'); + this.version = 0; + return this.migrateIfNeeded(data); } migrate(data, version) { @@ -888,3 +896,7 @@ var gZenKeyboardShortcutsManager = { return false; }, }; + +window.addEventListener("MozBeforeInitialXULLayout", async () => { + await gZenKeyboardShortcutsManager.init(); +}); \ No newline at end of file