@miniben90/x-win 2.2.0 → 3.0.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 CHANGED
@@ -135,15 +135,15 @@ Thread will be start to check every `100ms` for a new active window (checking wi
135
135
  ```typescript
136
136
  import { subscribeActiveWindow, unsubscribeActiveWindow, unsubscribeAllActiveWindow } from '@miniben90/x-win';
137
137
 
138
- const a = subscribeActiveWindow(activeWindow => {
138
+ const a = subscribeActiveWindow((error, activeWindow) => {
139
139
  console.log('test a', activeWindow);
140
140
  });
141
141
 
142
- const b = subscribeActiveWindow(activeWindow => {
142
+ const b = subscribeActiveWindow((error, activeWindow) => {
143
143
  console.log('test b', activeWindow);
144
144
  });
145
145
 
146
- const c = subscribeActiveWindow(activeWindow => {
146
+ const c = subscribeActiveWindow((error, activeWindow) => {
147
147
  console.log('test c', activeWindow);
148
148
  });
149
149
 
@@ -194,9 +194,11 @@ sudo apt install libxcb1-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0
194
194
 
195
195
  In order to recover data, you'll need to install and activate an extension designed for systems running GNOME version 41 or newer (as evaluation is disabled from this version onward).
196
196
 
197
- The extension can be installed using the `installExtension` function, which will deposit it in `~/.local/share/gnome-shell/extensions/x-win@miniben90.org`.
197
+ The extension can be installed using the `installExtension()` function, which will deposit it in `~/.local/share/gnome-shell/extensions/x-win@miniben90.org`.
198
198
 
199
- After executing this function, it's vital to **restart the user session** to load the new extension and then proceed to enable it using `enableExtension` to be able to use x-win.
199
+ After executing this function, it's vital to **restart the user session** to load the new extension and then proceed to enable it using `enableExtension()` to be able to use x-win.
200
+
201
+ It is possible to know if the extension is installed or / and enabled using `isInstalledExtension()` and `isEnabledExtension()`.
200
202
 
201
203
  | Gnome Distrib. | Tested |
202
204
  |---|---|
package/index.d.ts CHANGED
@@ -178,16 +178,16 @@ export declare function openWindowsAsync(): Promise<Array<WindowInfo>>
178
178
  * ```javascript
179
179
  * const { subscribeActiveWindow, unsubscribeAllActiveWindow } = require('@miniben90/x-win');
180
180
  *
181
- * const a = subscribeActiveWindow((info) => {
181
+ * const a = subscribeActiveWindow((err, info) => {
182
182
  * t.log(a, info);
183
183
  * });
184
- * const b = subscribeActiveWindow((info) => {
184
+ * const b = subscribeActiveWindow((err, info) => {
185
185
  * t.log(b, info);
186
186
  * });
187
- * const c = subscribeActiveWindow((info) => {
187
+ * const c = subscribeActiveWindow((err, info) => {
188
188
  * t.log(c, info);
189
189
  * });
190
- * const d = subscribeActiveWindow((info) => {
190
+ * const d = subscribeActiveWindow((err, info) => {
191
191
  * t.log(c, info);
192
192
  * },500);// sleep interval: 500ms
193
193
  *
@@ -199,16 +199,16 @@ export declare function openWindowsAsync(): Promise<Array<WindowInfo>>
199
199
  * ```typescript
200
200
  * import { subscribeActiveWindow, unsubscribeAllActiveWindow } from '@miniben90/x-win';
201
201
  *
202
- * const a = subscribeActiveWindow((info) => {
202
+ * const a = subscribeActiveWindow((err, info) => {
203
203
  * t.log(a, info);
204
204
  * });
205
- * const b = subscribeActiveWindow((info) => {
205
+ * const b = subscribeActiveWindow((err, info) => {
206
206
  * t.log(b, info);
207
207
  * });
208
- * const c = subscribeActiveWindow((info) => {
208
+ * const c = subscribeActiveWindow((err, info) => {
209
209
  * t.log(c, info);
210
210
  * });
211
- * const d = subscribeActiveWindow((info) => {
211
+ * const d = subscribeActiveWindow((err, info) => {
212
212
  * t.log(c, info);
213
213
  * },500);// sleep interval: 500ms
214
214
  *
@@ -216,7 +216,7 @@ export declare function openWindowsAsync(): Promise<Array<WindowInfo>>
216
216
  * ```
217
217
  *
218
218
  */
219
- export declare function subscribeActiveWindow(callback: (info: WindowInfo) => void, interval?: number): number
219
+ export declare function subscribeActiveWindow(callback: (error: Error | null, info: WindowInfo | undefined) => void, interval?: number): number
220
220
  /**
221
221
  * Terminate and unsubscribe a specific observer using their ID.
222
222
  *
@@ -327,6 +327,16 @@ export declare function enableExtension(): boolean
327
327
  * This function will disable extension needed to correctly detect working windows with Wayland desktop environment.
328
328
  */
329
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
330
340
  /**
331
341
  * Struct to store all informations of the window
332
342
  */
package/index.js CHANGED
@@ -310,7 +310,7 @@ if (!nativeBinding) {
310
310
  throw new Error(`Failed to load native binding`)
311
311
  }
312
312
 
313
- const { WindowInfo, activeWindow, activeWindowAsync, openWindows, openWindowsAsync, subscribeActiveWindow, unsubscribeActiveWindow, unsubscribeAllActiveWindow, installExtension, uninstallExtension, enableExtension, disableExtension } = nativeBinding
313
+ const { WindowInfo, activeWindow, activeWindowAsync, openWindows, openWindowsAsync, subscribeActiveWindow, unsubscribeActiveWindow, unsubscribeAllActiveWindow, installExtension, uninstallExtension, enableExtension, disableExtension, isEnabledExtension, isInstalledExtension } = nativeBinding
314
314
 
315
315
  module.exports.WindowInfo = WindowInfo
316
316
  module.exports.activeWindow = activeWindow
@@ -324,3 +324,5 @@ module.exports.installExtension = installExtension
324
324
  module.exports.uninstallExtension = uninstallExtension
325
325
  module.exports.enableExtension = enableExtension
326
326
  module.exports.disableExtension = disableExtension
327
+ module.exports.isEnabledExtension = isEnabledExtension
328
+ module.exports.isInstalledExtension = isInstalledExtension
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@miniben90/x-win",
3
3
  "description": "This package allows you to retrieve precise information about active and open windows on Windows, MacOS, and Linux. You can obtain the position, size, title, and other memory of windows.",
4
- "version": "2.2.0",
4
+ "version": "3.0.0",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
7
7
  "files": [
@@ -46,7 +46,7 @@
46
46
  ],
47
47
  "devDependencies": {
48
48
  "@napi-rs/cli": "^2.18.4",
49
- "ava": "6.2.0",
49
+ "ava": "^6.3.0",
50
50
  "husky": "^9.1.7"
51
51
  },
52
52
  "ava": {
@@ -75,15 +75,15 @@
75
75
  "clippy:napi": "cargo clippy -- -D warnings",
76
76
  "clippy": "yarn clippy:rs && yarn clippy:napi"
77
77
  },
78
- "packageManager": "yarn@4.5.0",
78
+ "packageManager": "yarn@4.9.1",
79
79
  "optionalDependencies": {
80
- "@miniben90/x-win-win32-x64-msvc": "2.2.0",
81
- "@miniben90/x-win-darwin-x64": "2.2.0",
82
- "@miniben90/x-win-linux-x64-gnu": "2.2.0",
83
- "@miniben90/x-win-darwin-arm64": "2.2.0",
84
- "@miniben90/x-win-win32-arm64-msvc": "2.2.0",
85
- "@miniben90/x-win-win32-ia32-msvc": "2.2.0",
86
- "@miniben90/x-win-darwin-universal": "2.2.0",
87
- "@miniben90/x-win-linux-x64-musl": "2.2.0"
80
+ "@miniben90/x-win-win32-x64-msvc": "3.0.0",
81
+ "@miniben90/x-win-darwin-x64": "3.0.0",
82
+ "@miniben90/x-win-linux-x64-gnu": "3.0.0",
83
+ "@miniben90/x-win-darwin-arm64": "3.0.0",
84
+ "@miniben90/x-win-win32-arm64-msvc": "3.0.0",
85
+ "@miniben90/x-win-win32-ia32-msvc": "3.0.0",
86
+ "@miniben90/x-win-darwin-universal": "3.0.0",
87
+ "@miniben90/x-win-linux-x64-musl": "3.0.0"
88
88
  }
89
89
  }