@lynx-js/lynxtron 0.0.1 → 0.0.3
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.
- package/README.md +80 -0
- package/apis/api/app.d.ts +1848 -0
- package/apis/api/asar.d.ts +124 -0
- package/apis/api/base-window.d.ts +1712 -0
- package/apis/api/clipboard.d.ts +54 -0
- package/apis/api/command-line.d.ts +46 -0
- package/apis/api/context-bridge.d.ts +8 -0
- package/apis/api/devtool.d.ts +34 -0
- package/apis/api/dialog.d.ts +633 -0
- package/apis/api/dock.d.ts +88 -0
- package/apis/api/environment.d.ts +9 -0
- package/apis/api/event.d.ts +8 -0
- package/apis/api/jump-list-item.d.ts +83 -0
- package/apis/api/lynx-library.d.ts +7 -0
- package/apis/api/lynx-template-bundle.d.ts +32 -0
- package/apis/api/lynx-template-data.d.ts +10 -0
- package/apis/api/lynx-update-meta.d.ts +16 -0
- package/apis/api/lynx-window.d.ts +405 -0
- package/apis/api/menu.d.ts +96 -0
- package/apis/api/native-image.d.ts +268 -0
- package/apis/api/notification-response.d.ts +26 -0
- package/apis/api/notification.d.ts +242 -0
- package/apis/api/power-monitor.d.ts +121 -0
- package/apis/api/process-metric.d.ts +93 -0
- package/apis/api/protocol.d.ts +54 -0
- package/apis/api/screen.d.ts +222 -0
- package/apis/api/shell.d.ts +124 -0
- package/apis/api/task.d.ts +39 -0
- package/apis/api/touch-bar.d.ts +206 -0
- package/apis/api/tray.d.ts +44 -0
- package/apis/api/utility-process.d.ts +73 -0
- package/apis/lynx.d.ts +15 -0
- package/apis/lynxtron.d.ts +39 -0
- package/apis/structures/point.d.ts +10 -0
- package/apis/structures/rectangle.d.ts +22 -0
- package/apis/structures/size.d.ts +8 -0
- package/apis/web-host.d.ts +24 -0
- package/cli.js +28 -0
- package/context-bridge.js +6 -0
- package/fuses-cli.js +143 -0
- package/fuses.js +299 -0
- package/install.js +127 -0
- package/lynx.js +1 -0
- package/lynxtron.js +43 -0
- package/lynxtron_bin.js +10 -0
- package/native-paths.cjs +38 -0
- package/package.json +71 -4
- package/utils/download.js +72 -0
- package/utils/env-config.js +35 -0
- package/web-host/index.js +110 -0
- package/web-worker.js +12 -0
|
@@ -0,0 +1,121 @@
|
|
|
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
|
+
|
|
7
|
+
export interface PowerMonitor extends EventEmitter {
|
|
8
|
+
// Docs: https://electronjs.org/docs/api/power-monitor
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Emitted when the system is about to lock the screen.
|
|
12
|
+
*
|
|
13
|
+
* @platform darwin,win32
|
|
14
|
+
*/
|
|
15
|
+
on(event: 'lock-screen', listener: Function): this;
|
|
16
|
+
once(event: 'lock-screen', listener: Function): this;
|
|
17
|
+
addListener(event: 'lock-screen', listener: Function): this;
|
|
18
|
+
removeListener(event: 'lock-screen', listener: Function): this;
|
|
19
|
+
/**
|
|
20
|
+
* Emitted when the system changes to AC power.
|
|
21
|
+
*
|
|
22
|
+
* @platform darwin,win32
|
|
23
|
+
*/
|
|
24
|
+
on(event: 'on-ac', listener: Function): this;
|
|
25
|
+
once(event: 'on-ac', listener: Function): this;
|
|
26
|
+
addListener(event: 'on-ac', listener: Function): this;
|
|
27
|
+
removeListener(event: 'on-ac', listener: Function): this;
|
|
28
|
+
/**
|
|
29
|
+
* Emitted when system changes to battery power.
|
|
30
|
+
*
|
|
31
|
+
* @platform darwin
|
|
32
|
+
*/
|
|
33
|
+
on(event: 'on-battery', listener: Function): this;
|
|
34
|
+
once(event: 'on-battery', listener: Function): this;
|
|
35
|
+
addListener(event: 'on-battery', listener: Function): this;
|
|
36
|
+
removeListener(event: 'on-battery', listener: Function): this;
|
|
37
|
+
/**
|
|
38
|
+
* Emitted when system is resuming.
|
|
39
|
+
*/
|
|
40
|
+
on(event: 'resume', listener: Function): this;
|
|
41
|
+
once(event: 'resume', listener: Function): this;
|
|
42
|
+
addListener(event: 'resume', listener: Function): this;
|
|
43
|
+
removeListener(event: 'resume', listener: Function): this;
|
|
44
|
+
/**
|
|
45
|
+
* Emitted when the system is about to reboot or shut down. If the event handler
|
|
46
|
+
* invokes `e.preventDefault()`, Electron will attempt to delay system shutdown in
|
|
47
|
+
* order for the app to exit cleanly. If `e.preventDefault()` is called, the app
|
|
48
|
+
* should exit as soon as possible by calling something like `app.quit()`.
|
|
49
|
+
*
|
|
50
|
+
* @platform linux,darwin
|
|
51
|
+
*/
|
|
52
|
+
on(event: 'shutdown', listener: Function): this;
|
|
53
|
+
once(event: 'shutdown', listener: Function): this;
|
|
54
|
+
addListener(event: 'shutdown', listener: Function): this;
|
|
55
|
+
removeListener(event: 'shutdown', listener: Function): this;
|
|
56
|
+
/**
|
|
57
|
+
* Emitted when the system is suspending.
|
|
58
|
+
*/
|
|
59
|
+
on(event: 'suspend', listener: Function): this;
|
|
60
|
+
once(event: 'suspend', listener: Function): this;
|
|
61
|
+
addListener(event: 'suspend', listener: Function): this;
|
|
62
|
+
removeListener(event: 'suspend', listener: Function): this;
|
|
63
|
+
/**
|
|
64
|
+
* Emitted as soon as the systems screen is unlocked.
|
|
65
|
+
*
|
|
66
|
+
* @platform darwin,win32
|
|
67
|
+
*/
|
|
68
|
+
on(event: 'unlock-screen', listener: Function): this;
|
|
69
|
+
once(event: 'unlock-screen', listener: Function): this;
|
|
70
|
+
addListener(event: 'unlock-screen', listener: Function): this;
|
|
71
|
+
removeListener(event: 'unlock-screen', listener: Function): this;
|
|
72
|
+
/**
|
|
73
|
+
* Emitted when a login session is activated. See documentation for more
|
|
74
|
+
* information.
|
|
75
|
+
*
|
|
76
|
+
* @platform darwin
|
|
77
|
+
*/
|
|
78
|
+
on(event: 'user-did-become-active', listener: Function): this;
|
|
79
|
+
once(event: 'user-did-become-active', listener: Function): this;
|
|
80
|
+
addListener(event: 'user-did-become-active', listener: Function): this;
|
|
81
|
+
removeListener(event: 'user-did-become-active', listener: Function): this;
|
|
82
|
+
/**
|
|
83
|
+
* Emitted when a login session is deactivated. See documentation for more
|
|
84
|
+
* information.
|
|
85
|
+
*
|
|
86
|
+
* @platform darwin
|
|
87
|
+
*/
|
|
88
|
+
on(event: 'user-did-resign-active', listener: Function): this;
|
|
89
|
+
once(event: 'user-did-resign-active', listener: Function): this;
|
|
90
|
+
addListener(event: 'user-did-resign-active', listener: Function): this;
|
|
91
|
+
removeListener(event: 'user-did-resign-active', listener: Function): this;
|
|
92
|
+
/**
|
|
93
|
+
* The system's current state. Can be `active`, `idle`, `locked` or `unknown`.
|
|
94
|
+
*
|
|
95
|
+
* Calculate the system idle state. `idleThreshold` is the amount of time (in
|
|
96
|
+
* seconds) before considered idle. `locked` is available on supported systems
|
|
97
|
+
* only.
|
|
98
|
+
*/
|
|
99
|
+
getSystemIdleState(
|
|
100
|
+
idleThreshold: number
|
|
101
|
+
): 'active' | 'idle' | 'locked' | 'unknown';
|
|
102
|
+
/**
|
|
103
|
+
* Idle time in seconds
|
|
104
|
+
*
|
|
105
|
+
* Calculate system idle time in seconds.
|
|
106
|
+
*/
|
|
107
|
+
getSystemIdleTime(): number;
|
|
108
|
+
/**
|
|
109
|
+
* Whether the system is on battery power.
|
|
110
|
+
*
|
|
111
|
+
* To monitor for changes in this property, use the `on-battery` and `on-ac`
|
|
112
|
+
* events.
|
|
113
|
+
*/
|
|
114
|
+
isOnBatteryPower(): boolean;
|
|
115
|
+
/**
|
|
116
|
+
* A `boolean` property. True if the system is on battery power.
|
|
117
|
+
*
|
|
118
|
+
* See `powerMonitor.isOnBatteryPower()`.
|
|
119
|
+
*/
|
|
120
|
+
onBatteryPower: boolean;
|
|
121
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
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
|
+
export interface CPUUsage {
|
|
6
|
+
/**
|
|
7
|
+
* Total seconds of CPU time used since process startup.
|
|
8
|
+
*/
|
|
9
|
+
cumulativeCPUUsage?: number;
|
|
10
|
+
/**
|
|
11
|
+
* The number of average idle CPU wakeups per second since the last call to
|
|
12
|
+
* getCPUUsage. First call returns 0. Will always return 0 on Windows.
|
|
13
|
+
*/
|
|
14
|
+
idleWakeupsPerSecond: number;
|
|
15
|
+
/**
|
|
16
|
+
* Percentage of CPU used since the last call to getCPUUsage. First call returns 0.
|
|
17
|
+
*/
|
|
18
|
+
percentCPUUsage: number;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface MemoryInfo {
|
|
22
|
+
/**
|
|
23
|
+
* The maximum amount of memory that has ever been pinned to actual physical RAM.
|
|
24
|
+
*/
|
|
25
|
+
peakWorkingSetSize: number;
|
|
26
|
+
/**
|
|
27
|
+
* The amount of memory not shared by other processes, such as script heap or
|
|
28
|
+
* other private runtime content.
|
|
29
|
+
*
|
|
30
|
+
* @platform win32
|
|
31
|
+
*/
|
|
32
|
+
privateBytes?: number;
|
|
33
|
+
/**
|
|
34
|
+
* The amount of memory currently pinned to actual physical RAM.
|
|
35
|
+
*/
|
|
36
|
+
workingSetSize: number;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface ProcessMetric {
|
|
40
|
+
/**
|
|
41
|
+
* CPU usage of the process.
|
|
42
|
+
*/
|
|
43
|
+
cpu: CPUUsage;
|
|
44
|
+
/**
|
|
45
|
+
* Creation time for this process. The time is represented as number of
|
|
46
|
+
* milliseconds since epoch. Since the `pid` can be reused after a process dies, it
|
|
47
|
+
* is useful to use both the `pid` and the `creationTime` to uniquely identify a
|
|
48
|
+
* process.
|
|
49
|
+
*/
|
|
50
|
+
creationTime: number;
|
|
51
|
+
/**
|
|
52
|
+
* One of the following values:
|
|
53
|
+
*
|
|
54
|
+
* @platform win32
|
|
55
|
+
*/
|
|
56
|
+
integrityLevel?: 'untrusted' | 'low' | 'medium' | 'high' | 'unknown';
|
|
57
|
+
/**
|
|
58
|
+
* Memory information for the process.
|
|
59
|
+
*/
|
|
60
|
+
memory: MemoryInfo;
|
|
61
|
+
/**
|
|
62
|
+
* The name of the process. Examples for utility: `Audio Service`, `Content
|
|
63
|
+
* Decryption Module Service`, `Network Service`, `Video Capture`, etc.
|
|
64
|
+
*/
|
|
65
|
+
name?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Process id of the process.
|
|
68
|
+
*/
|
|
69
|
+
pid: number;
|
|
70
|
+
/**
|
|
71
|
+
* Whether the process is sandboxed on OS level.
|
|
72
|
+
*
|
|
73
|
+
* @platform darwin,win32
|
|
74
|
+
*/
|
|
75
|
+
sandboxed?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* The non-localized name of the process.
|
|
78
|
+
*/
|
|
79
|
+
serviceName?: string;
|
|
80
|
+
/**
|
|
81
|
+
* Process type. One of the following values:
|
|
82
|
+
*/
|
|
83
|
+
type:
|
|
84
|
+
| 'Browser'
|
|
85
|
+
| 'Tab'
|
|
86
|
+
| 'Utility'
|
|
87
|
+
| 'Zygote'
|
|
88
|
+
| 'Sandbox helper'
|
|
89
|
+
| 'GPU'
|
|
90
|
+
| 'Pepper Plugin'
|
|
91
|
+
| 'Pepper Plugin Broker'
|
|
92
|
+
| 'Unknown';
|
|
93
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
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
|
+
export interface ResourceRequest {
|
|
6
|
+
resourceType: string;
|
|
7
|
+
scheme: string;
|
|
8
|
+
url: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface ResourceResponse {
|
|
12
|
+
url: string;
|
|
13
|
+
statusCode: number;
|
|
14
|
+
data: Buffer;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type ProtocolHandler = (
|
|
18
|
+
request: ResourceRequest
|
|
19
|
+
) => ResourceResponse | Promise<ResourceResponse> | false | undefined;
|
|
20
|
+
|
|
21
|
+
export interface ProtocolRewriteRequest {
|
|
22
|
+
scheme: string;
|
|
23
|
+
url: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export type ProtocolRequestRewriter = (
|
|
27
|
+
request: ProtocolRewriteRequest
|
|
28
|
+
) => string | false | undefined;
|
|
29
|
+
|
|
30
|
+
export interface Protocol {
|
|
31
|
+
/**
|
|
32
|
+
* Register a resource handler for a URL scheme such as `app`.
|
|
33
|
+
*
|
|
34
|
+
* Returning `false` or `undefined` falls back to the normal Lynx resource
|
|
35
|
+
* loading path. Return a Promise when the response data is produced
|
|
36
|
+
* asynchronously.
|
|
37
|
+
*/
|
|
38
|
+
handle(scheme: string, handler: ProtocolHandler): void;
|
|
39
|
+
/**
|
|
40
|
+
* Whether a handler is registered for `scheme`.
|
|
41
|
+
*/
|
|
42
|
+
isProtocolHandled(scheme: string): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Remove the handler registered for `scheme`.
|
|
45
|
+
*/
|
|
46
|
+
unhandle(scheme: string): void;
|
|
47
|
+
/**
|
|
48
|
+
* Rewrite a resource request URL before protocol handlers and fallback
|
|
49
|
+
* loaders run. Pass `null` or `undefined` to clear the current rewriter.
|
|
50
|
+
*/
|
|
51
|
+
setRequestRewriter(handler: ProtocolRequestRewriter | null | undefined): void;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export declare const protocol: Protocol;
|
|
@@ -0,0 +1,222 @@
|
|
|
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 { Point } from '../structures/point';
|
|
6
|
+
import { Size } from '../structures/size';
|
|
7
|
+
import { Rectangle } from '../structures/rectangle';
|
|
8
|
+
import { BaseWindow } from './base-window';
|
|
9
|
+
import { EventEmitter } from 'node:events';
|
|
10
|
+
|
|
11
|
+
export interface Display {
|
|
12
|
+
/**
|
|
13
|
+
* Can be `available`, `unavailable`, `unknown`.
|
|
14
|
+
*/
|
|
15
|
+
accelerometerSupport: 'available' | 'unavailable' | 'unknown';
|
|
16
|
+
/**
|
|
17
|
+
* the bounds of the display in DIP points.
|
|
18
|
+
*/
|
|
19
|
+
bounds: Rectangle;
|
|
20
|
+
/**
|
|
21
|
+
* The number of bits per pixel.
|
|
22
|
+
*/
|
|
23
|
+
colorDepth: number;
|
|
24
|
+
/**
|
|
25
|
+
* represent a color space (three-dimensional object which contains all realizable
|
|
26
|
+
* color combinations) for the purpose of color conversions.
|
|
27
|
+
*/
|
|
28
|
+
colorSpace: string;
|
|
29
|
+
/**
|
|
30
|
+
* The number of bits per color component.
|
|
31
|
+
*/
|
|
32
|
+
depthPerComponent: number;
|
|
33
|
+
/**
|
|
34
|
+
* `true` if the display is detected by the system.
|
|
35
|
+
*/
|
|
36
|
+
detected: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* The display refresh rate.
|
|
39
|
+
*/
|
|
40
|
+
displayFrequency: number;
|
|
41
|
+
/**
|
|
42
|
+
* Unique identifier associated with the display. A value of of -1 means the
|
|
43
|
+
* display is invalid or the correct `id` is not yet known, and a value of -10
|
|
44
|
+
* means the display is a virtual display assigned to a unified desktop.
|
|
45
|
+
*/
|
|
46
|
+
id: number;
|
|
47
|
+
/**
|
|
48
|
+
* `true` for an internal display and `false` for an external display.
|
|
49
|
+
*/
|
|
50
|
+
internal: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* User-friendly label, determined by the platform.
|
|
53
|
+
*/
|
|
54
|
+
label: string;
|
|
55
|
+
/**
|
|
56
|
+
* Maximum cursor size in native pixels.
|
|
57
|
+
*/
|
|
58
|
+
maximumCursorSize: Size;
|
|
59
|
+
/**
|
|
60
|
+
* Whether or not the display is a monochrome display.
|
|
61
|
+
*/
|
|
62
|
+
monochrome: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Returns the display's origin in pixel coordinates. Only available on windowing
|
|
65
|
+
* systems like X11 that position displays in pixel coordinates.
|
|
66
|
+
*/
|
|
67
|
+
nativeOrigin: Point;
|
|
68
|
+
/**
|
|
69
|
+
* Can be 0, 90, 180, 270, represents screen rotation in clock-wise degrees.
|
|
70
|
+
*/
|
|
71
|
+
rotation: number;
|
|
72
|
+
/**
|
|
73
|
+
* Output device's pixel scale factor.
|
|
74
|
+
*/
|
|
75
|
+
scaleFactor: number;
|
|
76
|
+
size: Size;
|
|
77
|
+
/**
|
|
78
|
+
* Can be `available`, `unavailable`, `unknown`.
|
|
79
|
+
*/
|
|
80
|
+
touchSupport: 'available' | 'unavailable' | 'unknown';
|
|
81
|
+
/**
|
|
82
|
+
* the work area of the display in DIP points.
|
|
83
|
+
*/
|
|
84
|
+
workArea: Rectangle;
|
|
85
|
+
/**
|
|
86
|
+
* The size of the work area.
|
|
87
|
+
*/
|
|
88
|
+
workAreaSize: Size;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface Screen extends EventEmitter {
|
|
92
|
+
/**
|
|
93
|
+
* Emitted when `newDisplay` has been added.
|
|
94
|
+
*/
|
|
95
|
+
on(
|
|
96
|
+
event: 'display-added',
|
|
97
|
+
listener: (event: Event, newDisplay: Display) => void
|
|
98
|
+
): this;
|
|
99
|
+
off(
|
|
100
|
+
event: 'display-added',
|
|
101
|
+
listener: (event: Event, newDisplay: Display) => void
|
|
102
|
+
): this;
|
|
103
|
+
once(
|
|
104
|
+
event: 'display-added',
|
|
105
|
+
listener: (event: Event, newDisplay: Display) => void
|
|
106
|
+
): this;
|
|
107
|
+
addListener(
|
|
108
|
+
event: 'display-added',
|
|
109
|
+
listener: (event: Event, newDisplay: Display) => void
|
|
110
|
+
): this;
|
|
111
|
+
removeListener(
|
|
112
|
+
event: 'display-added',
|
|
113
|
+
listener: (event: Event, newDisplay: Display) => void
|
|
114
|
+
): this;
|
|
115
|
+
/**
|
|
116
|
+
* Emitted when one or more metrics change in a `display`. The `changedMetrics` is
|
|
117
|
+
* an array of strings that describe the changes. Possible changes are `bounds`,
|
|
118
|
+
* `workArea`, `scaleFactor` and `rotation`.
|
|
119
|
+
*/
|
|
120
|
+
on(
|
|
121
|
+
event: 'display-metrics-changed',
|
|
122
|
+
listener: (event: Event, display: Display, changedMetrics: string[]) => void
|
|
123
|
+
): this;
|
|
124
|
+
off(
|
|
125
|
+
event: 'display-metrics-changed',
|
|
126
|
+
listener: (event: Event, display: Display, changedMetrics: string[]) => void
|
|
127
|
+
): this;
|
|
128
|
+
once(
|
|
129
|
+
event: 'display-metrics-changed',
|
|
130
|
+
listener: (event: Event, display: Display, changedMetrics: string[]) => void
|
|
131
|
+
): this;
|
|
132
|
+
addListener(
|
|
133
|
+
event: 'display-metrics-changed',
|
|
134
|
+
listener: (event: Event, display: Display, changedMetrics: string[]) => void
|
|
135
|
+
): this;
|
|
136
|
+
removeListener(
|
|
137
|
+
event: 'display-metrics-changed',
|
|
138
|
+
listener: (event: Event, display: Display, changedMetrics: string[]) => void
|
|
139
|
+
): this;
|
|
140
|
+
/**
|
|
141
|
+
* Emitted when `oldDisplay` has been removed.
|
|
142
|
+
*/
|
|
143
|
+
on(
|
|
144
|
+
event: 'display-removed',
|
|
145
|
+
listener: (event: Event, oldDisplay: Display) => void
|
|
146
|
+
): this;
|
|
147
|
+
off(
|
|
148
|
+
event: 'display-removed',
|
|
149
|
+
listener: (event: Event, oldDisplay: Display) => void
|
|
150
|
+
): this;
|
|
151
|
+
once(
|
|
152
|
+
event: 'display-removed',
|
|
153
|
+
listener: (event: Event, oldDisplay: Display) => void
|
|
154
|
+
): this;
|
|
155
|
+
addListener(
|
|
156
|
+
event: 'display-removed',
|
|
157
|
+
listener: (event: Event, oldDisplay: Display) => void
|
|
158
|
+
): this;
|
|
159
|
+
removeListener(
|
|
160
|
+
event: 'display-removed',
|
|
161
|
+
listener: (event: Event, oldDisplay: Display) => void
|
|
162
|
+
): this;
|
|
163
|
+
/**
|
|
164
|
+
* Converts a screen DIP point to a screen physical point. The DPI scale is
|
|
165
|
+
* performed relative to the display containing the DIP point.
|
|
166
|
+
*
|
|
167
|
+
* Not currently supported on Wayland.
|
|
168
|
+
*
|
|
169
|
+
* @platform win32,linux
|
|
170
|
+
*/
|
|
171
|
+
dipToScreenPoint(point: Point): Point;
|
|
172
|
+
/**
|
|
173
|
+
* Converts a screen DIP rect to a screen physical rect. The DPI scale is performed
|
|
174
|
+
* relative to the display nearest to `window`. If `window` is null, scaling will
|
|
175
|
+
* be performed to the display nearest to `rect`.
|
|
176
|
+
*
|
|
177
|
+
* @platform win32
|
|
178
|
+
*/
|
|
179
|
+
dipToScreenRect(window: BaseWindow | null, rect: Rectangle): Rectangle;
|
|
180
|
+
/**
|
|
181
|
+
* An array of displays that are currently available.
|
|
182
|
+
*/
|
|
183
|
+
getAllDisplays(): Display[];
|
|
184
|
+
/**
|
|
185
|
+
* The current absolute position of the mouse pointer.
|
|
186
|
+
*
|
|
187
|
+
* > [!NOTE] The return value is a DIP point, not a screen physical point.
|
|
188
|
+
*/
|
|
189
|
+
getCursorScreenPoint(): Point;
|
|
190
|
+
/**
|
|
191
|
+
* The display that most closely intersects the provided bounds.
|
|
192
|
+
*/
|
|
193
|
+
getDisplayMatching(rect: Rectangle): Display;
|
|
194
|
+
/**
|
|
195
|
+
* The display nearest the specified point.
|
|
196
|
+
*/
|
|
197
|
+
getDisplayNearestPoint(point: Point): Display;
|
|
198
|
+
/**
|
|
199
|
+
* The primary display.
|
|
200
|
+
*/
|
|
201
|
+
getPrimaryDisplay(): Display;
|
|
202
|
+
/**
|
|
203
|
+
* Converts a screen physical point to a screen DIP point. The DPI scale is
|
|
204
|
+
* performed relative to the display containing the physical point.
|
|
205
|
+
*
|
|
206
|
+
* Not currently supported on Wayland - if used there it will return the point
|
|
207
|
+
* passed in with no changes.
|
|
208
|
+
*
|
|
209
|
+
* @platform win32,linux
|
|
210
|
+
*/
|
|
211
|
+
screenToDipPoint(point: Point): Point;
|
|
212
|
+
/**
|
|
213
|
+
* Converts a screen physical rect to a screen DIP rect. The DPI scale is performed
|
|
214
|
+
* relative to the display nearest to `window`. If `window` is null, scaling will
|
|
215
|
+
* be performed to the display nearest to `rect`.
|
|
216
|
+
*
|
|
217
|
+
* @platform win32
|
|
218
|
+
*/
|
|
219
|
+
screenToDipRect(window: BaseWindow | null, rect: Rectangle): Rectangle;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
export declare const screen: Screen;
|
|
@@ -0,0 +1,124 @@
|
|
|
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
|
+
export interface OpenExternalOptions {
|
|
6
|
+
/**
|
|
7
|
+
* `true` to bring the opened application to the foreground. The default is `true`.
|
|
8
|
+
*
|
|
9
|
+
* @platform darwin
|
|
10
|
+
*/
|
|
11
|
+
activate?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* The working directory.
|
|
14
|
+
*
|
|
15
|
+
* @platform win32
|
|
16
|
+
*/
|
|
17
|
+
workingDirectory?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Indicates a user initiated launch that enables tracking of frequently used
|
|
20
|
+
* programs and other behaviors. The default is `false`.
|
|
21
|
+
*
|
|
22
|
+
* @platform win32
|
|
23
|
+
*/
|
|
24
|
+
logUsage?: boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface ShortcutDetails {
|
|
28
|
+
/**
|
|
29
|
+
* The Application User Model ID. Default is empty.
|
|
30
|
+
*/
|
|
31
|
+
appUserModelId?: string;
|
|
32
|
+
/**
|
|
33
|
+
* The arguments to be applied to `target` when launching from this shortcut.
|
|
34
|
+
* Default is empty.
|
|
35
|
+
*/
|
|
36
|
+
args?: string;
|
|
37
|
+
/**
|
|
38
|
+
* The working directory. Default is empty.
|
|
39
|
+
*/
|
|
40
|
+
cwd?: string;
|
|
41
|
+
/**
|
|
42
|
+
* The description of the shortcut. Default is empty.
|
|
43
|
+
*/
|
|
44
|
+
description?: string;
|
|
45
|
+
/**
|
|
46
|
+
* The path to the icon, can be a DLL or EXE. `icon` and `iconIndex` have to be set
|
|
47
|
+
* together. Default is empty, which uses the target's icon.
|
|
48
|
+
*/
|
|
49
|
+
icon?: string;
|
|
50
|
+
/**
|
|
51
|
+
* The resource ID of icon when `icon` is a DLL or EXE. Default is 0.
|
|
52
|
+
*/
|
|
53
|
+
iconIndex?: number;
|
|
54
|
+
/**
|
|
55
|
+
* The target to launch from this shortcut.
|
|
56
|
+
*/
|
|
57
|
+
target: string;
|
|
58
|
+
/**
|
|
59
|
+
* The Application Toast Activator CLSID. Needed for participating in Action
|
|
60
|
+
* Center.
|
|
61
|
+
*/
|
|
62
|
+
toastActivatorClsid?: string;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface Shell {
|
|
66
|
+
/**
|
|
67
|
+
* Play the beep sound.
|
|
68
|
+
*/
|
|
69
|
+
beep(): void;
|
|
70
|
+
/**
|
|
71
|
+
* Open the given external protocol URL in the desktop's default manner. (For
|
|
72
|
+
* example, mailto: URLs in the user's default mail agent).
|
|
73
|
+
*/
|
|
74
|
+
openExternal(url: string, options?: OpenExternalOptions): Promise<void>;
|
|
75
|
+
/**
|
|
76
|
+
* Resolves with a string containing the error message corresponding to the failure
|
|
77
|
+
* if a failure occurred, otherwise "".
|
|
78
|
+
*
|
|
79
|
+
* Open the given file in the desktop's default manner.
|
|
80
|
+
*/
|
|
81
|
+
openPath(path: string): Promise<string>;
|
|
82
|
+
/**
|
|
83
|
+
* Resolves the shortcut link at `shortcutPath`.
|
|
84
|
+
*
|
|
85
|
+
* An exception will be thrown when any error happens.
|
|
86
|
+
*
|
|
87
|
+
* @platform win32
|
|
88
|
+
*/
|
|
89
|
+
readShortcutLink(shortcutPath: string): ShortcutDetails;
|
|
90
|
+
/**
|
|
91
|
+
* Show the given file in a file manager. If possible, select the file.
|
|
92
|
+
*/
|
|
93
|
+
showItemInFolder(fullPath: string): void;
|
|
94
|
+
/**
|
|
95
|
+
* Resolves when the operation has been completed. Rejects if there was an error
|
|
96
|
+
* while deleting the requested item.
|
|
97
|
+
*
|
|
98
|
+
* This moves a path to the OS-specific trash location (Trash on macOS, Recycle Bin
|
|
99
|
+
* on Windows, and a desktop-environment-specific location on Linux).
|
|
100
|
+
*/
|
|
101
|
+
trashItem(path: string): Promise<void>;
|
|
102
|
+
/**
|
|
103
|
+
* Whether the shortcut was created successfully.
|
|
104
|
+
*
|
|
105
|
+
* Creates or updates a shortcut link at `shortcutPath`.
|
|
106
|
+
*
|
|
107
|
+
* @platform win32
|
|
108
|
+
*/
|
|
109
|
+
writeShortcutLink(
|
|
110
|
+
shortcutPath: string,
|
|
111
|
+
operation: 'create' | 'update' | 'replace',
|
|
112
|
+
options: ShortcutDetails
|
|
113
|
+
): boolean;
|
|
114
|
+
/**
|
|
115
|
+
* Whether the shortcut was created successfully.
|
|
116
|
+
*
|
|
117
|
+
* Creates or updates a shortcut link at `shortcutPath`.
|
|
118
|
+
*
|
|
119
|
+
* @platform win32
|
|
120
|
+
*/
|
|
121
|
+
writeShortcutLink(shortcutPath: string, options: ShortcutDetails): boolean;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export declare const shell: Shell;
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
export interface Task {
|
|
6
|
+
/**
|
|
7
|
+
* The command line arguments when `program` is executed.
|
|
8
|
+
*/
|
|
9
|
+
arguments: string;
|
|
10
|
+
/**
|
|
11
|
+
* Description of this task.
|
|
12
|
+
*/
|
|
13
|
+
description: string;
|
|
14
|
+
/**
|
|
15
|
+
* The icon index in the icon file. If an icon file consists of two or more icons,
|
|
16
|
+
* set this value to identify the icon. If an icon file consists of one icon, this
|
|
17
|
+
* value is 0.
|
|
18
|
+
*/
|
|
19
|
+
iconIndex: number;
|
|
20
|
+
/**
|
|
21
|
+
* The absolute path to an icon to be displayed in a JumpList, which can be an
|
|
22
|
+
* arbitrary resource file that contains an icon. You can usually specify
|
|
23
|
+
* `process.execPath` to show the icon of the program.
|
|
24
|
+
*/
|
|
25
|
+
iconPath: string;
|
|
26
|
+
/**
|
|
27
|
+
* Path of the program to execute, usually you should specify `process.execPath`
|
|
28
|
+
* which opens the current program.
|
|
29
|
+
*/
|
|
30
|
+
program: string;
|
|
31
|
+
/**
|
|
32
|
+
* The string to be displayed in a JumpList.
|
|
33
|
+
*/
|
|
34
|
+
title: string;
|
|
35
|
+
/**
|
|
36
|
+
* The working directory. Default is empty.
|
|
37
|
+
*/
|
|
38
|
+
workingDirectory?: string;
|
|
39
|
+
}
|