Refactor ZenKeyboardShortcuts to include split view shortcuts

This commit is contained in:
mauro-balades 2024-09-23 19:55:39 +02:00
parent 72f6b8d513
commit c65b4aef13
2 changed files with 50 additions and 3 deletions

View file

@ -85,12 +85,13 @@ const fixedL10nIds = {
const ZEN_COMPACT_MODE_SHORTCUTS_GROUP = 'zen-compact-mode';
const ZEN_WORKSPACE_SHORTCUTS_GROUP = 'zen-workspace';
const ZEN_OTHER_SHORTCUTS_GROUP = 'zen-other';
const ZEN_SPLIT_VIEW_SHORTCUTS_GROUP = 'zen-split-view';
const FIREFOX_SHORTCUTS_GROUP = 'zen-kbs-invalid';
const VALID_SHORTCUT_GROUPS = [
ZEN_COMPACT_MODE_SHORTCUTS_GROUP,
ZEN_WORKSPACE_SHORTCUTS_GROUP,
ZEN_OTHER_SHORTCUTS_GROUP,
'other', ...Object.keys(defaultKeyboardGroups)
ZEN_SPLIT_VIEW_SHORTCUTS_GROUP,
...Object.keys(defaultKeyboardGroups), ZEN_OTHER_SHORTCUTS_GROUP, 'other'
];
class KeyShortcutModifiers {
@ -598,6 +599,52 @@ var gZenKeyboardShortcutsManager = {
)
);
// Split view
newShortcutList.push(
new KeyShortcut(
'zen-split-view-grid',
'G',
'',
ZEN_SPLIT_VIEW_SHORTCUTS_GROUP,
KeyShortcutModifiers.fromObject({ctrl: true, alt: true}),
'code:gZenViewSplitter.toggleShortcut(\'grid\')',
'zen-split-view-shortcut-grid'
)
);
newShortcutList.push(
new KeyShortcut(
'zen-split-view-vertical',
'V',
'',
ZEN_SPLIT_VIEW_SHORTCUTS_GROUP,
KeyShortcutModifiers.fromObject({ctrl: true, alt: true}),
'code:gZenViewSplitter.toggleShortcut(\'vsep\')',
'zen-split-view-shortcut-vertical'
)
);
newShortcutList.push(
new KeyShortcut(
'zen-split-view-horizontal',
'H',
'',
ZEN_SPLIT_VIEW_SHORTCUTS_GROUP,
KeyShortcutModifiers.fromObject({ctrl: true, alt: true}),
'code:gZenViewSplitter.toggleShortcut(\'hsep\')',
'zen-split-view-shortcut-horizontal'
)
);
newShortcutList.push(
new KeyShortcut(
'zen-split-view-unsplit',
'U',
'',
ZEN_SPLIT_VIEW_SHORTCUTS_GROUP,
KeyShortcutModifiers.fromObject({ctrl: true, alt: true}),
'code:gZenViewSplitter.toggleShortcut(\'unsplit\')',
'zen-split-view-shortcut-unsplit'
)
);
return newShortcutList;
},

View file

@ -10,7 +10,7 @@ var gZenBrowserManagerSidebar = {
contextTab: null,
DEFAULT_MOBILE_USER_AGENT: 'Mozilla/5.0 (Android 12; Mobile; rv:129.0) Gecko/20100101 Firefox/130.0',
MAX_SIDEBAR_PANELS: 8, // +1 for the add panel button
MAX_SIDEBAR_PANELS: 9, // +1 for the add panel button
MAX_RUNS: 3,
init() {