@miniben90/x-win 0.2.4 → 0.2.5

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 (2) hide show
  1. package/README.md +88 -3
  2. package/package.json +8 -8
package/README.md CHANGED
@@ -1,9 +1,13 @@
1
+ [![CI](https://github.com/miniben-90/x-win/actions/workflows/CI.yml/badge.svg)](https://github.com/miniben-90/x-win/actions/workflows/CI.yml)
2
+ [![Node version](https://img.shields.io/node/v/@miniben90/x-win.svg)](https://www.npmjs.com/package/@miniben90/x-win)
3
+ ![npm type definitions](https://img.shields.io/npm/types/@miniben90/x-win)
4
+
1
5
  # @miniben90/x-win
2
6
 
3
7
  > This project work with Rust and napi-rs to make easy to have active window or an array of open windows.
4
8
  > It work with Microsoft Windows (10, 11), Linux (With Xserver) and Macos(*).
5
9
 
6
- ## Install
10
+ ## How to install
7
11
 
8
12
  Easy to install:
9
13
 
@@ -15,6 +19,87 @@ npm i @miniben90/x-win
15
19
  yarn add @miniben90/x-win
16
20
  ```
17
21
 
18
- ### (*)About Macos
22
+ ## How to use
23
+
24
+ ### Get information of current active window
25
+
26
+ `exemple.ts`:
27
+ ```typescript
28
+ import { activeWindow, type WindowInfo } from '@miniben90/x-win';
29
+
30
+ const currentWindow: WindowInfo = activeWindow();
31
+
32
+ console.log(currentWindow);
33
+ ```
34
+
35
+ `response`:
36
+ ```json
37
+ {
38
+ id: 26148,
39
+ info: {
40
+ execName: "Code",
41
+ name: "Visual Studio Code",
42
+ path: "C:\\Users\\miniben\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe",
43
+ processId: 26148
44
+ },
45
+ os: "win32",
46
+ position: {
47
+ height: 1048,
48
+ width: 1936,
49
+ x: -8,
50
+ y: -8
51
+ },
52
+ title: "● README.md - x-win - Visual Studio Code",
53
+ usage: {
54
+ memory: 113270784
55
+ }
56
+ }
57
+ ```
58
+
59
+ ### Get List of open windows with informations
60
+
61
+ `exemple.ts`:
62
+ ```typescript
63
+ import { openWindows, type WindowInfo } from '@miniben90/x-win';
64
+
65
+ const windows: WindowInfo[] = openWindows();
66
+
67
+ console.log(windows);
68
+ ```
69
+
70
+ `response`:
71
+ ```json
72
+ [{
73
+ id: 26148,
74
+ info: {
75
+ execName: "Code",
76
+ name: "Visual Studio Code",
77
+ path: "C:\\Users\\miniben\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe",
78
+ processId: 26148
79
+ },
80
+ os: "win32",
81
+ position: {
82
+ height: 1048,
83
+ width: 1936,
84
+ x: -8,
85
+ y: -8
86
+ },
87
+ title: "● README.md - x-win - Visual Studio Code",
88
+ usage: {
89
+ memory: 113270784
90
+ }
91
+ }]
92
+ ```
93
+
94
+
95
+ ## For Darwin
96
+
97
+ > ### Record screen required for macos
98
+ > Macos require to grant access for recording screen. If your project don't have it the title will have `<unknown>` as value.
99
+
100
+ <hr class="padding-top: 30px;padding-bottom:30px">
19
101
 
20
- > Macos require to grant access for recording screen. If your project don't have it the title will have `<unknown>` as value.
102
+ **This project was inspired by:**
103
+ * [active-win](https://github.com/sindresorhus/active-win)
104
+ * [active-win-pos-rs](https://github.com/dimusic/active-win-pos-rs)
105
+ * This project was generated with [@napi-rs/cli](https://github.com/napi-rs)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@miniben90/x-win",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "main": "index.js",
5
5
  "types": "index.d.ts",
6
6
  "files": [
@@ -49,12 +49,12 @@
49
49
  "packageManager": "yarn@3.3.1",
50
50
  "description": "Get position, size, title and a few other properties of the active or open window(s) on Windows, MacOS and Linux.",
51
51
  "optionalDependencies": {
52
- "@miniben90/x-win-win32-x64-msvc": "0.2.4",
53
- "@miniben90/x-win-darwin-x64": "0.2.4",
54
- "@miniben90/x-win-linux-x64-gnu": "0.2.4",
55
- "@miniben90/x-win-win32-arm64-msvc": "0.2.4",
56
- "@miniben90/x-win-win32-ia32-msvc": "0.2.4",
57
- "@miniben90/x-win-darwin-arm64": "0.2.4",
58
- "@miniben90/x-win-darwin-universal": "0.2.4"
52
+ "@miniben90/x-win-win32-x64-msvc": "0.2.5",
53
+ "@miniben90/x-win-darwin-x64": "0.2.5",
54
+ "@miniben90/x-win-linux-x64-gnu": "0.2.5",
55
+ "@miniben90/x-win-win32-arm64-msvc": "0.2.5",
56
+ "@miniben90/x-win-win32-ia32-msvc": "0.2.5",
57
+ "@miniben90/x-win-darwin-arm64": "0.2.5",
58
+ "@miniben90/x-win-darwin-universal": "0.2.5"
59
59
  }
60
60
  }