()
| 22 | } |
| 23 | |
| 24 | private setupIPC(): void { |
| 25 | // 基础工具 |
| 26 | ipcMain.handle('open-external', (_event, url: string) => this.openExternal(url)) |
| 27 | ipcMain.handle('copy-to-clipboard', (_event, text: string) => this.copyToClipboard(text)) |
| 28 | |
| 29 | // 系统集成 |
| 30 | ipcMain.handle('open-terminal', (_event, path: string) => this.openTerminal(path)) |
| 31 | ipcMain.handle('get-finder-path', () => this.getFinderPath()) |
| 32 | ipcMain.handle('get-last-copied-content', (_event, timeLimit?: number) => |
| 33 | this.getLastCopiedContent(timeLimit) |
| 34 | ) |
| 35 | ipcMain.handle('get-frontmost-app', () => this.getFrontmostApp()) |
| 36 | ipcMain.handle('activate-app', (_event, identifier: string, type?: string) => |
| 37 | this.activateApp(identifier, type) |
| 38 | ) |
| 39 | ipcMain.handle('reveal-in-finder', (_event, filePath: string) => this.revealInFinder(filePath)) |
| 40 | ipcMain.handle('check-file-paths', (_event, paths: string[]) => this.checkFilePaths(paths)) |
| 41 | |
| 42 | // UI |
| 43 | ipcMain.handle('show-context-menu', (event, menuItems) => |
| 44 | this.showContextMenu(event, menuItems) |
| 45 | ) |
| 46 | ipcMain.handle('select-avatar', () => this.selectAvatar()) |
| 47 | |
| 48 | // App Info |
| 49 | ipcMain.handle('get-app-version', () => app.getVersion()) |
| 50 | ipcMain.handle('get-app-name', () => app.getName()) |
| 51 | ipcMain.handle('get-system-versions', () => process.versions) |
| 52 | ipcMain.on('get-platform', (event) => { |
| 53 | event.returnValue = process.platform |
| 54 | }) |
| 55 | ipcMain.handle('is-windows11', () => isWindows11()) |
| 56 | } |
| 57 | |
| 58 | private async openExternal(url: string): Promise<void> { |
| 59 | try { |
no test coverage detected