MCPcopy
hub / github.com/ZToolsCenter/ZTools / setupIPC

Method setupIPC

src/main/api/renderer/system.ts:24–56  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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 {

Callers 1

initMethod · 0.95

Calls 13

openExternalMethod · 0.95
copyToClipboardMethod · 0.95
openTerminalMethod · 0.95
getFinderPathMethod · 0.95
getLastCopiedContentMethod · 0.95
getFrontmostAppMethod · 0.95
activateAppMethod · 0.95
revealInFinderMethod · 0.95
checkFilePathsMethod · 0.95
showContextMenuMethod · 0.95
selectAvatarMethod · 0.95
isWindows11Function · 0.90

Tested by

no test coverage detected