https://github.com/gradeup/all-windows
Get metadata about the all windows (title, id, bounds, owner, etc) MacOs
https://github.com/gradeup/all-windows
Last synced: 8 months ago
JSON representation
Get metadata about the all windows (title, id, bounds, owner, etc) MacOs
- Host: GitHub
- URL: https://github.com/gradeup/all-windows
- Owner: gradeup
- License: mit
- Archived: true
- Fork: true (sindresorhus/get-windows)
- Created: 2020-04-06T12:54:05.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-04-24T05:14:57.000Z (about 6 years ago)
- Last Synced: 2025-01-03T23:07:59.313Z (over 1 year ago)
- Language: Swift
- Homepage:
- Size: 2.87 MB
- Stars: 4
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- Funding: .github/funding.yml
- License: license
Awesome Lists containing this project
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` with the result, or `Promise` 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