# all-windows

> Get metadata about all windows (title, id, bounds, owner, URL, etc). Works on macOS.

Latest version **2.0.0** (published 2020-04-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install all-windows
pnpm add all-windows
yarn add all-windows
bun add all-windows
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2020-04-24 |
| First published | 2020-04-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8 |
| Dependencies | 4 |
| Unpacked size | 90.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Maintainers | codehimanshu |
| Keywords | macos, app, application, window, win, active, focused, current, title, name, id, pid, screenshot, capture, metadata, bounds, memory, usage, bundleid, browser, url, chrome, safari, edge, brave |

## Links

- npm: https://www.npmjs.com/package/all-windows
- Repository: https://github.com/gradeup/all-windows
- Homepage: https://github.com/gradeup/all-windows#readme
- Issues: https://github.com/gradeup/all-windows/issues
- npm.io page: https://npm.io/package/all-windows

## Dependencies (4)

- [ffi-napi](https://npm.io/package/ffi-napi.md) ^2.4.5
- [ref-napi](https://npm.io/package/ref-napi.md) ^1.4.2
- [ref-wchar-napi](https://npm.io/package/ref-wchar-napi.md) ^1.0.2
- [ref-struct-napi](https://npm.io/package/ref-struct-napi.md) ^1.1.0

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 2.0.0 (latest) — 2020-04-24
- 1.0.3 — 2020-04-07
- 1.0.2 — 2020-04-07
- 1.0.1 — 2020-04-06
- 1.0.0 — 2020-04-06

## README

# all-windows

Get metadata about all windows (title, id, bounds, owner, URL, etc)

Works on macOS.

Users on macOS 10.13 or earlier needs to download the [Swift runtime support libraries](https://support.apple.com/kb/DL1998).

## Install

```
$ npm install all-windows
```

## Usage

```js
const allWindows = require('all-windows');

(async () => {
	console.log(await allWindows());
	/*
	[
		{
			title: 'Unicorns - Google Search',
			id: 5762,
			bounds: {
				x: 0,
				y: 0,
				height: 900,
				width: 1440
			},
			owner: {
				name: 'Google Chrome',
				processId: 310,
				bundleId: 'com.google.Chrome',
				path: '/Applications/Google Chrome.app'
			},
			url: 'https://www.google.com/search?q=unicorn',
			memoryUsage: 11015432
		}
	]
	*/
})();
```


## API

### allWindows()

Returns a `Promise<Object>` with the result, or `Promise<undefined>` if there are no windows or if the information is not available.

### allWindows.sync()

Returns an `Object` with the result, or `undefined` if there are no windows.

## Result
An array of the following object structure:
- `platform` *(string)* - `'macos'`
- `title` *(string)* - Window title
- `id` *(number)* - Window identifier
- `bounds` *(Object)* - Window position and size
	- `x` *(number)*
	- `y` *(number)*
	- `width` *(number)*
	- `height` *(number)*
- `owner` *(Object)* - App that owns the window
	- `name` *(string)* - Name of the app
	- `processId` *(number)* - Process identifier
	- `bundleId` *(string)* - Bundle identifier *(macOS only)*
	- `path` *(string)* - Path to the app
- `url` *(string?)* - URL of the active browser tab if the window is Safari, Chrome, Edge, or Brave *(macOS only)*
- `memoryUsage` *(number)* - Memory usage by the window owner process

## OS support

It works on macOS.

___

### Thanks [sindresorhus](https://github.com/sindresorhus/active-win) for the base implementation

---
_Source: https://npm.io/package/all-windows · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
