@miniben90/x-win 3.2.0 → 3.4.0
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 +113 -115
- package/index.d.ts +115 -106
- package/index.js +533 -269
- package/package.json +81 -34
package/README.md
CHANGED
|
@@ -27,11 +27,11 @@ yarn add @miniben90/x-win
|
|
|
27
27
|
`exemple.ts`:
|
|
28
28
|
|
|
29
29
|
```typescript
|
|
30
|
-
import { activeWindow, type WindowInfo } from '@miniben90/x-win'
|
|
30
|
+
import { activeWindow, type WindowInfo } from '@miniben90/x-win'
|
|
31
31
|
|
|
32
|
-
const currentWindow: WindowInfo = activeWindow()
|
|
32
|
+
const currentWindow: WindowInfo = activeWindow()
|
|
33
33
|
|
|
34
|
-
console.log(currentWindow)
|
|
34
|
+
console.log(currentWindow)
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
`response`:
|
|
@@ -64,13 +64,11 @@ console.log(currentWindow);
|
|
|
64
64
|
You can also use asynchronous methods instead. To do so, you just have to use `activeWindowAsync`, for example:
|
|
65
65
|
|
|
66
66
|
```typescript
|
|
67
|
-
import { activeWindowAsync, type WindowInfo } from '@miniben90/x-win'
|
|
68
|
-
|
|
69
|
-
activeWindow()
|
|
70
|
-
.then((currentWindow: WindowInfo) => {
|
|
71
|
-
console.log(currentWindow);
|
|
72
|
-
});
|
|
67
|
+
import { activeWindowAsync, type WindowInfo } from '@miniben90/x-win'
|
|
73
68
|
|
|
69
|
+
activeWindow().then((currentWindow: WindowInfo) => {
|
|
70
|
+
console.log(currentWindow)
|
|
71
|
+
})
|
|
74
72
|
```
|
|
75
73
|
|
|
76
74
|
### Get a list of open windows with information
|
|
@@ -78,78 +76,78 @@ activeWindow()
|
|
|
78
76
|
`exemple.ts`:
|
|
79
77
|
|
|
80
78
|
```typescript
|
|
81
|
-
import { openWindows, type WindowInfo } from '@miniben90/x-win'
|
|
79
|
+
import { openWindows, type WindowInfo } from '@miniben90/x-win'
|
|
82
80
|
|
|
83
|
-
const windows: WindowInfo[] = openWindows()
|
|
81
|
+
const windows: WindowInfo[] = openWindows()
|
|
84
82
|
|
|
85
|
-
console.log(windows)
|
|
83
|
+
console.log(windows)
|
|
86
84
|
```
|
|
87
85
|
|
|
88
86
|
`response`:
|
|
89
87
|
|
|
90
88
|
```javascript
|
|
91
|
-
[
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
89
|
+
;[
|
|
90
|
+
{
|
|
91
|
+
id: 26148,
|
|
92
|
+
info: {
|
|
93
|
+
execName: 'Code',
|
|
94
|
+
name: 'Visual Studio Code',
|
|
95
|
+
path: 'C:\\Users\\miniben\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe',
|
|
96
|
+
processId: 26148,
|
|
97
|
+
},
|
|
98
|
+
os: 'win32',
|
|
99
|
+
position: {
|
|
100
|
+
height: 1048,
|
|
101
|
+
width: 1936,
|
|
102
|
+
x: -8,
|
|
103
|
+
y: -8,
|
|
104
|
+
isFullScreen: true,
|
|
105
|
+
},
|
|
106
|
+
title: '● README.md - x-win - Visual Studio Code',
|
|
107
|
+
usage: {
|
|
108
|
+
memory: 113270784,
|
|
109
|
+
},
|
|
110
|
+
url: '',
|
|
98
111
|
},
|
|
99
|
-
|
|
100
|
-
position: {
|
|
101
|
-
height: 1048,
|
|
102
|
-
width: 1936,
|
|
103
|
-
x: -8,
|
|
104
|
-
y: -8,
|
|
105
|
-
isFullScreen: true
|
|
106
|
-
},
|
|
107
|
-
title: "● README.md - x-win - Visual Studio Code",
|
|
108
|
-
usage: {
|
|
109
|
-
memory: 113270784
|
|
110
|
-
},
|
|
111
|
-
url: ""
|
|
112
|
-
}]
|
|
112
|
+
]
|
|
113
113
|
```
|
|
114
114
|
|
|
115
115
|
You can also use asynchronous methods instead. To do so, you just have to use `openWindowsAsync`, for example:
|
|
116
116
|
|
|
117
117
|
```typescript
|
|
118
|
-
import { openWindowsAsync, type WindowInfo } from '@miniben90/x-win'
|
|
119
|
-
|
|
120
|
-
openWindowsAsync()
|
|
121
|
-
.then((windows: WindowInfo[]) => {
|
|
122
|
-
console.log(windows);
|
|
123
|
-
});
|
|
118
|
+
import { openWindowsAsync, type WindowInfo } from '@miniben90/x-win'
|
|
124
119
|
|
|
120
|
+
openWindowsAsync().then((windows: WindowInfo[]) => {
|
|
121
|
+
console.log(windows)
|
|
122
|
+
})
|
|
125
123
|
```
|
|
126
124
|
|
|
127
125
|
### Subscribe to get the current active window
|
|
128
126
|
|
|
129
127
|
Thread will be start to check every `100ms` for a new active window (checking window title, window id and process id).
|
|
130
128
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
129
|
+
- `subscribeActiveWindow`: Create a subscription with a callback function
|
|
130
|
+
- `unsubscribeActiveWindow`: Remove a specific subscription
|
|
131
|
+
- `unsubscribeAllActiveWindow`: Remove all threads
|
|
134
132
|
|
|
135
133
|
```typescript
|
|
136
|
-
import { subscribeActiveWindow, unsubscribeActiveWindow, unsubscribeAllActiveWindow } from '@miniben90/x-win'
|
|
134
|
+
import { subscribeActiveWindow, unsubscribeActiveWindow, unsubscribeAllActiveWindow } from '@miniben90/x-win'
|
|
137
135
|
|
|
138
136
|
const a = subscribeActiveWindow((error, activeWindow) => {
|
|
139
|
-
console.log('test a', activeWindow)
|
|
140
|
-
})
|
|
137
|
+
console.log('test a', activeWindow)
|
|
138
|
+
})
|
|
141
139
|
|
|
142
140
|
const b = subscribeActiveWindow((error, activeWindow) => {
|
|
143
|
-
console.log('test b', activeWindow)
|
|
144
|
-
})
|
|
141
|
+
console.log('test b', activeWindow)
|
|
142
|
+
})
|
|
145
143
|
|
|
146
144
|
const c = subscribeActiveWindow((error, activeWindow) => {
|
|
147
|
-
console.log('test c', activeWindow)
|
|
148
|
-
})
|
|
145
|
+
console.log('test c', activeWindow)
|
|
146
|
+
})
|
|
149
147
|
|
|
150
|
-
setTimeout(() => unsubscribeActiveWindow(c), 5000)
|
|
148
|
+
setTimeout(() => unsubscribeActiveWindow(c), 5000)
|
|
151
149
|
|
|
152
|
-
setTimeout(() => unsubscribeAllActiveWindow(), 10000)
|
|
150
|
+
setTimeout(() => unsubscribeAllActiveWindow(), 10000)
|
|
153
151
|
```
|
|
154
152
|
|
|
155
153
|
### Get icon from `WindoInfo`
|
|
@@ -160,11 +158,11 @@ The icon will be stored in `IconInfo.data` in base64 PNG format.
|
|
|
160
158
|
Example:
|
|
161
159
|
|
|
162
160
|
```typescript
|
|
163
|
-
import { activeWindow, type WindowInfo, type IconInfo } from '@miniben90/x-win'
|
|
161
|
+
import { activeWindow, type WindowInfo, type IconInfo } from '@miniben90/x-win'
|
|
164
162
|
|
|
165
|
-
const window: WindowInfo = activeWindow()
|
|
166
|
-
const iconInfo: IconInfo = window.getIcon()
|
|
167
|
-
console.log(console)
|
|
163
|
+
const window: WindowInfo = activeWindow()
|
|
164
|
+
const iconInfo: IconInfo = window.getIcon()
|
|
165
|
+
console.log(console)
|
|
168
166
|
```
|
|
169
167
|
|
|
170
168
|
Response:
|
|
@@ -200,11 +198,11 @@ After executing this function, it's vital to **restart the user session** to loa
|
|
|
200
198
|
|
|
201
199
|
It is possible to know if the extension is installed or / and enabled using `isInstalledExtension()` and `isEnabledExtension()`.
|
|
202
200
|
|
|
203
|
-
| Gnome Distrib.
|
|
204
|
-
|
|
205
|
-
| Fedora Workstation 39
|
|
206
|
-
| Ubuntu 22.04.4 Desktop | ✅
|
|
207
|
-
| Debian 12 Desktop
|
|
201
|
+
| Gnome Distrib. | Tested |
|
|
202
|
+
| ---------------------- | ------ |
|
|
203
|
+
| Fedora Workstation 39 | ✅ |
|
|
204
|
+
| Ubuntu 22.04.4 Desktop | ✅ |
|
|
205
|
+
| Debian 12 Desktop | ✅ |
|
|
208
206
|
|
|
209
207
|
## Darwin
|
|
210
208
|
|
|
@@ -220,74 +218,74 @@ It is possible to get URL of browsers window for macOS and Windows.
|
|
|
220
218
|
|
|
221
219
|
### Windows
|
|
222
220
|
|
|
223
|
-
| Browser name
|
|
224
|
-
|
|
225
|
-
| firefox
|
|
226
|
-
| firefox developer edition | ✅
|
|
227
|
-
| google chrome
|
|
228
|
-
| microsoft edge
|
|
229
|
-
| opera software - opera
|
|
230
|
-
| opera software - opera GX | ✅
|
|
231
|
-
| brave
|
|
232
|
-
| vivaldi
|
|
233
|
-
| iron
|
|
234
|
-
| epic
|
|
235
|
-
| chromium
|
|
236
|
-
| ucozmedia
|
|
237
|
-
| blisk
|
|
238
|
-
| maxthon
|
|
239
|
-
| beaker
|
|
240
|
-
| beaker browser
|
|
241
|
-
| LibreWolf
|
|
221
|
+
| Browser name | Tested |
|
|
222
|
+
| ------------------------- | ------ |
|
|
223
|
+
| firefox | ✅ |
|
|
224
|
+
| firefox developer edition | ✅ |
|
|
225
|
+
| google chrome | ✅ |
|
|
226
|
+
| microsoft edge | ✅ |
|
|
227
|
+
| opera software - opera | ✅ |
|
|
228
|
+
| opera software - opera GX | ✅ |
|
|
229
|
+
| brave | |
|
|
230
|
+
| vivaldi | |
|
|
231
|
+
| iron | |
|
|
232
|
+
| epic | |
|
|
233
|
+
| chromium | ✅ |
|
|
234
|
+
| ucozmedia | |
|
|
235
|
+
| blisk | |
|
|
236
|
+
| maxthon | |
|
|
237
|
+
| beaker | |
|
|
238
|
+
| beaker browser | |
|
|
239
|
+
| LibreWolf | ✅ |
|
|
242
240
|
|
|
243
241
|
### macOS
|
|
244
242
|
|
|
245
243
|
It will use AppleScript to get informations for chromium browsers and safari
|
|
246
244
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
| Browser name
|
|
250
|
-
|
|
251
|
-
| Safari
|
|
252
|
-
| Safari Technology Preview
|
|
253
|
-
| google Chrome
|
|
254
|
-
| google Chrome beta
|
|
255
|
-
| google Chrome dev
|
|
256
|
-
| google Chrome canary
|
|
257
|
-
| brave Browser
|
|
258
|
-
| brave Browser beta
|
|
259
|
-
| brave Browser nightly
|
|
260
|
-
| microsoft edge
|
|
261
|
-
| microsoft edge Beta
|
|
262
|
-
| microsoft edge Dev
|
|
263
|
-
| microsoft edge Canary
|
|
264
|
-
| mighty
|
|
265
|
-
| ghost browser
|
|
266
|
-
| bookry wavebox
|
|
267
|
-
| pushplaylabs sidekick
|
|
268
|
-
| opera software - Opera
|
|
269
|
-
| opera software - OperaNext
|
|
270
|
-
| opera software - OperaDeveloper |
|
|
271
|
-
| opera software - OperaGX
|
|
272
|
-
| Vivaldi
|
|
245
|
+
**_For the moment Firefox and firefox developer edition are not supported_**
|
|
246
|
+
|
|
247
|
+
| Browser name | Tested |
|
|
248
|
+
| ------------------------------- | ------ |
|
|
249
|
+
| Safari | ✅ |
|
|
250
|
+
| Safari Technology Preview | |
|
|
251
|
+
| google Chrome | ✅ |
|
|
252
|
+
| google Chrome beta | |
|
|
253
|
+
| google Chrome dev | |
|
|
254
|
+
| google Chrome canary | |
|
|
255
|
+
| brave Browser | |
|
|
256
|
+
| brave Browser beta | |
|
|
257
|
+
| brave Browser nightly | |
|
|
258
|
+
| microsoft edge | ✅ |
|
|
259
|
+
| microsoft edge Beta | |
|
|
260
|
+
| microsoft edge Dev | |
|
|
261
|
+
| microsoft edge Canary | |
|
|
262
|
+
| mighty | |
|
|
263
|
+
| ghost browser | |
|
|
264
|
+
| bookry wavebox | |
|
|
265
|
+
| pushplaylabs sidekick | |
|
|
266
|
+
| opera software - Opera | ✅ |
|
|
267
|
+
| opera software - OperaNext | |
|
|
268
|
+
| opera software - OperaDeveloper | |
|
|
269
|
+
| opera software - OperaGX | ✅ |
|
|
270
|
+
| Vivaldi | |
|
|
273
271
|
|
|
274
272
|
## Electron
|
|
275
273
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
274
|
+
- To prevent potential crashes and issues, it's recommended to execute recovery operations within a worker thread ([https://nodejs.org/api/worker_threads.html](https://nodejs.org/api/worker_threads.html))
|
|
275
|
+
- For macOS, you can utilize functions to check and request screen permissions ([https://www.electronjs.org/fr/docs/latest/api/system-preferences](https://www.electronjs.org/fr/docs/latest/api/system-preferences))
|
|
276
|
+
- When building your application, it’s important to specify all optional packages to be moved to `asar.unpack` to prevent issues during the signing process. [https://www.electronforge.io/config/plugins/auto-unpack-natives](https://www.electronforge.io/config/plugins/auto-unpack-natives) [https://www.electron.build/app-builder-lib.interface.configuration#asarunpack](https://www.electron.build/app-builder-lib.interface.configuration#asarunpack)
|
|
279
277
|
|
|
280
278
|
### Questions
|
|
281
279
|
|
|
282
|
-
|
|
280
|
+
- Why can't I find optional dependencies when I build my application?
|
|
283
281
|
|
|
284
282
|
When setting up CI/CD to build your application, it's important to enforce the installation of sub-packages for each system to prevent any missing components.
|
|
285
283
|
|
|
286
284
|
examples:
|
|
287
285
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
286
|
+
- `npm install --save-dev @miniben90/x-win-win32-x64-msvc @miniben90/x-win-win32-ia32-msvc @miniben90/x-win-win32-arm64-msvc --ignore-platform --ignore-engines` for win32 system
|
|
287
|
+
- `npm install --save-dev @miniben90/x-win-darwin-arm64 @miniben90/x-win-darwin-universal @miniben90/x-win-darwin-x64 --ignore-platform --ignore-engines` for Darwin system
|
|
288
|
+
- `npm install --save-dev @miniben90/x-win-linux-x64-gnu @miniben90/x-win-linux-x64-musl4 --ignore-platform --ignore-engines` for Linux system
|
|
291
289
|
|
|
292
290
|
<hr class="padding-top: 30px;padding-bottom:30px">
|
|
293
291
|
|
|
@@ -295,6 +293,6 @@ examples:
|
|
|
295
293
|
|
|
296
294
|
**Project Inspirations:**
|
|
297
295
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
296
|
+
- [active-win](https://github.com/sindresorhus/active-win)
|
|
297
|
+
- [active-win-pos-rs](https://github.com/dimusic/active-win-pos-rs)
|
|
298
|
+
- This project was generated with [@napi-rs/cli](https://github.com/napi-rs)
|
package/index.d.ts
CHANGED
|
@@ -1,43 +1,30 @@
|
|
|
1
|
-
/* tslint:disable */
|
|
2
|
-
/* eslint-disable */
|
|
3
|
-
|
|
4
1
|
/* auto-generated by NAPI-RS */
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Struct to store position and size of the window
|
|
31
|
-
*/
|
|
32
|
-
export interface WindowPosition {
|
|
33
|
-
x: number
|
|
34
|
-
y: number
|
|
35
|
-
width: number
|
|
36
|
-
height: number
|
|
37
|
-
isFullScreen: boolean
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/** * Struct to store all informations of the window
|
|
4
|
+
*/
|
|
5
|
+
export declare class WindowInfo {
|
|
6
|
+
id: number
|
|
7
|
+
os: string
|
|
8
|
+
title: string
|
|
9
|
+
constructor()
|
|
10
|
+
get position(): WindowPosition
|
|
11
|
+
get info(): ProcessInfo
|
|
12
|
+
get usage(): UsageInfo
|
|
13
|
+
/** * Funciton who help to recover icon of application and will return `IconInfo`.
|
|
14
|
+
*/
|
|
15
|
+
getIcon(): IconInfo
|
|
16
|
+
/** * Promise funciton who help to recover icon of application and will return `IconInfo`.
|
|
17
|
+
*/
|
|
18
|
+
getIconAsync(): Promise<IconInfo>
|
|
19
|
+
/** * Getter to recover browser url
|
|
20
|
+
*/
|
|
21
|
+
get url(): string
|
|
22
|
+
/** * Return an Object to make it easy to use data instead of the class
|
|
23
|
+
*/
|
|
24
|
+
toObject(): WindowInfoObject
|
|
38
25
|
}
|
|
39
|
-
|
|
40
|
-
* Retrieve information the about currently active window.
|
|
26
|
+
|
|
27
|
+
/** * Retrieve information the about currently active window.
|
|
41
28
|
* Returns an object of `WindowInfo`.
|
|
42
29
|
*
|
|
43
30
|
* # Example
|
|
@@ -63,10 +50,10 @@ export interface WindowPosition {
|
|
|
63
50
|
* # Information about Electron
|
|
64
51
|
*
|
|
65
52
|
* It is recommended to use this function within a worker to mitigate potential recovery issues on MacOS.
|
|
66
|
-
*/
|
|
53
|
+
*/
|
|
67
54
|
export declare function activeWindow(): WindowInfo
|
|
68
|
-
|
|
69
|
-
* Retrieve information about the currently active window as a promise.
|
|
55
|
+
|
|
56
|
+
/** * Retrieve information about the currently active window as a promise.
|
|
70
57
|
* Returns an object of `WindowInfo`.
|
|
71
58
|
*
|
|
72
59
|
* # Example
|
|
@@ -94,10 +81,44 @@ export declare function activeWindow(): WindowInfo
|
|
|
94
81
|
* # Information about Electron
|
|
95
82
|
*
|
|
96
83
|
* It is recommended to use this function within a worker to mitigate potential recovery issues on MacOS.
|
|
97
|
-
*/
|
|
84
|
+
*/
|
|
98
85
|
export declare function activeWindowAsync(): Promise<WindowInfo>
|
|
99
|
-
|
|
100
|
-
*
|
|
86
|
+
|
|
87
|
+
/** * Disable Gnome extensions required for Linux using Gnome > 41.
|
|
88
|
+
* This function will disable extension needed to correctly detect working windows with Wayland desktop environment.
|
|
89
|
+
*/
|
|
90
|
+
export declare function disableExtension(): boolean
|
|
91
|
+
|
|
92
|
+
/** * Enable Gnome extensions required for Linux using Gnome > 41.
|
|
93
|
+
* This function will enable extension needed to correctly detect working windows with Wayland desktop environment.
|
|
94
|
+
*/
|
|
95
|
+
export declare function enableExtension(): boolean
|
|
96
|
+
|
|
97
|
+
/** * Struct to store process information of the window
|
|
98
|
+
*/
|
|
99
|
+
export interface IconInfo {
|
|
100
|
+
data: string
|
|
101
|
+
height: number
|
|
102
|
+
width: number
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** * Install "@mininben90/x-win" Gnome extension required for Linux using Gnome > 41.
|
|
106
|
+
* This function will write extension files needed to correctly detect working windows with Wayland desktop environment.
|
|
107
|
+
* **Restart session will be require to install the gnome extension.**
|
|
108
|
+
*/
|
|
109
|
+
export declare function installExtension(): boolean
|
|
110
|
+
|
|
111
|
+
/** * Return true of false if gnome extension is enabled for Linux using Gnome > 41.
|
|
112
|
+
* This function will return true or false if the extension is set to enabled on extension info. Working only with Wayland windows manager.
|
|
113
|
+
*/
|
|
114
|
+
export declare function isEnabledExtension(): boolean
|
|
115
|
+
|
|
116
|
+
/** * Return true of false the extensions is installed for Linux using Gnome > 41.
|
|
117
|
+
* This function will return true or false if the extension is correctly installed. Working only with Wayland windows manager.
|
|
118
|
+
*/
|
|
119
|
+
export declare function isInstalledExtension(): boolean
|
|
120
|
+
|
|
121
|
+
/** * Retrieve information about the currently open windows.
|
|
101
122
|
* Returns an array of `WindowInfo`, each containing details about a specific open window.
|
|
102
123
|
*
|
|
103
124
|
* # Example
|
|
@@ -127,10 +148,10 @@ export declare function activeWindowAsync(): Promise<WindowInfo>
|
|
|
127
148
|
* # Information about Electron
|
|
128
149
|
*
|
|
129
150
|
* It is recommended to use this function within a worker to mitigate potential recovery issues on MacOS.
|
|
130
|
-
*/
|
|
151
|
+
*/
|
|
131
152
|
export declare function openWindows(): Array<WindowInfo>
|
|
132
|
-
|
|
133
|
-
* Retrieve information about the currently open windows as a promise.
|
|
153
|
+
|
|
154
|
+
/** * Retrieve information about the currently open windows as a promise.
|
|
134
155
|
* Returns an array of `WindowInfo`, each containing details about a specific open window.
|
|
135
156
|
*
|
|
136
157
|
* # Example
|
|
@@ -164,10 +185,19 @@ export declare function openWindows(): Array<WindowInfo>
|
|
|
164
185
|
* # Information about Electron
|
|
165
186
|
*
|
|
166
187
|
* It is recommended to use this function within a worker to mitigate potential recovery issues on MacOS.
|
|
167
|
-
*/
|
|
188
|
+
*/
|
|
168
189
|
export declare function openWindowsAsync(): Promise<Array<WindowInfo>>
|
|
169
|
-
|
|
170
|
-
*
|
|
190
|
+
|
|
191
|
+
/** * Struct to store process information of the window
|
|
192
|
+
*/
|
|
193
|
+
export interface ProcessInfo {
|
|
194
|
+
processId: number
|
|
195
|
+
path: string
|
|
196
|
+
name: string
|
|
197
|
+
execName: string
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/** * Subscribe an observer thread to monitor changes in the active window.
|
|
171
201
|
* @param {function} callback - Callback function that returns the active window when it changes
|
|
172
202
|
* @param {number} [interval=100] - Interval between checks for changes in the active window (default: 100ms)
|
|
173
203
|
*
|
|
@@ -215,10 +245,16 @@ export declare function openWindowsAsync(): Promise<Array<WindowInfo>>
|
|
|
215
245
|
* unsubscribeAllActiveWindow();
|
|
216
246
|
* ```
|
|
217
247
|
*
|
|
218
|
-
*/
|
|
248
|
+
*/
|
|
219
249
|
export declare function subscribeActiveWindow(callback: (error: Error | null, info: WindowInfo | undefined) => void, interval?: number): number
|
|
220
|
-
|
|
221
|
-
*
|
|
250
|
+
|
|
251
|
+
/** * Uninstall "@mininben90/x-win" Gnome extension.
|
|
252
|
+
* This function will disable and remove extension files.
|
|
253
|
+
* **Restart session will be require to remove the gnome extension.**
|
|
254
|
+
*/
|
|
255
|
+
export declare function uninstallExtension(): boolean
|
|
256
|
+
|
|
257
|
+
/** * Terminate and unsubscribe a specific observer using their ID.
|
|
222
258
|
*
|
|
223
259
|
* # Example
|
|
224
260
|
*
|
|
@@ -261,10 +297,10 @@ export declare function subscribeActiveWindow(callback: (error: Error | null, in
|
|
|
261
297
|
* unsubscribeActiveWindow(b);
|
|
262
298
|
* unsubscribeActiveWindow(c);
|
|
263
299
|
* ```
|
|
264
|
-
*/
|
|
300
|
+
*/
|
|
265
301
|
export declare function unsubscribeActiveWindow(threadId: number): void
|
|
266
|
-
|
|
267
|
-
* Terminate and unsubscribe all observer threads monitoring changes in the active window.
|
|
302
|
+
|
|
303
|
+
/** * Terminate and unsubscribe all observer threads monitoring changes in the active window.
|
|
268
304
|
*
|
|
269
305
|
* # Example
|
|
270
306
|
*
|
|
@@ -303,61 +339,34 @@ export declare function unsubscribeActiveWindow(threadId: number): void
|
|
|
303
339
|
*
|
|
304
340
|
* unsubscribeAllActiveWindow();
|
|
305
341
|
* ```
|
|
306
|
-
*/
|
|
342
|
+
*/
|
|
307
343
|
export declare function unsubscribeAllActiveWindow(): void
|
|
308
|
-
|
|
309
|
-
*
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
*
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
*/
|
|
319
|
-
export declare function uninstallExtension(): boolean
|
|
320
|
-
/**
|
|
321
|
-
* Enable Gnome extensions required for Linux using Gnome > 41.
|
|
322
|
-
* This function will enable extension needed to correctly detect working windows with Wayland desktop environment.
|
|
323
|
-
*/
|
|
324
|
-
export declare function enableExtension(): boolean
|
|
325
|
-
/**
|
|
326
|
-
* Disable Gnome extensions required for Linux using Gnome > 41.
|
|
327
|
-
* This function will disable extension needed to correctly detect working windows with Wayland desktop environment.
|
|
328
|
-
*/
|
|
329
|
-
export declare function disableExtension(): boolean
|
|
330
|
-
/**
|
|
331
|
-
* Return true of false if gnome extension is enabled for Linux using Gnome > 41.
|
|
332
|
-
* This function will return true or false if the extension is set to enabled on extension info. Working only with Wayland windows manager.
|
|
333
|
-
*/
|
|
334
|
-
export declare function isEnabledExtension(): boolean
|
|
335
|
-
/**
|
|
336
|
-
* Return true of false the extensions is installed for Linux using Gnome > 41.
|
|
337
|
-
* This function will return true or false if the extension is correctly installed. Working only with Wayland windows manager.
|
|
338
|
-
*/
|
|
339
|
-
export declare function isInstalledExtension(): boolean
|
|
340
|
-
/**
|
|
341
|
-
* Struct to store all informations of the window
|
|
342
|
-
*/
|
|
343
|
-
export declare class WindowInfo {
|
|
344
|
+
|
|
345
|
+
/** * Struct to store usage data of the window
|
|
346
|
+
*/
|
|
347
|
+
export interface UsageInfo {
|
|
348
|
+
memory: number
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
/** * Struct to store all informations of the window
|
|
352
|
+
*/
|
|
353
|
+
export interface WindowInfoObject {
|
|
344
354
|
id: number
|
|
345
355
|
os: string
|
|
346
356
|
title: string
|
|
347
357
|
position: WindowPosition
|
|
348
358
|
info: ProcessInfo
|
|
349
359
|
usage: UsageInfo
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
get url(): string
|
|
360
|
+
icon: IconInfo
|
|
361
|
+
url: string
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
/** * Struct to store position and size of the window
|
|
365
|
+
*/
|
|
366
|
+
export interface WindowPosition {
|
|
367
|
+
x: number
|
|
368
|
+
y: number
|
|
369
|
+
width: number
|
|
370
|
+
height: number
|
|
371
|
+
isFullScreen: boolean
|
|
363
372
|
}
|