()
| 55 | private globalShortcutKeyboardStateReleasers = new Map<string, () => void>() |
| 56 | |
| 57 | private setupIPC(): void { |
| 58 | // 主题 |
| 59 | ipcMain.handle('set-theme', (_event, theme: string) => this.setTheme(theme)) |
| 60 | |
| 61 | // 开机启动 |
| 62 | ipcMain.handle('set-launch-at-login', (_event, enable: boolean) => |
| 63 | this.setLaunchAtLogin(enable) |
| 64 | ) |
| 65 | ipcMain.handle('get-launch-at-login', () => this.getLaunchAtLogin()) |
| 66 | |
| 67 | // 快捷键 |
| 68 | ipcMain.handle('update-shortcut', (_event, shortcut: string) => this.updateShortcut(shortcut)) |
| 69 | ipcMain.handle('get-current-shortcut', () => this.getCurrentShortcut()) |
| 70 | ipcMain.handle( |
| 71 | 'register-global-shortcut', |
| 72 | (_event, shortcut: string, target: string, autoCopy?: boolean) => |
| 73 | this.registerGlobalShortcut(shortcut, target, autoCopy ?? false) |
| 74 | ) |
| 75 | ipcMain.handle('unregister-global-shortcut', (_event, shortcut: string) => |
| 76 | this.unregisterGlobalShortcut(shortcut) |
| 77 | ) |
| 78 | ipcMain.handle( |
| 79 | 'update-global-shortcut-config', |
| 80 | (_event, shortcut: string, config: { autoCopy: boolean }) => |
| 81 | this.updateGlobalShortcutConfig(shortcut, config) |
| 82 | ) |
| 83 | |
| 84 | // 应用快捷键 |
| 85 | ipcMain.handle('register-app-shortcut', (_event, shortcut: string, target: string) => |
| 86 | this.registerAppShortcut(shortcut, target) |
| 87 | ) |
| 88 | ipcMain.handle('unregister-app-shortcut', (_event, shortcut: string) => |
| 89 | this.unregisterAppShortcut(shortcut) |
| 90 | ) |
| 91 | |
| 92 | // 临时快捷键录制 |
| 93 | ipcMain.handle('start-hotkey-recording', () => this.startHotkeyRecording()) |
| 94 | } |
| 95 | |
| 96 | // 加载并应用设置 |
| 97 | private async loadAndApplySettings(): Promise<void> { |
no test coverage detected