MCPcopy Index your code
hub / github.com/coder/mux / focusMainWindow

Method focusMainWindow

src/node/services/windowService.ts:43–77  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

41 }
42
43 focusMainWindow(): void {
44 const mainWindow = this.mainWindow;
45 if (!mainWindow) {
46 return;
47 }
48
49 const isDestroyed =
50 typeof (mainWindow as { isDestroyed?: () => boolean }).isDestroyed === "function"
51 ? (mainWindow as { isDestroyed: () => boolean }).isDestroyed()
52 : false;
53
54 if (isDestroyed) {
55 return;
56 }
57
58 try {
59 if (
60 typeof (mainWindow as { isMinimized?: () => boolean }).isMinimized === "function" &&
61 (mainWindow as { isMinimized: () => boolean }).isMinimized() &&
62 typeof (mainWindow as { restore?: () => void }).restore === "function"
63 ) {
64 (mainWindow as { restore: () => void }).restore();
65 }
66
67 if (typeof (mainWindow as { show?: () => void }).show === "function") {
68 (mainWindow as { show: () => void }).show();
69 }
70
71 if (typeof (mainWindow as { focus?: () => void }).focus === "function") {
72 (mainWindow as { focus: () => void }).focus();
73 }
74 } catch (error) {
75 log.debug("WindowService: focusMainWindow failed", error);
76 }
77 }
78
79 send(channel: string, ...args: unknown[]): void {
80 const isDestroyed =

Callers 6

pollDeviceFlowMethod · 0.80
pollForTokenMethod · 0.80

Calls 1

debugMethod · 0.80

Tested by

no test coverage detected