diff --git a/src/components/UI/Keymaps.tsx b/src/components/UI/Keymaps.tsx index bd0efb9..53b6ea8 100644 --- a/src/components/UI/Keymaps.tsx +++ b/src/components/UI/Keymaps.tsx @@ -3,8 +3,8 @@ import { For } from 'solid-js'; const keymaps = [ { action: 'Help', keys: ['F1'] }, { action: 'Execute query', keys: ['Ctrl', 'E/Enter'] }, - { action: 'Select tab', keys: ['Ctrl/Cmd', 'number'] }, - { action: 'Select connection tab', keys: ['Ctrl/Cmd', 'Shift', 'number'] }, + { action: 'Select tab', keys: ['Alt/Cmd', 'number'] }, + { action: 'Select connection tab', keys: ['Ctrl/Cmd', 'number'] }, { action: 'New tab', keys: ['Ctrl/Cmd', 'T'] }, { action: 'Close current tab', keys: ['Ctrl/Cmd', 'W'] }, { action: 'Focus on editor', keys: ['Ctrl', 'L'] }, diff --git a/src/services/RegisterKeymaps.tsx b/src/services/RegisterKeymaps.tsx index d00547f..0f0bf65 100644 --- a/src/services/RegisterKeymaps.tsx +++ b/src/services/RegisterKeymaps.tsx @@ -20,6 +20,21 @@ export const RegisterKeymaps = (props: { children: JSXElement; osType: OsType }) const CmdOrCtrl = isMac ? 'Meta' : 'Control'; setAppStore({ osType: props.osType }); + if (isMac) { + for (let i = 1; i <= 9; i++) { + createShortcut(['Meta', String(i)], () => { + setContentIdx(i - 1); + }); + } + } else { + for (let i = 1; i <= 9; i++) { + createShortcut(['Alt', String(i)], () => { + setContentIdx(i - 1); + }); + } + } + + createShortcut(['F1'], () => { setComponent((s) => (s === 1 ? 0 : 1)); }); @@ -41,15 +56,10 @@ export const RegisterKeymaps = (props: { children: JSXElement; osType: OsType }) }); for (let i = 1; i <= 9; i++) { - createShortcut([CmdOrCtrl, String(i)], () => { - setContentIdx(i - 1); - }); - } - - for (let i = 1; i <= 9; i++) { - createShortcut([CmdOrCtrl, 'Shift', String(i)], () => { + createShortcut(['Control', String(i)], () => { setConnectionIdx(i - 1); }); } + return props.children; };