2024-01-19 18:03:20 +01:00
|
|
|
export const shortcutEvents: Record<string, { l18n: string; l18nParam?: string | number; context?: 'tab' }> = {
|
2023-08-03 18:28:50 +02:00
|
|
|
'run-or-reload': { l18n: 'application.runOrReload', context: 'tab' },
|
|
|
|
'open-new-tab': { l18n: 'application.openNewTab', context: 'tab' },
|
|
|
|
'close-tab': { l18n: 'application.closeTab', context: 'tab' },
|
|
|
|
'format-query': { l18n: 'database.formatQuery', context: 'tab' },
|
|
|
|
'kill-query': { l18n: 'database.killQuery', context: 'tab' },
|
|
|
|
'query-history': { l18n: 'database.queryHistory', context: 'tab' },
|
|
|
|
'clear-query': { l18n: 'database.clearQuery', context: 'tab' },
|
2024-04-06 09:33:01 +02:00
|
|
|
// 'save-file': { l18n: 'application.saveFile', context: 'tab' },
|
|
|
|
'open-file': { l18n: 'application.openFile', context: 'tab' },
|
|
|
|
'save-file-as': { l18n: 'application.saveFileAs', context: 'tab' },
|
2023-08-03 18:28:50 +02:00
|
|
|
'next-tab': { l18n: 'application.nextTab' },
|
|
|
|
'prev-tab': { l18n: 'application.previousTab' },
|
|
|
|
'open-all-connections': { l18n: 'application.openAllConnections' },
|
|
|
|
'open-filter': { l18n: 'application.openFilter' },
|
|
|
|
'next-page': { l18n: 'application.nextResultsPage' },
|
|
|
|
'prev-page': { l18n: 'application.previousResultsPage' },
|
|
|
|
'toggle-console': { l18n: 'application.toggleConsole' },
|
|
|
|
'save-content': { l18n: 'application.saveContent' },
|
|
|
|
'create-connection': { l18n: 'connection.createNewConnection' },
|
|
|
|
'open-settings': { l18n: 'application.openSettings' },
|
|
|
|
'open-scratchpad': { l18n: 'application.openScratchpad' }
|
2022-08-10 17:59:59 +02:00
|
|
|
};
|
|
|
|
|
2022-07-13 18:25:42 +02:00
|
|
|
interface ShortcutRecord {
|
|
|
|
event: string;
|
2022-08-16 13:10:20 +02:00
|
|
|
keys: Electron.Accelerator[] | string[];
|
2022-08-10 17:59:59 +02:00
|
|
|
/** Needed for default shortcuts */
|
2022-07-21 11:01:10 +02:00
|
|
|
os: NodeJS.Platform[];
|
2022-07-13 18:25:42 +02:00
|
|
|
}
|
|
|
|
|
2022-08-10 17:59:59 +02:00
|
|
|
/**
|
|
|
|
* Default shortcuts
|
|
|
|
*/
|
2022-07-14 19:30:34 +02:00
|
|
|
const shortcuts: ShortcutRecord[] = [
|
2022-08-16 13:10:20 +02:00
|
|
|
{
|
|
|
|
event: 'run-or-reload',
|
|
|
|
keys: ['F5'],
|
|
|
|
os: ['darwin', 'linux', 'win32']
|
|
|
|
},
|
|
|
|
{
|
|
|
|
event: 'save-content',
|
|
|
|
keys: ['CommandOrControl+S'],
|
|
|
|
os: ['darwin', 'linux', 'win32']
|
|
|
|
},
|
2022-08-16 18:03:38 +02:00
|
|
|
{
|
|
|
|
event: 'kill-query',
|
|
|
|
keys: ['CommandOrControl+K'],
|
|
|
|
os: ['darwin', 'linux', 'win32']
|
|
|
|
},
|
|
|
|
{
|
|
|
|
event: 'format-query',
|
|
|
|
keys: ['CommandOrControl+B'],
|
|
|
|
os: ['darwin', 'linux', 'win32']
|
|
|
|
},
|
|
|
|
{
|
|
|
|
event: 'clear-query',
|
|
|
|
keys: ['CommandOrControl+Alt+W'],
|
|
|
|
os: ['darwin', 'linux', 'win32']
|
|
|
|
},
|
|
|
|
{
|
|
|
|
event: 'query-history',
|
|
|
|
keys: ['CommandOrControl+G'],
|
|
|
|
os: ['darwin', 'linux', 'win32']
|
|
|
|
},
|
2022-07-14 19:30:34 +02:00
|
|
|
{
|
|
|
|
event: 'open-new-tab',
|
|
|
|
keys: ['CommandOrControl+T'],
|
2022-07-21 11:01:10 +02:00
|
|
|
os: ['darwin', 'linux', 'win32']
|
2022-07-14 19:30:34 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
event: 'close-tab',
|
|
|
|
keys: ['CommandOrControl+W'],
|
2022-07-21 11:01:10 +02:00
|
|
|
os: ['darwin', 'linux', 'win32']
|
2022-07-14 19:30:34 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
event: 'next-tab',
|
2022-08-09 16:10:08 +02:00
|
|
|
keys: ['Alt+CommandOrControl+Right'],
|
2022-07-21 11:01:10 +02:00
|
|
|
os: ['darwin', 'win32']
|
2022-07-14 19:30:34 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
event: 'prev-tab',
|
2022-08-09 16:10:08 +02:00
|
|
|
keys: ['Alt+CommandOrControl+Left'],
|
2022-07-21 11:01:10 +02:00
|
|
|
os: ['darwin', 'win32']
|
|
|
|
},
|
|
|
|
{
|
|
|
|
event: 'next-tab',
|
|
|
|
keys: ['CommandOrControl+PageDown'],
|
2022-08-09 16:10:08 +02:00
|
|
|
os: ['linux', 'win32']
|
2022-07-21 11:01:10 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
event: 'prev-tab',
|
|
|
|
keys: ['CommandOrControl+PageUp'],
|
2022-08-09 16:10:08 +02:00
|
|
|
os: ['linux', 'win32']
|
2022-07-14 19:30:34 +02:00
|
|
|
},
|
2022-08-17 10:00:23 +02:00
|
|
|
{
|
|
|
|
event: 'open-filter',
|
|
|
|
keys: ['CommandOrControl+F'],
|
|
|
|
os: ['darwin', 'linux', 'win32']
|
|
|
|
},
|
|
|
|
{
|
|
|
|
event: 'next-page',
|
|
|
|
keys: ['CommandOrControl+Right'],
|
|
|
|
os: ['darwin', 'linux', 'win32']
|
|
|
|
},
|
|
|
|
{
|
|
|
|
event: 'prev-page',
|
|
|
|
keys: ['CommandOrControl+Left'],
|
|
|
|
os: ['darwin', 'linux', 'win32']
|
|
|
|
},
|
2022-07-13 18:25:42 +02:00
|
|
|
{
|
2022-08-16 13:10:20 +02:00
|
|
|
event: 'open-all-connections',
|
2022-07-14 19:30:34 +02:00
|
|
|
keys: ['Shift+CommandOrControl+Space'],
|
2022-07-21 11:01:10 +02:00
|
|
|
os: ['darwin', 'linux', 'win32']
|
2022-07-16 12:01:37 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
event: 'toggle-console',
|
2022-08-09 16:10:08 +02:00
|
|
|
keys: ['CommandOrControl+F12'],
|
|
|
|
os: ['darwin', 'linux', 'win32']
|
|
|
|
},
|
|
|
|
{
|
|
|
|
event: 'toggle-console',
|
|
|
|
keys: ['CommandOrControl+`'],
|
2022-07-21 11:01:10 +02:00
|
|
|
os: ['darwin', 'linux', 'win32']
|
2024-04-06 09:33:01 +02:00
|
|
|
},
|
|
|
|
// {
|
|
|
|
// event: 'save-file',
|
|
|
|
// keys: ['CommandOrControl+S'],
|
|
|
|
// os: ['darwin', 'linux', 'win32']
|
|
|
|
// },
|
|
|
|
{
|
|
|
|
event: 'open-file',
|
|
|
|
keys: ['CommandOrControl+O'],
|
|
|
|
os: ['darwin', 'linux', 'win32']
|
|
|
|
},
|
|
|
|
{
|
|
|
|
event: 'save-file-as',
|
|
|
|
keys: ['Shift+CommandOrControl+S'],
|
|
|
|
os: ['darwin', 'linux', 'win32']
|
2022-07-13 18:25:42 +02:00
|
|
|
}
|
|
|
|
];
|
2022-07-14 19:30:34 +02:00
|
|
|
|
|
|
|
for (let i = 1; i <= 9; i++) {
|
2022-08-10 17:59:59 +02:00
|
|
|
shortcutEvents[`select-tab-${i}`] = {
|
2023-08-03 18:28:50 +02:00
|
|
|
l18n: 'application.selectTabNumber',
|
2022-08-10 17:59:59 +02:00
|
|
|
l18nParam: i
|
|
|
|
};
|
|
|
|
|
|
|
|
shortcuts.push({
|
|
|
|
event: `select-tab-${i}`,
|
|
|
|
keys: [`CommandOrControl+${i}`],
|
|
|
|
os: ['darwin', 'linux', 'win32']
|
|
|
|
});
|
2022-07-14 19:30:34 +02:00
|
|
|
}
|
|
|
|
|
2023-08-18 15:57:31 +02:00
|
|
|
export { ShortcutRecord, shortcuts };
|