@lynx-js/lynxtron 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/README.md +80 -0
  2. package/apis/api/app.d.ts +1848 -0
  3. package/apis/api/asar.d.ts +124 -0
  4. package/apis/api/base-window.d.ts +1712 -0
  5. package/apis/api/clipboard.d.ts +54 -0
  6. package/apis/api/command-line.d.ts +46 -0
  7. package/apis/api/context-bridge.d.ts +8 -0
  8. package/apis/api/devtool.d.ts +34 -0
  9. package/apis/api/dialog.d.ts +633 -0
  10. package/apis/api/dock.d.ts +88 -0
  11. package/apis/api/environment.d.ts +9 -0
  12. package/apis/api/event.d.ts +8 -0
  13. package/apis/api/jump-list-item.d.ts +83 -0
  14. package/apis/api/lynx-library.d.ts +7 -0
  15. package/apis/api/lynx-template-bundle.d.ts +32 -0
  16. package/apis/api/lynx-template-data.d.ts +10 -0
  17. package/apis/api/lynx-update-meta.d.ts +16 -0
  18. package/apis/api/lynx-window.d.ts +405 -0
  19. package/apis/api/menu.d.ts +96 -0
  20. package/apis/api/native-image.d.ts +268 -0
  21. package/apis/api/notification-response.d.ts +26 -0
  22. package/apis/api/notification.d.ts +242 -0
  23. package/apis/api/power-monitor.d.ts +121 -0
  24. package/apis/api/process-metric.d.ts +93 -0
  25. package/apis/api/protocol.d.ts +54 -0
  26. package/apis/api/screen.d.ts +222 -0
  27. package/apis/api/shell.d.ts +124 -0
  28. package/apis/api/task.d.ts +39 -0
  29. package/apis/api/touch-bar.d.ts +206 -0
  30. package/apis/api/tray.d.ts +44 -0
  31. package/apis/api/utility-process.d.ts +73 -0
  32. package/apis/lynx.d.ts +15 -0
  33. package/apis/lynxtron.d.ts +39 -0
  34. package/apis/structures/point.d.ts +10 -0
  35. package/apis/structures/rectangle.d.ts +22 -0
  36. package/apis/structures/size.d.ts +8 -0
  37. package/apis/web-host.d.ts +24 -0
  38. package/cli.js +28 -0
  39. package/context-bridge.js +6 -0
  40. package/fuses-cli.js +143 -0
  41. package/fuses.js +299 -0
  42. package/install.js +127 -0
  43. package/lynx.js +1 -0
  44. package/lynxtron.js +43 -0
  45. package/lynxtron_bin.js +10 -0
  46. package/native-paths.cjs +38 -0
  47. package/package.json +71 -4
  48. package/utils/download.js +72 -0
  49. package/utils/env-config.js +35 -0
  50. package/web-host/index.js +110 -0
  51. package/web-worker.js +12 -0
@@ -0,0 +1,1712 @@
1
+ // Copyright 2026 The Lynxtron Authors. All rights reserved.
2
+ // Licensed under the Apache License Version 2.0 that can be found in the
3
+ // LICENSE file in the root directory of this source tree.
4
+
5
+ import { EventEmitter } from 'node:events';
6
+ import { Point } from '../structures/point';
7
+ import { Size } from '../structures/size';
8
+ import { Rectangle } from '../structures/rectangle';
9
+
10
+ export interface WillResizeDetails {
11
+ /**
12
+ * The edge of the window being dragged for resizing. Can be `bottom`, `left`,
13
+ * `right`, `top-left`, `top-right`, `bottom-left` or `bottom-right`.
14
+ */
15
+ edge:
16
+ | 'bottom'
17
+ | 'left'
18
+ | 'right'
19
+ | 'top-left'
20
+ | 'top-right'
21
+ | 'bottom-left'
22
+ | 'bottom-right';
23
+ }
24
+
25
+ export interface VisibleOnAllWorkspacesOptions {
26
+ /**
27
+ * Sets whether the window should be visible above fullscreen windows.
28
+ *
29
+ * In Lynxtron's current macOS implementation, this maps to
30
+ * `NSWindowCollectionBehaviorFullScreenAuxiliary`.
31
+ *
32
+ * @platform darwin
33
+ */
34
+ visibleOnFullScreen?: boolean;
35
+ /**
36
+ * Reserved for Electron compatibility.
37
+ *
38
+ * Lynxtron currently keeps the minimal macOS behavior for
39
+ * `setVisibleOnAllWorkspaces` and does not perform Electron's extra Dock /
40
+ * process-type transformation. Passing this option does not currently change
41
+ * behavior.
42
+ *
43
+ * @platform darwin
44
+ */
45
+ skipTransformProcessType?: boolean;
46
+ }
47
+
48
+ export interface BaseWindowConstructorOptions {
49
+ /**
50
+ * Whether the window should always stay on top of other windows. Default is
51
+ * `false`.
52
+ */
53
+ alwaysOnTop?: boolean;
54
+ /**
55
+ * Auto hide the menu bar unless the `Alt` key is pressed. Default is `false`.
56
+ *
57
+ * @platform win32
58
+ */
59
+ autoHideMenuBar?: boolean;
60
+ /**
61
+ * The window's background color in Hex, RGB, RGBA, HSL, HSLA or named CSS color
62
+ * format. Alpha in #AARRGGBB format is supported if `transparent` is set to
63
+ * `true`. Default is `#FFF` (white). See win.setBackgroundColor for more
64
+ * information.
65
+ */
66
+ backgroundColor?: string;
67
+ /**
68
+ * Set the window's system-drawn background material, including behind the
69
+ * non-client area. Can be `auto`, `none`, `mica`, `acrylic` or `tabbed`. See
70
+ * win.setBackgroundMaterial for more information.
71
+ *
72
+ * @platform win32
73
+ */
74
+ backgroundMaterial?: 'auto' | 'none' | 'mica' | 'acrylic' | 'tabbed';
75
+ /**
76
+ * Show window in the center of the screen. Default is `false`.
77
+ */
78
+ center?: boolean;
79
+ /**
80
+ * Whether window is closable. Default is `true`.
81
+ *
82
+ * @platform darwin,win32
83
+ */
84
+ closable?: boolean;
85
+ /**
86
+ * Whether to hide cursor when typing. Default is `false`.
87
+ */
88
+ disableAutoHideCursor?: boolean;
89
+ /**
90
+ * Enable the window to be resized larger than screen. Only relevant for macOS, as
91
+ * other OSes allow larger-than-screen windows by default. Default is `false`.
92
+ *
93
+ * @platform darwin
94
+ */
95
+ enableLargerThanScreen?: boolean;
96
+ /**
97
+ * Whether the window can be focused. Default is `true`. On Windows setting
98
+ * `focusable: false` also implies setting `skipTaskbar: true`.
99
+ */
100
+ focusable?: boolean;
101
+ /**
102
+ * Specify `false` to create a frameless window. Default is `true`.
103
+ */
104
+ frame?: boolean;
105
+ /**
106
+ * Whether the window should show in fullscreen. When explicitly set to `false` the
107
+ * fullscreen button will be hidden or disabled on macOS. Default is `false`.
108
+ */
109
+ fullscreen?: boolean;
110
+ /**
111
+ * Whether the window can be put into fullscreen mode. On macOS, also whether the
112
+ * maximize/zoom button should toggle full screen mode or maximize window. Default
113
+ * is `true`.
114
+ */
115
+ fullscreenable?: boolean;
116
+ /**
117
+ * Whether window should have a shadow. Default is `true`.
118
+ */
119
+ hasShadow?: boolean;
120
+ /**
121
+ * Window's height in pixels. Default is `600`.
122
+ */
123
+ height?: number;
124
+ /**
125
+ * Whether window should be hidden when the user toggles into mission control.
126
+ *
127
+ * @platform darwin
128
+ */
129
+ hiddenInMissionControl?: boolean;
130
+ /**
131
+ * The window icon. On Windows it is recommended to use `ICO` icons to get best
132
+ * visual effects, you can also leave it undefined so the executable's icon will be
133
+ * used.
134
+ */
135
+ icon?: any; // NativeImage | string
136
+ /**
137
+ * Window's maximum height. Default is no limit.
138
+ */
139
+ maxHeight?: number;
140
+ /**
141
+ * Whether window is maximizable. Default is
142
+ * `true`.
143
+ *
144
+ * @platform darwin,win32
145
+ */
146
+ maximizable?: boolean;
147
+ /**
148
+ * Window's maximum width. Default is no limit.
149
+ */
150
+ maxWidth?: number;
151
+ /**
152
+ * Window's minimum height. Default is `0`.
153
+ */
154
+ minHeight?: number;
155
+ /**
156
+ * Whether window is minimizable. Default is
157
+ * `true`.
158
+ *
159
+ * @platform darwin,win32
160
+ */
161
+ minimizable?: boolean;
162
+ /**
163
+ * Window's minimum width. Default is `0`.
164
+ */
165
+ minWidth?: number;
166
+ /**
167
+ * Whether this is a modal window. This only works when the window is a child
168
+ * window. Default is `false`.
169
+ */
170
+ modal?: boolean;
171
+ /**
172
+ * Whether window is movable. Default is `true`.
173
+ *
174
+ * @platform darwin,win32
175
+ */
176
+ movable?: boolean;
177
+ /**
178
+ * Set the initial opacity of the window, between 0.0 (fully transparent) and 1.0
179
+ * (fully opaque). This is only implemented on Windows and macOS.
180
+ *
181
+ * @platform darwin,win32
182
+ */
183
+ opacity?: number;
184
+ /**
185
+ * Specify parent window. Default is `null`.
186
+ */
187
+ parent?: any; // BaseWindow
188
+ /**
189
+ * Whether window is resizable. Default is `true`.
190
+ */
191
+ resizable?: boolean;
192
+ /**
193
+ * Whether frameless window should have rounded corners. Default is `true`. Setting
194
+ * this property to `false` will prevent the window from being fullscreenable on
195
+ * macOS. On Windows versions older than Windows 11 Build 22000 this property has
196
+ * no effect, and frameless windows will not have rounded corners.
197
+ *
198
+ * @platform darwin,win32
199
+ */
200
+ roundedCorners?: boolean;
201
+ /**
202
+ * Whether window should be shown when created. Default is `true`.
203
+ */
204
+ show?: boolean;
205
+ /**
206
+ * Use pre-Lion fullscreen on macOS. Default is `false`.
207
+ *
208
+ * @platform darwin
209
+ */
210
+ simpleFullscreen?: boolean;
211
+ /**
212
+ * Whether to show the window in taskbar. Default is `false`.
213
+ *
214
+ * @platform darwin,win32
215
+ */
216
+ skipTaskbar?: boolean;
217
+ /**
218
+ * Tab group name, allows opening the window as a native tab. Windows with the same
219
+ * tabbing identifier will be grouped together. This also adds a native new tab
220
+ * button to your window's tab bar and allows your `app` and window to receive the
221
+ * `new-window-for-tab` event.
222
+ *
223
+ * @platform darwin
224
+ */
225
+ tabbingIdentifier?: string;
226
+ /**
227
+ * Use `WS_THICKFRAME` style for frameless windows on Windows, which adds standard
228
+ * window frame. Setting it to `false` will remove window shadow and window
229
+ * animations. Default is `true`.
230
+ */
231
+ thickFrame?: boolean;
232
+ /**
233
+ * Default window title. Sets the title of the native window when provided.
234
+ */
235
+ title?: string;
236
+ /**
237
+ * The style of window title bar. Default is `default`. Only supported on macOS.
238
+ * Other platforms ignore this option.
239
+ *
240
+ * @platform darwin
241
+ */
242
+ titleBarStyle?: 'default' | 'hidden' | 'hiddenInset' | 'customButtonsOnHover';
243
+ /**
244
+ * Set a custom position for the traffic light buttons in frameless windows.
245
+ *
246
+ * @platform darwin
247
+ */
248
+ trafficLightPosition?: Point;
249
+ /**
250
+ * Makes the window transparent. Default is `false`. On Windows, does not work
251
+ * unless the window is frameless.
252
+ */
253
+ transparent?: boolean;
254
+ /**
255
+ * The type of window, default is normal window. See more about this below.
256
+ */
257
+ type?: string;
258
+ /**
259
+ * The `width` and `height` would be used as the content area's size, which means
260
+ * the actual window's size will include the window frame's size and be slightly
261
+ * larger. Default is `false`.
262
+ */
263
+ useContentSize?: boolean;
264
+ /**
265
+ * Add a type of vibrancy effect to the window, only on macOS. Can be
266
+ * `appearance-based`, `titlebar`, `selection`, `menu`, `popover`, `sidebar`,
267
+ * `header`, `sheet`, `window`, `hud`, `fullscreen-ui`, `tooltip`, `content`,
268
+ * `under-window`, or `under-page`.
269
+ *
270
+ * @platform darwin
271
+ */
272
+ vibrancy?:
273
+ | 'appearance-based'
274
+ | 'titlebar'
275
+ | 'selection'
276
+ | 'menu'
277
+ | 'popover'
278
+ | 'sidebar'
279
+ | 'header'
280
+ | 'sheet'
281
+ | 'window'
282
+ | 'hud'
283
+ | 'fullscreen-ui'
284
+ | 'tooltip'
285
+ | 'content'
286
+ | 'under-window'
287
+ | 'under-page';
288
+ /**
289
+ * Specify how the material appearance should reflect window activity state on
290
+ * macOS. Must be used with the `vibrancy` property. Possible values are:
291
+ *
292
+ * @platform darwin
293
+ */
294
+ visualEffectState?: 'followWindow' | 'active' | 'inactive';
295
+ /**
296
+ * Window's width in pixels. Default is `800`.
297
+ */
298
+ width?: number;
299
+ /**
300
+ * (**required** if y is used) Window's left offset from screen. Default is to
301
+ * center the window.
302
+ */
303
+ x?: number;
304
+ /**
305
+ * (**required** if x is used) Window's top offset from screen. Default is to
306
+ * center the window.
307
+ */
308
+ y?: number;
309
+ }
310
+
311
+ export declare class BaseWindow extends EventEmitter {
312
+ /**
313
+ * Emitted when an App Command is invoked. These are typically related to keyboard
314
+ * media keys or browser commands, as well as the "Back" button built into some
315
+ * mice on Windows.
316
+ *
317
+ * Commands are lowercased, underscores are replaced with hyphens, and the
318
+ * `APPCOMMAND_` prefix is stripped off. e.g. `APPCOMMAND_BROWSER_BACKWARD` is
319
+ * emitted as `browser-backward`.
320
+ *
321
+ * @platform win32
322
+ */
323
+ on(
324
+ event: 'app-command',
325
+ listener: (event: Event, command: string) => void
326
+ ): this;
327
+ /**
328
+ * @platform win32
329
+ */
330
+ off(
331
+ event: 'app-command',
332
+ listener: (event: Event, command: string) => void
333
+ ): this;
334
+ /**
335
+ * @platform win32
336
+ */
337
+ once(
338
+ event: 'app-command',
339
+ listener: (event: Event, command: string) => void
340
+ ): this;
341
+ /**
342
+ * @platform win32
343
+ */
344
+ addListener(
345
+ event: 'app-command',
346
+ listener: (event: Event, command: string) => void
347
+ ): this;
348
+ /**
349
+ * @platform win32
350
+ */
351
+ removeListener(
352
+ event: 'app-command',
353
+ listener: (event: Event, command: string) => void
354
+ ): this;
355
+ /**
356
+ * Emitted when the window loses focus.
357
+ */
358
+ on(event: 'blur', listener: (event: Event) => void): this;
359
+ off(event: 'blur', listener: (event: Event) => void): this;
360
+ once(event: 'blur', listener: (event: Event) => void): this;
361
+ addListener(event: 'blur', listener: (event: Event) => void): this;
362
+ removeListener(event: 'blur', listener: (event: Event) => void): this;
363
+ /**
364
+ * Emitted when the window is going to be closed. Calling
365
+ * `event.preventDefault()` will cancel the close.
366
+ */
367
+ on(event: 'close', listener: (event: Event) => void): this;
368
+ off(event: 'close', listener: (event: Event) => void): this;
369
+ once(event: 'close', listener: (event: Event) => void): this;
370
+ addListener(event: 'close', listener: (event: Event) => void): this;
371
+ removeListener(event: 'close', listener: (event: Event) => void): this;
372
+ /**
373
+ * Emitted when the window is closed. After you have received this event you should
374
+ * remove the reference to the window and avoid using it any more.
375
+ */
376
+ on(event: 'closed', listener: () => void): this;
377
+ off(event: 'closed', listener: () => void): this;
378
+ once(event: 'closed', listener: () => void): this;
379
+ addListener(event: 'closed', listener: () => void): this;
380
+ removeListener(event: 'closed', listener: () => void): this;
381
+ /**
382
+ * Emitted before the window enters a full-screen state.
383
+ */
384
+ on(event: 'will-enter-full-screen', listener: () => void): this;
385
+ off(event: 'will-enter-full-screen', listener: () => void): this;
386
+ once(event: 'will-enter-full-screen', listener: () => void): this;
387
+ addListener(event: 'will-enter-full-screen', listener: () => void): this;
388
+ removeListener(event: 'will-enter-full-screen', listener: () => void): this;
389
+ /**
390
+ * Emitted when the window enters a full-screen state.
391
+ */
392
+ on(event: 'enter-full-screen', listener: () => void): this;
393
+ off(event: 'enter-full-screen', listener: () => void): this;
394
+ once(event: 'enter-full-screen', listener: () => void): this;
395
+ addListener(event: 'enter-full-screen', listener: () => void): this;
396
+ removeListener(event: 'enter-full-screen', listener: () => void): this;
397
+ /**
398
+ * Emitted when the window gains focus.
399
+ */
400
+ on(event: 'focus', listener: (event: Event) => void): this;
401
+ off(event: 'focus', listener: (event: Event) => void): this;
402
+ once(event: 'focus', listener: (event: Event) => void): this;
403
+ addListener(event: 'focus', listener: (event: Event) => void): this;
404
+ removeListener(event: 'focus', listener: (event: Event) => void): this;
405
+ /**
406
+ * Emitted when the window is hidden.
407
+ */
408
+ on(event: 'hide', listener: () => void): this;
409
+ off(event: 'hide', listener: () => void): this;
410
+ once(event: 'hide', listener: () => void): this;
411
+ addListener(event: 'hide', listener: () => void): this;
412
+ removeListener(event: 'hide', listener: () => void): this;
413
+ /**
414
+ * Emitted before the window leaves a full-screen state.
415
+ */
416
+ on(event: 'will-leave-full-screen', listener: () => void): this;
417
+ off(event: 'will-leave-full-screen', listener: () => void): this;
418
+ once(event: 'will-leave-full-screen', listener: () => void): this;
419
+ addListener(event: 'will-leave-full-screen', listener: () => void): this;
420
+ removeListener(event: 'will-leave-full-screen', listener: () => void): this;
421
+ /**
422
+ * Emitted when the window leaves a full-screen state.
423
+ */
424
+ on(event: 'leave-full-screen', listener: () => void): this;
425
+ off(event: 'leave-full-screen', listener: () => void): this;
426
+ once(event: 'leave-full-screen', listener: () => void): this;
427
+ addListener(event: 'leave-full-screen', listener: () => void): this;
428
+ removeListener(event: 'leave-full-screen', listener: () => void): this;
429
+ /**
430
+ * Emitted when window is maximized.
431
+ */
432
+ on(event: 'maximize', listener: () => void): this;
433
+ off(event: 'maximize', listener: () => void): this;
434
+ once(event: 'maximize', listener: () => void): this;
435
+ addListener(event: 'maximize', listener: () => void): this;
436
+ removeListener(event: 'maximize', listener: () => void): this;
437
+ /**
438
+ * Emitted when the window is minimized.
439
+ */
440
+ on(event: 'minimize', listener: () => void): this;
441
+ off(event: 'minimize', listener: () => void): this;
442
+ once(event: 'minimize', listener: () => void): this;
443
+ addListener(event: 'minimize', listener: () => void): this;
444
+ removeListener(event: 'minimize', listener: () => void): this;
445
+ /**
446
+ * Emitted when the window is being moved to a new position.
447
+ */
448
+ on(event: 'move', listener: () => void): this;
449
+ off(event: 'move', listener: () => void): this;
450
+ once(event: 'move', listener: () => void): this;
451
+ addListener(event: 'move', listener: () => void): this;
452
+ removeListener(event: 'move', listener: () => void): this;
453
+ /**
454
+ * Emitted once when the window is moved to a new position.
455
+ *
456
+ * > [!NOTE] On macOS, this event is an alias of `move`.
457
+ *
458
+ * @platform darwin,win32
459
+ */
460
+ on(event: 'moved', listener: () => void): this;
461
+ /**
462
+ * @platform darwin,win32
463
+ */
464
+ off(event: 'moved', listener: () => void): this;
465
+ /**
466
+ * @platform darwin,win32
467
+ */
468
+ once(event: 'moved', listener: () => void): this;
469
+ /**
470
+ * @platform darwin,win32
471
+ */
472
+ addListener(event: 'moved', listener: () => void): this;
473
+ /**
474
+ * @platform darwin,win32
475
+ */
476
+ removeListener(event: 'moved', listener: () => void): this;
477
+ /**
478
+ * Emitted after the window has been resized.
479
+ */
480
+ on(event: 'resize', listener: () => void): this;
481
+ off(event: 'resize', listener: () => void): this;
482
+ once(event: 'resize', listener: () => void): this;
483
+ addListener(event: 'resize', listener: () => void): this;
484
+ removeListener(event: 'resize', listener: () => void): this;
485
+ /**
486
+ * Emitted once when the window has finished being resized.
487
+ *
488
+ * This is usually emitted when the window has been resized manually. On macOS,
489
+ * resizing the window with `setBounds`/`setSize` and setting the `animate`
490
+ * parameter to `true` will also emit this event once resizing has finished.
491
+ *
492
+ * @platform darwin,win32
493
+ */
494
+ on(event: 'resized', listener: () => void): this;
495
+ /**
496
+ * @platform darwin,win32
497
+ */
498
+ off(event: 'resized', listener: () => void): this;
499
+ /**
500
+ * @platform darwin,win32
501
+ */
502
+ once(event: 'resized', listener: () => void): this;
503
+ /**
504
+ * @platform darwin,win32
505
+ */
506
+ addListener(event: 'resized', listener: () => void): this;
507
+ /**
508
+ * @platform darwin,win32
509
+ */
510
+ removeListener(event: 'resized', listener: () => void): this;
511
+ /**
512
+ * Emitted when the window is restored from a minimized state.
513
+ */
514
+ on(event: 'restore', listener: () => void): this;
515
+ off(event: 'restore', listener: () => void): this;
516
+ once(event: 'restore', listener: () => void): this;
517
+ addListener(event: 'restore', listener: () => void): this;
518
+ removeListener(event: 'restore', listener: () => void): this;
519
+ /**
520
+ * Emitted after the window's always-on-top state changes.
521
+ *
522
+ * @platform darwin,win32
523
+ */
524
+ on(
525
+ event: 'always-on-top-changed',
526
+ listener: (event: Event, isAlwaysOnTop: boolean) => void
527
+ ): this;
528
+ /**
529
+ * @platform darwin,win32
530
+ */
531
+ off(
532
+ event: 'always-on-top-changed',
533
+ listener: (event: Event, isAlwaysOnTop: boolean) => void
534
+ ): this;
535
+ /**
536
+ * @platform darwin,win32
537
+ */
538
+ once(
539
+ event: 'always-on-top-changed',
540
+ listener: (event: Event, isAlwaysOnTop: boolean) => void
541
+ ): this;
542
+ /**
543
+ * @platform darwin,win32
544
+ */
545
+ addListener(
546
+ event: 'always-on-top-changed',
547
+ listener: (event: Event, isAlwaysOnTop: boolean) => void
548
+ ): this;
549
+ /**
550
+ * @platform darwin,win32
551
+ */
552
+ removeListener(
553
+ event: 'always-on-top-changed',
554
+ listener: (event: Event, isAlwaysOnTop: boolean) => void
555
+ ): this;
556
+ /**
557
+ * Emitted on trackpad rotation gesture. Continually emitted until rotation gesture
558
+ * is ended. The `rotation` value on each emission is the angle in degrees rotated
559
+ * since the last emission. The last emitted event upon a rotation gesture will
560
+ * always be of value `0`. Counter-clockwise rotation values are positive, while
561
+ * clockwise ones are negative.
562
+ *
563
+ * @platform darwin
564
+ */
565
+ on(
566
+ event: 'rotate-gesture',
567
+ listener: (event: Event, rotation: number) => void
568
+ ): this;
569
+ /**
570
+ * @platform darwin
571
+ */
572
+ off(
573
+ event: 'rotate-gesture',
574
+ listener: (event: Event, rotation: number) => void
575
+ ): this;
576
+ /**
577
+ * @platform darwin
578
+ */
579
+ once(
580
+ event: 'rotate-gesture',
581
+ listener: (event: Event, rotation: number) => void
582
+ ): this;
583
+ /**
584
+ * @platform darwin
585
+ */
586
+ addListener(
587
+ event: 'rotate-gesture',
588
+ listener: (event: Event, rotation: number) => void
589
+ ): this;
590
+ /**
591
+ * @platform darwin
592
+ */
593
+ removeListener(
594
+ event: 'rotate-gesture',
595
+ listener: (event: Event, rotation: number) => void
596
+ ): this;
597
+ /**
598
+ * Emitted when a session is about to end due to a shutdown, machine restart, or
599
+ * user log-off. Once this event fires, there is no way to prevent the session from
600
+ * ending.
601
+ *
602
+ * @platform win32
603
+ */
604
+ on(event: 'session-end', listener: (event: any) => void): this; // WindowSessionEndEvent
605
+ /**
606
+ * @platform win32
607
+ */
608
+ off(event: 'session-end', listener: (event: any) => void): this;
609
+ /**
610
+ * @platform win32
611
+ */
612
+ once(event: 'session-end', listener: (event: any) => void): this;
613
+ /**
614
+ * @platform win32
615
+ */
616
+ addListener(event: 'session-end', listener: (event: any) => void): this;
617
+ /**
618
+ * @platform win32
619
+ */
620
+ removeListener(event: 'session-end', listener: (event: any) => void): this;
621
+ /**
622
+ * Emitted when the window opens a sheet.
623
+ *
624
+ * @platform darwin
625
+ */
626
+ on(event: 'sheet-begin', listener: () => void): this;
627
+ /**
628
+ * @platform darwin
629
+ */
630
+ off(event: 'sheet-begin', listener: () => void): this;
631
+ /**
632
+ * @platform darwin
633
+ */
634
+ once(event: 'sheet-begin', listener: () => void): this;
635
+ /**
636
+ * @platform darwin
637
+ */
638
+ addListener(event: 'sheet-begin', listener: () => void): this;
639
+ /**
640
+ * @platform darwin
641
+ */
642
+ removeListener(event: 'sheet-begin', listener: () => void): this;
643
+ /**
644
+ * Emitted when the window has closed a sheet.
645
+ *
646
+ * @platform darwin
647
+ */
648
+ on(event: 'sheet-end', listener: () => void): this;
649
+ /**
650
+ * @platform darwin
651
+ */
652
+ off(event: 'sheet-end', listener: () => void): this;
653
+ /**
654
+ * @platform darwin
655
+ */
656
+ once(event: 'sheet-end', listener: () => void): this;
657
+ /**
658
+ * @platform darwin
659
+ */
660
+ addListener(event: 'sheet-end', listener: () => void): this;
661
+ /**
662
+ * @platform darwin
663
+ */
664
+ removeListener(event: 'sheet-end', listener: () => void): this;
665
+ /**
666
+ * Emitted when the user clicks the native macOS new tab button. The new tab button
667
+ * is only visible if the current window has a `tabbingIdentifier`.
668
+ *
669
+ * @platform darwin
670
+ */
671
+ on(event: 'new-window-for-tab', listener: (event: Event) => void): this;
672
+ /**
673
+ * @platform darwin
674
+ */
675
+ off(event: 'new-window-for-tab', listener: (event: Event) => void): this;
676
+ /**
677
+ * @platform darwin
678
+ */
679
+ once(event: 'new-window-for-tab', listener: (event: Event) => void): this;
680
+ /**
681
+ * @platform darwin
682
+ */
683
+ addListener(
684
+ event: 'new-window-for-tab',
685
+ listener: (event: Event) => void
686
+ ): this;
687
+ /**
688
+ * @platform darwin
689
+ */
690
+ removeListener(
691
+ event: 'new-window-for-tab',
692
+ listener: (event: Event) => void
693
+ ): this;
694
+ /**
695
+ * Emitted when the window is shown.
696
+ */
697
+ on(event: 'show', listener: () => void): this;
698
+ off(event: 'show', listener: () => void): this;
699
+ once(event: 'show', listener: () => void): this;
700
+ addListener(event: 'show', listener: () => void): this;
701
+ removeListener(event: 'show', listener: () => void): this;
702
+ /**
703
+ * Emitted on 3-finger swipe. Possible directions are `up`, `right`, `down`,
704
+ * `left`.
705
+ *
706
+ * The method underlying this event is built to handle older macOS-style trackpad
707
+ * swiping, where the content on the screen doesn't move with the swipe. Most macOS
708
+ * trackpads are not configured to allow this kind of swiping anymore, so in order
709
+ * for it to emit properly the 'Swipe between pages' preference in `System
710
+ * Preferences > Trackpad > More Gestures` must be set to 'Swipe with two or three
711
+ * fingers'.
712
+ *
713
+ * @platform darwin
714
+ */
715
+ on(event: 'swipe', listener: (event: Event, direction: string) => void): this;
716
+ /**
717
+ * @platform darwin
718
+ */
719
+ off(
720
+ event: 'swipe',
721
+ listener: (event: Event, direction: string) => void
722
+ ): this;
723
+ /**
724
+ * @platform darwin
725
+ */
726
+ once(
727
+ event: 'swipe',
728
+ listener: (event: Event, direction: string) => void
729
+ ): this;
730
+ /**
731
+ * @platform darwin
732
+ */
733
+ addListener(
734
+ event: 'swipe',
735
+ listener: (event: Event, direction: string) => void
736
+ ): this;
737
+ /**
738
+ * @platform darwin
739
+ */
740
+ removeListener(
741
+ event: 'swipe',
742
+ listener: (event: Event, direction: string) => void
743
+ ): this;
744
+ /**
745
+ * Emitted when the system context menu is triggered on the window, this is
746
+ * normally only triggered when the user right clicks on the non-client area of
747
+ * your window. This is the window titlebar or any area you have declared as
748
+ * `-webkit-app-region: drag` in a frameless window.
749
+ *
750
+ * Calling `event.preventDefault()` will prevent the menu from being displayed.
751
+ *
752
+ * To convert `point` to DIP, use `screen.screenToDipPoint(point)`.
753
+ *
754
+ * @platform win32
755
+ */
756
+ on(
757
+ event: 'system-context-menu',
758
+ listener: (
759
+ event: Event,
760
+ /**
761
+ * The screen coordinates where the context menu was triggered.
762
+ */
763
+ point: Point
764
+ ) => void
765
+ ): this;
766
+ /**
767
+ * @platform win32
768
+ */
769
+ off(
770
+ event: 'system-context-menu',
771
+ listener: (
772
+ event: Event,
773
+ /**
774
+ * The screen coordinates where the context menu was triggered.
775
+ */
776
+ point: Point
777
+ ) => void
778
+ ): this;
779
+ /**
780
+ * @platform win32
781
+ */
782
+ once(
783
+ event: 'system-context-menu',
784
+ listener: (
785
+ event: Event,
786
+ /**
787
+ * The screen coordinates where the context menu was triggered.
788
+ */
789
+ point: Point
790
+ ) => void
791
+ ): this;
792
+ /**
793
+ * @platform win32
794
+ */
795
+ addListener(
796
+ event: 'system-context-menu',
797
+ listener: (
798
+ event: Event,
799
+ /**
800
+ * The screen coordinates where the context menu was triggered.
801
+ */
802
+ point: Point
803
+ ) => void
804
+ ): this;
805
+ /**
806
+ * @platform win32
807
+ */
808
+ removeListener(
809
+ event: 'system-context-menu',
810
+ listener: (
811
+ event: Event,
812
+ /**
813
+ * The screen coordinates where the context menu was triggered.
814
+ */
815
+ point: Point
816
+ ) => void
817
+ ): this;
818
+ /**
819
+ * Emitted when the window exits from a maximized state.
820
+ */
821
+ on(event: 'unmaximize', listener: () => void): this;
822
+ off(event: 'unmaximize', listener: () => void): this;
823
+ once(event: 'unmaximize', listener: () => void): this;
824
+ addListener(event: 'unmaximize', listener: () => void): this;
825
+ removeListener(event: 'unmaximize', listener: () => void): this;
826
+ /**
827
+ * Emitted before the window is moved. On Windows, calling `event.preventDefault()`
828
+ * will prevent the window from being moved.
829
+ *
830
+ * Note that this is only emitted when the window is being moved manually. Moving
831
+ * the window with `setPosition`/`setBounds`/`center` will not emit this event.
832
+ *
833
+ * @platform darwin,win32
834
+ */
835
+ on(
836
+ event: 'will-move',
837
+ listener: (
838
+ event: Event,
839
+ /**
840
+ * Location the window is being moved to.
841
+ */
842
+ newBounds: Rectangle
843
+ ) => void
844
+ ): this;
845
+ /**
846
+ * @platform darwin,win32
847
+ */
848
+ off(
849
+ event: 'will-move',
850
+ listener: (
851
+ event: Event,
852
+ /**
853
+ * Location the window is being moved to.
854
+ */
855
+ newBounds: Rectangle
856
+ ) => void
857
+ ): this;
858
+ /**
859
+ * @platform darwin,win32
860
+ */
861
+ once(
862
+ event: 'will-move',
863
+ listener: (
864
+ event: Event,
865
+ /**
866
+ * Location the window is being moved to.
867
+ */
868
+ newBounds: Rectangle
869
+ ) => void
870
+ ): this;
871
+ /**
872
+ * @platform darwin,win32
873
+ */
874
+ addListener(
875
+ event: 'will-move',
876
+ listener: (
877
+ event: Event,
878
+ /**
879
+ * Location the window is being moved to.
880
+ */
881
+ newBounds: Rectangle
882
+ ) => void
883
+ ): this;
884
+ /**
885
+ * @platform darwin,win32
886
+ */
887
+ removeListener(
888
+ event: 'will-move',
889
+ listener: (
890
+ event: Event,
891
+ /**
892
+ * Location the window is being moved to.
893
+ */
894
+ newBounds: Rectangle
895
+ ) => void
896
+ ): this;
897
+ /**
898
+ * Emitted before the window is resized. Calling `event.preventDefault()` will
899
+ * prevent the window from being resized.
900
+ *
901
+ * Note that this is only emitted when the window is being resized manually.
902
+ * Resizing the window with `setBounds`/`setSize` will not emit this event.
903
+ *
904
+ * The possible values and behaviors of the `edge` option are platform dependent.
905
+ * Possible values are:
906
+ *
907
+ * * On Windows, possible values are `bottom`, `top`, `left`, `right`, `top-left`,
908
+ * `top-right`, `bottom-left`, `bottom-right`.
909
+ * * On macOS, possible values are `bottom` and `right`.
910
+ * * The value `bottom` is used to denote vertical resizing.
911
+ * * The value `right` is used to denote horizontal resizing.
912
+ *
913
+ * @platform darwin,win32
914
+ */
915
+ on(
916
+ event: 'will-resize',
917
+ listener: (
918
+ event: Event,
919
+ /**
920
+ * Size the window is being resized to.
921
+ */
922
+ newBounds: Rectangle,
923
+ details: WillResizeDetails
924
+ ) => void
925
+ ): this;
926
+ /**
927
+ * @platform darwin,win32
928
+ */
929
+ off(
930
+ event: 'will-resize',
931
+ listener: (
932
+ event: Event,
933
+ /**
934
+ * Size the window is being resized to.
935
+ */
936
+ newBounds: Rectangle,
937
+ details: WillResizeDetails
938
+ ) => void
939
+ ): this;
940
+ /**
941
+ * @platform darwin,win32
942
+ */
943
+ once(
944
+ event: 'will-resize',
945
+ listener: (
946
+ event: Event,
947
+ /**
948
+ * Size the window is being resized to.
949
+ */
950
+ newBounds: Rectangle,
951
+ details: WillResizeDetails
952
+ ) => void
953
+ ): this;
954
+ /**
955
+ * @platform darwin,win32
956
+ */
957
+ addListener(
958
+ event: 'will-resize',
959
+ listener: (
960
+ event: Event,
961
+ /**
962
+ * Size the window is being resized to.
963
+ */
964
+ newBounds: Rectangle,
965
+ details: WillResizeDetails
966
+ ) => void
967
+ ): this;
968
+ /**
969
+ * @platform darwin,win32
970
+ */
971
+ removeListener(
972
+ event: 'will-resize',
973
+ listener: (
974
+ event: Event,
975
+ /**
976
+ * Size the window is being resized to.
977
+ */
978
+ newBounds: Rectangle,
979
+ details: WillResizeDetails
980
+ ) => void
981
+ ): this;
982
+
983
+ /**
984
+ * BaseWindow
985
+ */
986
+ constructor(options?: BaseWindowConstructorOptions);
987
+ /**
988
+ * The window with the given `id`.
989
+ */
990
+ static fromId(id: number): BaseWindow | null;
991
+ /**
992
+ * An array of all opened windows.
993
+ */
994
+ static getAllWindows(): BaseWindow[];
995
+ /**
996
+ * The window that is focused in this application, otherwise returns `null`.
997
+ */
998
+ static getFocusedWindow(): BaseWindow | null;
999
+ /**
1000
+ * Removes focus from the window.
1001
+ */
1002
+ blur(): void;
1003
+ /**
1004
+ * Moves window to the center of the screen.
1005
+ */
1006
+ center(): void;
1007
+ /**
1008
+ * Try to close the window. This has the same effect as a user manually clicking
1009
+ * the close button of the window. The close may be canceled by a listener on the
1010
+ * `close` event.
1011
+ */
1012
+ close(): void;
1013
+ /**
1014
+ * Force closing the window. The `close` event will not be emitted for this
1015
+ * window, but it guarantees the `closed` event will be emitted.
1016
+ */
1017
+ destroy(): void;
1018
+ /**
1019
+ * Starts or stops flashing the window to attract user's attention.
1020
+ */
1021
+ flashFrame(flag: boolean): void;
1022
+ /**
1023
+ * Focuses on the window.
1024
+ */
1025
+ focus(): void;
1026
+ /**
1027
+ * Whether the window is destroyed.
1028
+ */
1029
+ isDestroyed(): boolean;
1030
+ /**
1031
+ * Gets the background color of the window in Hex (`#RRGGBB`) format.
1032
+ *
1033
+ * See Setting `backgroundColor`.
1034
+ *
1035
+ * > [!NOTE] The alpha value is _not_ returned alongside the red, green, and blue
1036
+ * values.
1037
+ */
1038
+ getBackgroundColor(): string;
1039
+ /**
1040
+ * The `bounds` of the window as `Object`.
1041
+ *
1042
+ * > [!NOTE] On macOS, the returned y-coordinate will be at minimum the menu bar
1043
+ * height. For example, calling `win.setBounds({ x: 25, y: 20, width: 800, height:
1044
+ * 600 })` with a menu bar height of 38 means that `win.getBounds()` will return
1045
+ * `{ x: 25, y: 38, width: 800, height: 600 }`.
1046
+ */
1047
+ getBounds(): Rectangle;
1048
+ /**
1049
+ * All child windows.
1050
+ */
1051
+ getChildWindows(): BaseWindow[];
1052
+ /**
1053
+ * Contains the window's maximum width and height.
1054
+ */
1055
+ getMaximumSize(): number[];
1056
+ /**
1057
+ * Contains the window's minimum width and height.
1058
+ */
1059
+ getMinimumSize(): number[];
1060
+ /**
1061
+ * The platform-specific handle of the window.
1062
+ *
1063
+ * The native type of the handle is `HWND` on Windows, `NSView*` on macOS.
1064
+ */
1065
+ getNativeWindowHandle(): Buffer;
1066
+ /**
1067
+ * Contains the window bounds of the normal state
1068
+ *
1069
+ * > [!NOTE] Whatever the current state of the window : maximized, minimized or in
1070
+ * fullscreen, this function always returns the position and size of the window in
1071
+ * normal state. In normal state, getBounds and getNormalBounds returns the same
1072
+ * `Rectangle`.
1073
+ */
1074
+ getNormalBounds(): Rectangle;
1075
+ /**
1076
+ * between 0.0 (fully transparent) and 1.0 (fully opaque).
1077
+ */
1078
+ getOpacity(): number;
1079
+ /**
1080
+ * The parent window or `null` if there is no parent.
1081
+ */
1082
+ getParentWindow(): BaseWindow | null;
1083
+ /**
1084
+ * Contains the window's current position.
1085
+ */
1086
+ getPosition(): number[];
1087
+ /**
1088
+ * Contains the window's width and height.
1089
+ */
1090
+ getSize(): number[];
1091
+ /**
1092
+ * The title of the native window.
1093
+ */
1094
+ getTitle(): string;
1095
+ /**
1096
+ * Whether the window has a shadow.
1097
+ */
1098
+ hasShadow(): boolean;
1099
+ /**
1100
+ * Hides the window.
1101
+ */
1102
+ hide(): void;
1103
+ /**
1104
+ * Hooks a windows message. The `callback` is called when the message is received
1105
+ * in the WndProc.
1106
+ *
1107
+ * @platform win32
1108
+ */
1109
+ hookWindowMessage(
1110
+ message: number,
1111
+ callback: (wParam: Buffer, lParam: Buffer) => void
1112
+ ): void;
1113
+ /**
1114
+ * Whether the window is always on top of other windows.
1115
+ */
1116
+ isAlwaysOnTop(): boolean;
1117
+ /**
1118
+ * Whether the window can be manually closed by user.
1119
+ *
1120
+ * @platform darwin,win32
1121
+ */
1122
+ isClosable(): boolean;
1123
+ /**
1124
+ * Whether the window is destroyed.
1125
+ */
1126
+ isDestroyed(): boolean;
1127
+ /**
1128
+ * whether the window is enabled.
1129
+ */
1130
+ isEnabled(): boolean;
1131
+ /**
1132
+ * Whether the window can be focused.
1133
+ *
1134
+ * @platform darwin,win32
1135
+ */
1136
+ isFocusable(): boolean;
1137
+ /**
1138
+ * Adds `window` as a tab on this window, after the tab for the current window.
1139
+ *
1140
+ * @platform darwin
1141
+ */
1142
+ addTabbedWindow(window: BaseWindow): void;
1143
+ /**
1144
+ * Whether the window is focused.
1145
+ */
1146
+ isFocused(): boolean;
1147
+ /**
1148
+ * Whether the window is in fullscreen mode.
1149
+ */
1150
+ isFullScreen(): boolean;
1151
+ /**
1152
+ * Whether the maximize/zoom window button toggles fullscreen mode or maximizes the
1153
+ * window.
1154
+ */
1155
+ isFullScreenable(): boolean;
1156
+ isHiddenInMissionControl(): boolean;
1157
+ /**
1158
+ * Whether the window can be manually maximized by user.
1159
+ *
1160
+ * @platform darwin,win32
1161
+ */
1162
+ isMaximizable(): boolean;
1163
+ /**
1164
+ * Whether the window is maximized.
1165
+ */
1166
+ isMaximized(): boolean;
1167
+ /**
1168
+ * Whether menu bar automatically hides itself.
1169
+ *
1170
+ * @platform win32
1171
+ */
1172
+ isMenuBarAutoHide(): boolean;
1173
+ /**
1174
+ * Whether the menu bar is visible.
1175
+ *
1176
+ * @platform win32
1177
+ */
1178
+ isMenuBarVisible(): boolean;
1179
+ /**
1180
+ * Whether the window can be manually minimized by the user.
1181
+ *
1182
+ * @platform darwin,win32
1183
+ */
1184
+ isMinimizable(): boolean;
1185
+ /**
1186
+ * Whether the window is minimized.
1187
+ */
1188
+ isMinimized(): boolean;
1189
+ /**
1190
+ * Whether current window is a modal window.
1191
+ */
1192
+ isModal(): boolean;
1193
+ /**
1194
+ * Whether the window can be moved by user.
1195
+ *
1196
+ * @platform darwin,win32
1197
+ */
1198
+ isMovable(): boolean;
1199
+ /**
1200
+ * Whether the window is in normal state (not maximized, not minimized, not in
1201
+ * fullscreen mode).
1202
+ */
1203
+ isNormal(): boolean;
1204
+ /**
1205
+ * Whether the window can be manually resized by the user.
1206
+ */
1207
+ isResizable(): boolean;
1208
+ /**
1209
+ * Whether the window is in simple (pre-Lion) fullscreen mode.
1210
+ *
1211
+ * @platform darwin
1212
+ */
1213
+ isSimpleFullScreen(): boolean;
1214
+ /**
1215
+ * Whether the window is visible to the user in the foreground of the app.
1216
+ */
1217
+ isVisible(): boolean;
1218
+ /**
1219
+ * Whether the window is visible on all workspaces.
1220
+ *
1221
+ * > [!NOTE] This API always returns false on Windows.
1222
+ *
1223
+ * @platform darwin
1224
+ */
1225
+ isVisibleOnAllWorkspaces(): boolean;
1226
+ /**
1227
+ * `true` or `false` depending on whether the message is hooked.
1228
+ *
1229
+ * @platform win32
1230
+ */
1231
+ isWindowMessageHooked(message: number): boolean;
1232
+ /**
1233
+ * Maximizes the window. This will also show (but not focus) the window if it isn't
1234
+ * being displayed already.
1235
+ */
1236
+ maximize(): void;
1237
+ /**
1238
+ * Minimizes the window. On macOS, the minimized window will be shown in the Dock.
1239
+ */
1240
+ minimize(): void;
1241
+ /**
1242
+ * Moves window to top(z-order) regardless of focus
1243
+ */
1244
+ moveTop(): void;
1245
+ /**
1246
+ * Restores the window from minimized state to its previous state.
1247
+ */
1248
+ restore(): void;
1249
+ /**
1250
+ * Sets whether the window should show always on top of other windows. After
1251
+ * setting this, the window is still a normal window, not a toolbox window which
1252
+ * can not be focused on.
1253
+ */
1254
+ setAlwaysOnTop(
1255
+ flag: boolean,
1256
+ level?:
1257
+ | 'normal'
1258
+ | 'floating'
1259
+ | 'torn-off-menu'
1260
+ | 'modal-panel'
1261
+ | 'main-menu'
1262
+ | 'status'
1263
+ | 'pop-up-menu'
1264
+ | 'screen-saver'
1265
+ | 'dock',
1266
+ relativeLevel?: number
1267
+ ): void;
1268
+ /**
1269
+ * This will make a window maintain an aspect ratio. The extra size allows a
1270
+ * developer to have space, specified in pixels, not included within the aspect
1271
+ * ratio calculations. This API already takes into account the difference between a
1272
+ * window's size and its content size.
1273
+ *
1274
+ * Consider a normal window with an HD video player and associated controls.
1275
+ * Perhaps there are 15 pixels of controls on the left edge, 25 pixels of controls
1276
+ * on the right edge and 50 pixels of controls below the player. In order to
1277
+ * maintain a 16:9 aspect ratio (standard aspect ratio for HD @1920x1080) within
1278
+ * the player itself we would call this function with arguments of 16/9 and {
1279
+ * width: 40, height: 50 }. The second argument doesn't care where the extra width
1280
+ * and height are within the content view--only that they exist. Sum any extra
1281
+ * width and height areas you have within the overall content view.
1282
+ *
1283
+ * The aspect ratio is not respected when window is resized programmatically with
1284
+ * APIs like `win.setSize`.
1285
+ *
1286
+ * To reset an aspect ratio, pass 0 as the `aspectRatio` value:
1287
+ * `win.setAspectRatio(0)`.
1288
+ */
1289
+ setAspectRatio(aspectRatio: number, extraSize?: Size): void;
1290
+ /**
1291
+ * Controls whether to hide cursor when typing.
1292
+ *
1293
+ * @platform darwin
1294
+ */
1295
+ setAutoHideCursor(autoHide: boolean): void;
1296
+ /**
1297
+ * Selects the previous tab when native tabs are enabled and there are other tabs
1298
+ * in the window.
1299
+ *
1300
+ * @platform darwin
1301
+ */
1302
+ selectPreviousTab(): void;
1303
+ /**
1304
+ * Selects the next tab when native tabs are enabled and there are other tabs in
1305
+ * the window.
1306
+ *
1307
+ * @platform darwin
1308
+ */
1309
+ selectNextTab(): void;
1310
+ /**
1311
+ * Sets whether the window menu bar should hide itself automatically. Once set the
1312
+ * menu bar will only show when users press the single `Alt` key.
1313
+ *
1314
+ * If the menu bar is already visible, calling `setAutoHideMenuBar(true)` won't
1315
+ * hide it immediately.
1316
+ *
1317
+ * @platform win32
1318
+ */
1319
+ setAutoHideMenuBar(hide: boolean): void;
1320
+ /**
1321
+ * Examples of valid `backgroundColor` values:
1322
+ *
1323
+ * * Hex
1324
+ * * #fff (shorthand RGB)
1325
+ * * #ffff (shorthand ARGB)
1326
+ * * #ffffff (RGB)
1327
+ * * #ffffffff (ARGB)
1328
+ * * RGB
1329
+ * * `rgb\(([^\d]+),\s*([^\d]+),\s*([^\d]+)\)`
1330
+ * * e.g. rgb(255, 255, 255)
1331
+ * * RGBA
1332
+ * * `rgba\(([^\d]+),\s*([^\d]+),\s*([^\d]+),\s*([^\d.]+)\)`
1333
+ * * e.g. rgba(255, 255, 255, 1.0)
1334
+ * * HSL
1335
+ * * `hsl\((-?[^\d.]+),\s*([^\d.]+)%,\s*([^\d.]+)%\)`
1336
+ * * e.g. hsl(200, 20%, 50%)
1337
+ * * HSLA
1338
+ * * `hsla\((-?[^\d.]+),\s*([^\d.]+)%,\s*([^\d.]+)%,\s*([^\d.]+)\)`
1339
+ * * e.g. hsla(200, 20%, 50%, 0.5)
1340
+ * * Color name
1341
+ * * Options are listed in SkParseColor.cpp
1342
+ * * Similar to CSS Color Module Level 3 keywords, but case-sensitive.
1343
+ * * e.g. `blueviolet` or `red`
1344
+ *
1345
+ * Sets the background color of the window. See Setting `backgroundColor`.
1346
+ */
1347
+ setBackgroundColor(backgroundColor: string): void;
1348
+ /**
1349
+ * Resizes and moves the window to the supplied bounds. Any properties that are not
1350
+ * supplied will default to their current values.
1351
+ *
1352
+ * > [!NOTE] On macOS, the y-coordinate value cannot be smaller than the menu bar
1353
+ * height. The menu bar height has changed over time and depends on the operating
1354
+ * system, but is between 20-40px. Passing a value lower than the menu bar height
1355
+ * will result in a window that is flush to the menu bar.
1356
+ */
1357
+ setBounds(bounds: Partial<Rectangle>, animate?: boolean): void;
1358
+ /**
1359
+ * Sets whether the window can be manually closed by user.
1360
+ *
1361
+ * @platform darwin,win32
1362
+ */
1363
+ setClosable(closable: boolean): void;
1364
+ /**
1365
+ * Disable or enable the window.
1366
+ */
1367
+ setEnabled(enable: boolean): void;
1368
+ /**
1369
+ * Changes whether the window can be focused.
1370
+ *
1371
+ * On macOS it does not remove the focus from the window.
1372
+ *
1373
+ * @platform darwin,win32
1374
+ */
1375
+ setFocusable(focusable: boolean): void;
1376
+ /**
1377
+ * Sets whether the window should be in fullscreen mode.
1378
+ *
1379
+ * > [!NOTE] On macOS, fullscreen transitions take place asynchronously. If further
1380
+ * actions depend on the fullscreen state, use the 'enter-full-screen' or >
1381
+ * 'leave-full-screen' events.
1382
+ */
1383
+ setFullScreen(flag: boolean): void;
1384
+ /**
1385
+ * Sets whether the maximize/zoom window button toggles fullscreen mode or
1386
+ * maximizes the window.
1387
+ */
1388
+ setFullScreenable(fullscreenable: boolean): void;
1389
+ setHiddenInMissionControl(hidden: boolean): void;
1390
+ /**
1391
+ * Shows or hides the tab overview when native tabs are enabled.
1392
+ *
1393
+ * @platform darwin
1394
+ */
1395
+ showAllTabs(): void;
1396
+ /**
1397
+ * Sets whether the window should have a shadow.
1398
+ */
1399
+ setHasShadow(hasShadow: boolean): void;
1400
+ /**
1401
+ * Merges all windows into one window with multiple tabs when native tabs are
1402
+ * enabled and there is more than one open window.
1403
+ *
1404
+ * @platform darwin
1405
+ */
1406
+ mergeAllWindows(): void;
1407
+ /**
1408
+ * Sets whether the window can be manually maximized by user.
1409
+ *
1410
+ * @platform darwin,win32
1411
+ */
1412
+ setMaximizable(maximizable: boolean): void;
1413
+ /**
1414
+ * Sets the maximum size of window to `width` and `height`.
1415
+ */
1416
+ setMaximumSize(width: number, height: number): void;
1417
+ /**
1418
+ * Sets whether the window can be manually minimized by user.
1419
+ *
1420
+ * @platform darwin,win32
1421
+ */
1422
+ setMinimizable(minimizable: boolean): void;
1423
+ /**
1424
+ * Sets the minimum size of window to `width` and `height`.
1425
+ */
1426
+ setMinimumSize(width: number, height: number): void;
1427
+ /**
1428
+ * Sets whether the window can be moved by user.
1429
+ *
1430
+ * @platform darwin,win32
1431
+ */
1432
+ setMovable(movable: boolean): void;
1433
+ /**
1434
+ * Moves the current tab into a new window if native tabs are enabled and there is
1435
+ * more than one tab in the current window.
1436
+ *
1437
+ * @platform darwin
1438
+ */
1439
+ moveTabToNewWindow(): void;
1440
+ /**
1441
+ * Sets the opacity of the window. Out of bound number
1442
+ * values are clamped to the [0, 1] range.
1443
+ *
1444
+ * @platform win32,darwin
1445
+ */
1446
+ setOpacity(opacity: number): void;
1447
+ /**
1448
+ * Sets `parent` as current window's parent window, passing `null` will turn
1449
+ * current window into a top-level window.
1450
+ */
1451
+ setParentWindow(parent: BaseWindow | null): void;
1452
+ /**
1453
+ * Moves window to `x` and `y`.
1454
+ */
1455
+ setPosition(x: number, y: number, animate?: boolean): void;
1456
+ /**
1457
+ * Sets progress value in progress bar. Valid range is [0, 1.0].
1458
+ *
1459
+ * Remove progress bar when progress < 0; Change to indeterminate mode when
1460
+ * progress > 1.
1461
+ *
1462
+ */
1463
+ setProgressBar(
1464
+ progress: number,
1465
+ options?: {
1466
+ /**
1467
+ * Mode for the progress bar. Can be `none`, `normal`, `indeterminate`, `error` or
1468
+ * `paused`. Default is `normal`.
1469
+ *
1470
+ * @platform win32,darwin
1471
+ */
1472
+ mode: 'none' | 'normal' | 'indeterminate' | 'error' | 'paused';
1473
+ }
1474
+ ): void;
1475
+ /**
1476
+ * Sets whether the window can be manually resized by the user.
1477
+ */
1478
+ setResizable(resizable: boolean): void;
1479
+ /**
1480
+ * Changes the attachment point for sheets on macOS. By default, sheets are
1481
+ * attached just below the window frame, but you may want to display them beneath a
1482
+ * custom client-rendered toolbar. For example:
1483
+ *
1484
+ * @platform darwin
1485
+ */
1486
+ setSheetOffset(offsetY: number, offsetX?: number): void;
1487
+ /**
1488
+ * Enters or leaves simple fullscreen mode.
1489
+ *
1490
+ * Simple fullscreen mode emulates the native fullscreen behavior found in versions
1491
+ * of macOS prior to Lion (10.7).
1492
+ *
1493
+ * @platform darwin
1494
+ */
1495
+ setSimpleFullScreen(flag: boolean): void;
1496
+ /**
1497
+ * Resizes the window to `width` and `height`. If `width` or `height` are below any
1498
+ * set minimum size constraints the window will snap to its minimum size.
1499
+ */
1500
+ setSize(width: number, height: number, animate?: boolean): void;
1501
+ /**
1502
+ * Contains the window's width and height.
1503
+ */
1504
+ getSize(): number[];
1505
+ /**
1506
+ * Sets the size of the content area.
1507
+ */
1508
+ setContentSize(width: number, height: number, animate?: boolean): void;
1509
+ /**
1510
+ * Gets the size of the content area.
1511
+ */
1512
+ getContentSize(): number[];
1513
+ /**
1514
+ * Resizes and moves the content area to the supplied bounds.
1515
+ */
1516
+ setContentBounds(bounds: Partial<Rectangle>, animate?: boolean): void;
1517
+ /**
1518
+ * Gets the bounds of the content area.
1519
+ */
1520
+ getContentBounds(): Rectangle;
1521
+ /**
1522
+ * Makes the window not show in the taskbar.
1523
+ *
1524
+ * @platform darwin,win32
1525
+ */
1526
+ setSkipTaskbar(skip: boolean): void;
1527
+ /**
1528
+ * Changes the title of native window to `title`.
1529
+ */
1530
+ setTitle(title: string): void;
1531
+ /**
1532
+ * Toggles the visibility of the tab bar if native tabs are enabled and there is
1533
+ * only one tab in the current window.
1534
+ *
1535
+ * @platform darwin
1536
+ */
1537
+ toggleTabBar(): void;
1538
+ /**
1539
+ * Adds a vibrancy effect to the window. Passing `null` or an empty string will
1540
+ * remove the vibrancy effect on the window.
1541
+ *
1542
+ * @platform darwin
1543
+ */
1544
+ setVibrancy(
1545
+ type:
1546
+ | (
1547
+ | 'titlebar'
1548
+ | 'selection'
1549
+ | 'menu'
1550
+ | 'popover'
1551
+ | 'sidebar'
1552
+ | 'header'
1553
+ | 'sheet'
1554
+ | 'window'
1555
+ | 'hud'
1556
+ | 'fullscreen-ui'
1557
+ | 'tooltip'
1558
+ | 'content'
1559
+ | 'under-window'
1560
+ | 'under-page'
1561
+ )
1562
+ | null
1563
+ ): void;
1564
+ /**
1565
+ * Sets whether the window should be visible on all workspaces.
1566
+ *
1567
+ * > [!NOTE] This API does nothing on Windows.
1568
+ * > [!NOTE] On macOS, Lynxtron currently applies only the window-level
1569
+ * > collection behaviors (`CanJoinAllSpaces` and, if requested,
1570
+ * > `FullScreenAuxiliary`). It does not currently implement Electron's Dock /
1571
+ * > process-type transformation.
1572
+ *
1573
+ * @platform darwin
1574
+ */
1575
+ setVisibleOnAllWorkspaces(
1576
+ visible: boolean,
1577
+ options?: VisibleOnAllWorkspacesOptions
1578
+ ): void;
1579
+ /**
1580
+ * Set a custom position for the traffic light buttons in frameless window. Passing
1581
+ * `null` will reset the position to default.
1582
+ *
1583
+ * @platform darwin
1584
+ */
1585
+ setTrafficLightPosition(position: Point | null): void;
1586
+ /**
1587
+ * Sets whether the window traffic light buttons should be visible.
1588
+ *
1589
+ * @platform darwin
1590
+ */
1591
+ setWindowButtonVisibility(visible: boolean): void;
1592
+ /**
1593
+ * Shows and gives focus to the window.
1594
+ */
1595
+ show(): void;
1596
+ /**
1597
+ * Shows the window but doesn't focus on it.
1598
+ */
1599
+ showInactive(): void;
1600
+ /**
1601
+ * Unhooks all of the window messages.
1602
+ *
1603
+ * @platform win32
1604
+ */
1605
+ unhookAllWindowMessages(): void;
1606
+ /**
1607
+ * Unhook the window message.
1608
+ *
1609
+ * @platform win32
1610
+ */
1611
+ unhookWindowMessage(message: number): void;
1612
+ /**
1613
+ * Unmaximizes the window.
1614
+ */
1615
+ unmaximize(): void;
1616
+ /**
1617
+ * A `boolean` property that determines whether the window menu bar should hide
1618
+ * itself automatically. Once set, the menu bar will only show when users press the
1619
+ * single `Alt` key.
1620
+ *
1621
+ * If the menu bar is already visible, setting this property to `true` won't hide
1622
+ * it immediately.
1623
+ *
1624
+ * @platform win32
1625
+ */
1626
+ autoHideMenuBar: boolean;
1627
+ /**
1628
+ * A `boolean` property that determines whether the window can be manually closed
1629
+ * by user.
1630
+ *
1631
+ * @platform darwin,win32
1632
+ */
1633
+ closable: boolean;
1634
+ /**
1635
+ * A `boolean` property that determines whether the window is focusable.
1636
+ *
1637
+ * @platform win32,darwin
1638
+ */
1639
+ focusable: boolean;
1640
+ /**
1641
+ * A `boolean` property that determines whether the window is in fullscreen mode.
1642
+ */
1643
+ fullScreen: boolean;
1644
+ /**
1645
+ * A `boolean` property that determines whether the maximize/zoom window button
1646
+ * toggles fullscreen mode or maximizes the window.
1647
+ */
1648
+ fullScreenable: boolean;
1649
+ /**
1650
+ * A `boolean` property that determines whether the window can be manually
1651
+ * maximized by user.
1652
+ *
1653
+ * @platform darwin,win32
1654
+ */
1655
+ maximizable: boolean;
1656
+ /**
1657
+ * A `boolean` property that determines whether the window can be manually
1658
+ * minimized by user.
1659
+ *
1660
+ * @platform darwin,win32
1661
+ */
1662
+ minimizable: boolean;
1663
+ /**
1664
+ * A `boolean` property that determines Whether the window can be moved by user.
1665
+ *
1666
+ * @platform darwin,win32
1667
+ */
1668
+ movable: boolean;
1669
+ /**
1670
+ * A `boolean` property that determines whether the window can be manually resized
1671
+ * by user.
1672
+ */
1673
+ resizable: boolean;
1674
+ /**
1675
+ * A `boolean` property that determines whether the window has a shadow.
1676
+ */
1677
+ shadow: boolean;
1678
+ /**
1679
+ * A `boolean` property that determines whether the window is in simple (pre-Lion)
1680
+ * fullscreen mode.
1681
+ */
1682
+ simpleFullScreen: boolean;
1683
+ /**
1684
+ * A `string` property that determines the title of the native window.
1685
+ *
1686
+ * > [!NOTE] Application content may present a different title from the native
1687
+ * window title.
1688
+ */
1689
+ title: string;
1690
+ /**
1691
+ * A `boolean` property that determines whether the window is visible on all
1692
+ * workspaces.
1693
+ *
1694
+ * > [!NOTE] Always returns false on Windows.
1695
+ *
1696
+ * @platform darwin
1697
+ */
1698
+ visibleOnAllWorkspaces: boolean;
1699
+ /**
1700
+ * A `boolean` property that determines whether the window is excluded from the
1701
+ * application’s Windows menu. `false` by default.
1702
+ *
1703
+ * @platform darwin
1704
+ */
1705
+ excludedFromShownWindowsMenu: boolean;
1706
+ /**
1707
+ * A `Integer` property representing the unique ID of the window. Each ID is unique
1708
+ * among all `BaseWindow` instances of the entire application.
1709
+ *
1710
+ */
1711
+ readonly id: number;
1712
+ }