MCPcopy Index your code
hub / github.com/gitify-app/gitify / configureWindowEvents

Function configureWindowEvents

src/main/lifecycle/window.ts:10–52  ·  view source on GitHub ↗
(mb: Menubar)

Source from the content-addressed store, hash-verified

8 * @param mb - The menubar instance whose window events are configured.
9 */
10export function configureWindowEvents(mb: Menubar): void {
11 if (!mb.window) {
12 return;
13 }
14
15 /**
16 * Listen for 'before-input-event' to detect Escape key presses and hide the window.
17 */
18 mb.window.webContents.on('before-input-event', (event, input) => {
19 if (input.key === 'Escape') {
20 mb.hideWindow();
21 event.preventDefault();
22 }
23 });
24
25 /**
26 * When DevTools is opened, resize and center the window for better visibility and allow resizing.
27 */
28 mb.window.webContents.on('devtools-opened', () => {
29 if (!mb.window) {
30 return;
31 }
32
33 mb.window.setSize(800, 600);
34 mb.window.center();
35 mb.window.resizable = true;
36 mb.window.setAlwaysOnTop(true);
37 });
38
39 /**
40 * When DevTools is closed, restore the window to its original size and position it centered on the tray icon.
41 */
42 mb.window.webContents.on('devtools-closed', () => {
43 if (!mb.window) {
44 return;
45 }
46
47 const trayBounds = mb.tray.getBounds();
48 mb.window.setSize(WindowConfig.width!, WindowConfig.height!);
49 mb.positioner.move('trayCenter', trayBounds);
50 mb.window.resizable = false;
51 });
52}

Callers 2

index.tsFile · 0.90
window.test.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected