https://github.com/nstechbytes/wingeometery
Get window geometry for a window title
https://github.com/nstechbytes/wingeometery
Last synced: 4 months ago
JSON representation
Get window geometry for a window title
- Host: GitHub
- URL: https://github.com/nstechbytes/wingeometery
- Owner: NSTechBytes
- License: mit
- Created: 2025-05-16T03:19:47.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-05-16T03:30:08.000Z (about 1 year ago)
- Last Synced: 2025-09-20T18:20:38.908Z (9 months ago)
- Language: C++
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# WinGeometry
**WinGeometry** is a lightweight Node.js module that retrieves the screen position and size of a window based on its title (INI path or window name), using a native Windows executable.
> โ ๏ธ Works only on **Windows** systems.
---
## ๐ฆ Installation
```bash
npm install win-geometry
````
---
## ๐ ๏ธ Usage
```js
const { getWindowGeometry } = require('win-geometry');
getWindowGeometry('window-title')
.then(({ x, y, width, height }) => {
console.log('Window Geometry:', { x, y, width, height });
})
.catch(err => {
console.error('Error:', err.message);
});
```
---
## ๐ Output Format
If the window is found, the function returns a Promise that resolves to an object:
```js
{
x: Number,
y: Number,
width: Number,
height: Number
}
```
If the window is not found or an error occurs, the Promise is rejected with an appropriate error message.
---
## ๐งฑ Native Dependency
This module depends on a native executable called `WinGeometry.exe`, located in the `bin/` folder. This executable performs the actual window geometry retrieval using Windows API calls.
Make sure `WinGeometry.exe` is included when packaging or publishing.
---
## ๐งช Example Output
```bash
Geometry: { x: 123, y: 456, width: 800, height: 600 }
```
---
## ๐ซ Limitations
* Windows-only (due to native `.exe` dependency)
* Requires the exact window title.
---
## ๐ License
MIT ยฉ [nstechbytes](https://github.com/NSTechBytes)