2022-08-10 17:59:59 +02:00
|
|
|
import { ShortcutRecord } from 'common/shortcuts';
|
2022-06-05 17:57:44 +02:00
|
|
|
import { ipcRenderer, OpenDialogOptions, OpenDialogReturnValue } from 'electron';
|
2023-08-18 15:57:31 +02:00
|
|
|
|
2022-06-05 17:57:44 +02:00
|
|
|
import { unproxify } from '../libs/unproxify';
|
|
|
|
|
|
|
|
export default class {
|
|
|
|
static showOpenDialog (options: OpenDialogOptions): Promise<OpenDialogReturnValue> {
|
|
|
|
return ipcRenderer.invoke('show-open-dialog', unproxify(options));
|
|
|
|
}
|
|
|
|
|
2024-04-06 09:34:42 +02:00
|
|
|
static showSaveDialog (options: OpenDialogOptions): Promise<OpenDialogReturnValue> {
|
|
|
|
return ipcRenderer.invoke('show-save-dialog', unproxify(options));
|
|
|
|
}
|
|
|
|
|
2022-06-05 17:57:44 +02:00
|
|
|
static getDownloadPathDirectory (): Promise<string> {
|
|
|
|
return ipcRenderer.invoke('get-download-dir-path');
|
|
|
|
}
|
2022-08-10 17:59:59 +02:00
|
|
|
|
|
|
|
static reloadShortcuts () {
|
|
|
|
return ipcRenderer.invoke('reload-shortcuts');
|
|
|
|
}
|
|
|
|
|
|
|
|
static updateShortcuts (shortcuts: ShortcutRecord[]) {
|
|
|
|
return ipcRenderer.invoke('update-shortcuts', unproxify(shortcuts));
|
|
|
|
}
|
|
|
|
|
|
|
|
static restoreDefaultShortcuts () {
|
|
|
|
return ipcRenderer.invoke('resotre-default-shortcuts');
|
|
|
|
}
|
|
|
|
|
|
|
|
static unregisterShortcuts () {
|
|
|
|
return ipcRenderer.invoke('unregister-shortcuts');
|
|
|
|
}
|
2024-04-06 09:34:42 +02:00
|
|
|
|
|
|
|
static readFile (path: string): Promise<string> {
|
|
|
|
return ipcRenderer.invoke('read-file', path);
|
|
|
|
}
|
|
|
|
|
2024-04-08 18:29:05 +02:00
|
|
|
static writeFile (path: string, content: unknown) {
|
2024-04-06 09:34:42 +02:00
|
|
|
return ipcRenderer.invoke('write-file', path, content);
|
|
|
|
}
|
2022-06-05 17:57:44 +02:00
|
|
|
}
|