From d850d774c03d2bf6d6977ad15b6addc8b79cbe05 Mon Sep 17 00:00:00 2001 From: Gunir <134402102+gunir@users.noreply.github.com> Date: Tue, 29 Oct 2024 18:07:51 +0700 Subject: [PATCH 1/4] Update ZenKeyboardShortcuts.mjs --- src/ZenKeyboardShortcuts.mjs | 57 ++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/src/ZenKeyboardShortcuts.mjs b/src/ZenKeyboardShortcuts.mjs index 2655ddd..ddb213f 100644 --- a/src/ZenKeyboardShortcuts.mjs +++ b/src/ZenKeyboardShortcuts.mjs @@ -567,6 +567,20 @@ function zenGetDefaultShortcuts() { newShortcutList.push(parsed); } + // Explain: How to add shortcuts + /* + newShortcutList.push( + new KeyShortcut( + 'ID_OF_SHORTCUT', + 'KEYCODE', + '', + GROUP_OF_SHORTCUT, + KeyShortcutModifiers.fromObject({ accel: true, alt: true }), //accel = Ctrl/Cmd, Alt = Alt/Option + 'code:NATIVE_CODE_FUNCTION()', + 'L10N_STRING_FOR_TRANSLATION' + ) + ); + */ // Compact mode's keyset newShortcutList.push( new KeyShortcut( @@ -709,6 +723,49 @@ function zenGetDefaultShortcuts() { ) ); + // Added by gunir + // Prev Tab Ctrl+Left + newShortcutList.push( + new KeyShortcut( + 'zen-previous-tab', + 'VK_LEFT', + '', + ZEN_OTHER_SHORTCUTS_GROUP, + KeyShortcutModifiers.fromObject({ accel: true }), + "code:gBrowser.tabContainer.advanceSelectedTab(-1, true);", + 'zen-shortcut-previous-tab' + ) + ); + // Next Tab Ctrl+Right + newShortcutList.push( + new KeyShortcut( + 'zen-next-tab', + 'VK_RIGHT', + '', + ZEN_OTHER_SHORTCUTS_GROUP, + KeyShortcutModifiers.fromObject({ accel: true }), + "code:gBrowser.tabContainer.advanceSelectedTab(1, true);", + 'zen-shortcut-next-tab' + ) + ); + // Open Settings + newShortcutList.push( + new KeyShortcut( + 'zen-next-tab', + ',', + '', + ZEN_OTHER_SHORTCUTS_GROUP, + KeyShortcutModifiers.fromObject({ accel: true }), + "code:gBrowser.tabContainer.advanceSelectedTab(1, true);", + 'zen-shortcut-next-tab' + ) + ); + + + + + + return newShortcutList; } From e42847a6c302c5f4410d044e290db74925283d4d Mon Sep 17 00:00:00 2001 From: Gunir <134402102+gunir@users.noreply.github.com> Date: Tue, 29 Oct 2024 18:20:16 +0700 Subject: [PATCH 2/4] Update ZenKeyboardShortcuts.mjs --- src/ZenKeyboardShortcuts.mjs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/ZenKeyboardShortcuts.mjs b/src/ZenKeyboardShortcuts.mjs index ddb213f..dd91461 100644 --- a/src/ZenKeyboardShortcuts.mjs +++ b/src/ZenKeyboardShortcuts.mjs @@ -751,13 +751,25 @@ function zenGetDefaultShortcuts() { // Open Settings newShortcutList.push( new KeyShortcut( - 'zen-next-tab', + 'zen-open-settings', ',', '', ZEN_OTHER_SHORTCUTS_GROUP, KeyShortcutModifiers.fromObject({ accel: true }), - "code:gBrowser.tabContainer.advanceSelectedTab(1, true);", - 'zen-shortcut-next-tab' + "code:openPreferences(undefined);", + 'zen-shortcut-open-settings' + ) + ); + // Open CKS Settings + newShortcutList.push( + new KeyShortcut( + 'zen-cks-settings', + '/', + '', + ZEN_OTHER_SHORTCUTS_GROUP, + KeyShortcutModifiers.fromObject({ accel: true }), + "code:openPreferences('paneZenCKS');", + 'zen-shortcut-cks-settings' ) ); From 9e06101fe3cd5ca390b1e3593ae84b430957deac Mon Sep 17 00:00:00 2001 From: Gunir <134402102+gunir@users.noreply.github.com> Date: Tue, 29 Oct 2024 18:52:20 +0700 Subject: [PATCH 3/4] Update ZenKeyboardShortcuts.mjs --- src/ZenKeyboardShortcuts.mjs | 75 ++++++++++++------------------------ 1 file changed, 24 insertions(+), 51 deletions(-) diff --git a/src/ZenKeyboardShortcuts.mjs b/src/ZenKeyboardShortcuts.mjs index dd91461..294f1a6 100644 --- a/src/ZenKeyboardShortcuts.mjs +++ b/src/ZenKeyboardShortcuts.mjs @@ -723,56 +723,6 @@ function zenGetDefaultShortcuts() { ) ); - // Added by gunir - // Prev Tab Ctrl+Left - newShortcutList.push( - new KeyShortcut( - 'zen-previous-tab', - 'VK_LEFT', - '', - ZEN_OTHER_SHORTCUTS_GROUP, - KeyShortcutModifiers.fromObject({ accel: true }), - "code:gBrowser.tabContainer.advanceSelectedTab(-1, true);", - 'zen-shortcut-previous-tab' - ) - ); - // Next Tab Ctrl+Right - newShortcutList.push( - new KeyShortcut( - 'zen-next-tab', - 'VK_RIGHT', - '', - ZEN_OTHER_SHORTCUTS_GROUP, - KeyShortcutModifiers.fromObject({ accel: true }), - "code:gBrowser.tabContainer.advanceSelectedTab(1, true);", - 'zen-shortcut-next-tab' - ) - ); - // Open Settings - newShortcutList.push( - new KeyShortcut( - 'zen-open-settings', - ',', - '', - ZEN_OTHER_SHORTCUTS_GROUP, - KeyShortcutModifiers.fromObject({ accel: true }), - "code:openPreferences(undefined);", - 'zen-shortcut-open-settings' - ) - ); - // Open CKS Settings - newShortcutList.push( - new KeyShortcut( - 'zen-cks-settings', - '/', - '', - ZEN_OTHER_SHORTCUTS_GROUP, - KeyShortcutModifiers.fromObject({ accel: true }), - "code:openPreferences('paneZenCKS');", - 'zen-shortcut-cks-settings' - ) - ); - @@ -782,7 +732,7 @@ function zenGetDefaultShortcuts() { } class ZenKeyboardShortcutsVersioner { - static LATEST_KBS_VERSION = 3; + static LATEST_KBS_VERSION = 4; constructor() {} @@ -881,6 +831,29 @@ class ZenKeyboardShortcutsVersioner { } } } + data.push( + // Added by gunir + // Prev Tab Ctrl+Left + new KeyShortcut( + 'zen-previous-tab', + 'VK_LEFT', + '', + ZEN_OTHER_SHORTCUTS_GROUP, + KeyShortcutModifiers.fromObject({ accel: true }), + "code:gBrowser.tabContainer.advanceSelectedTab(-1, true);", + 'zen-shortcut-previous-tab' + ), + // Next Tab Ctrl+Right + new KeyShortcut( + 'zen-next-tab', + 'VK_RIGHT', + '', + ZEN_OTHER_SHORTCUTS_GROUP, + KeyShortcutModifiers.fromObject({ accel: true }), + "code:gBrowser.tabContainer.advanceSelectedTab(1, true);", + 'zen-shortcut-next-tab' + ) + ); return data; } } From 809560eaa346c3244924a926bde88be980a67caf Mon Sep 17 00:00:00 2001 From: Gunir <134402102+gunir@users.noreply.github.com> Date: Tue, 29 Oct 2024 18:54:17 +0700 Subject: [PATCH 4/4] Update ZenKeyboardShortcuts.mjs --- src/ZenKeyboardShortcuts.mjs | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/ZenKeyboardShortcuts.mjs b/src/ZenKeyboardShortcuts.mjs index 294f1a6..79e095d 100644 --- a/src/ZenKeyboardShortcuts.mjs +++ b/src/ZenKeyboardShortcuts.mjs @@ -567,20 +567,6 @@ function zenGetDefaultShortcuts() { newShortcutList.push(parsed); } - // Explain: How to add shortcuts - /* - newShortcutList.push( - new KeyShortcut( - 'ID_OF_SHORTCUT', - 'KEYCODE', - '', - GROUP_OF_SHORTCUT, - KeyShortcutModifiers.fromObject({ accel: true, alt: true }), //accel = Ctrl/Cmd, Alt = Alt/Option - 'code:NATIVE_CODE_FUNCTION()', - 'L10N_STRING_FOR_TRANSLATION' - ) - ); - */ // Compact mode's keyset newShortcutList.push( new KeyShortcut( @@ -787,6 +773,18 @@ class ZenKeyboardShortcutsVersioner { } migrate(data, version) { + // Explain: How to add shortcuts + /* + new KeyShortcut( + 'ID_OF_SHORTCUT', + 'KEYCODE', + '', + GROUP_OF_SHORTCUT, + KeyShortcutModifiers.fromObject({ accel: true, alt: true }), //accel = Ctrl/Cmd, Alt = Alt/Option + 'code:NATIVE_CODE_FUNCTION()', + 'L10N_STRING_FOR_TRANSLATION' + ) + */ if (version < 1) { // Migrate from 0 to 1 // Here, we do a complet reset of the shortcuts,