{"id":13433704,"url":"https://github.com/sindresorhus/get-windows","last_synced_at":"2026-02-14T10:02:17.110Z","repository":{"id":37396617,"uuid":"55411022","full_name":"sindresorhus/get-windows","owner":"sindresorhus","description":"Get metadata about the active window and open windows (title, id, bounds, owner, etc)","archived":false,"fork":false,"pushed_at":"2025-08-28T18:47:40.000Z","size":3012,"stargazers_count":894,"open_issues_count":44,"forks_count":192,"subscribers_count":25,"default_branch":"main","last_synced_at":"2026-01-31T20:47:01.157Z","etag":null,"topics":["active-window","javascript","node-module","nodejs","npm-package"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sindresorhus.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"sindresorhus","open_collective":"sindresorhus","buy_me_a_coffee":"sindresorhus","custom":"https://sindresorhus.com/donate"}},"created_at":"2016-04-04T12:54:35.000Z","updated_at":"2026-01-26T00:22:29.000Z","dependencies_parsed_at":"2023-11-08T04:50:39.068Z","dependency_job_id":"a1bc16af-5975-4907-9bcd-b0eefd041679","html_url":"https://github.com/sindresorhus/get-windows","commit_stats":{"total_commits":143,"total_committers":34,"mean_commits":4.205882352941177,"dds":0.3356643356643356,"last_synced_commit":"6e84e52e43469e2836f5b11e9de5d239a9963b54"},"previous_names":["sindresorhus/get-windows"],"tags_count":45,"template":false,"template_full_name":null,"purl":"pkg:github/sindresorhus/get-windows","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fget-windows","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fget-windows/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fget-windows/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fget-windows/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sindresorhus","download_url":"https://codeload.github.com/sindresorhus/get-windows/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fget-windows/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29442326,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-14T07:24:13.446Z","status":"ssl_error","status_checked_at":"2026-02-14T07:23:58.969Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["active-window","javascript","node-module","nodejs","npm-package"],"created_at":"2024-07-31T02:01:33.795Z","updated_at":"2026-02-14T10:02:17.087Z","avatar_url":"https://github.com/sindresorhus.png","language":"JavaScript","readme":"# get-windows\n\n\u003e Get metadata about the [active window](https://en.wikipedia.org/wiki/Active_window) and open windows (title, id, bounds, owner, URL, etc)\n\nWorks on macOS 10.14+, Linux ([note](#linux-support)), and Windows 7+.\n\n## Install\n\n```sh\nnpm install get-windows\n```\n\n**[This is an ESM package which requires you to use ESM](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c)**\n\n## Usage\n\n```js\nimport {activeWindow} from 'get-windows';\n\nconsole.log(await activeWindow(options));\n/*\n{\n\ttitle: 'Unicorns - Google Search',\n\tid: 5762,\n\tbounds: {\n\t\tx: 0,\n\t\ty: 0,\n\t\theight: 900,\n\t\twidth: 1440\n\t},\n\towner: {\n\t\tname: 'Google Chrome',\n\t\tprocessId: 310,\n\t\tbundleId: 'com.google.Chrome',\n\t\tpath: '/Applications/Google Chrome.app'\n\t},\n\turl: 'https://sindresorhus.com/unicorn',\n\tmemoryUsage: 11015432\n}\n*/\n```\n\n## API\n\n### activeWindow(options?)\n\nGet metadata about the active window.\n\n#### options\n\nType: `object`\n\n##### accessibilityPermission **(macOS only)**\n\nType: `boolean`\\\nDefault: `true`\n\nEnable the accessibility permission check. Setting this to `false` will prevent the accessibility permission prompt on macOS versions 10.15 and newer. The `url` property won't be retrieved.\n\n##### screenRecordingPermission **(macOS only)**\n\nType: `boolean`\\\nDefault: `true`\n\nEnable the screen recording permission check. Setting this to `false` will prevent the screen recording permission prompt on macOS versions 10.15 and newer. The `title` property in the result will always be set to an empty string.\n\n### activeWindowSync(options?)\n\nGet metadata about the active window synchronously.\n\n## Result\n\nReturns a `Promise\u003cobject\u003e` with the result, or `Promise\u003cundefined\u003e` if there is no active window or if the information is not available.\n\n- `platform` *(string)* - `'macos'` | `'linux'` | `'windows'`\n- `title` *(string)* - Window title\n- `id` *(number)* - Window identifier\n- `bounds` *(Object)* - Window position and size\n\t- `x` *(number)*\n\t- `y` *(number)*\n\t- `width` *(number)*\n\t- `height` *(number)*\n- `contentBounds` *(Object)* - Window content position and size, which excludes the title bar, menu bar, and frame *(Windows only)*\n\t- `x` *(number)*\n\t- `y` *(number)*\n\t- `width` *(number)*\n\t- `height` *(number)*\n- `owner` *(Object)* - App that owns the window\n\t- `name` *(string)* - Name of the app\n\t- `processId` *(number)* - Process identifier\n\t- `bundleId` *(string)* - Bundle identifier *(macOS only)*\n\t- `path` *(string)* - Path to the app\n- `url` *(string?)* - URL of the active browser tab if the active window is a supported browser *(macOS only)*\n    - Supported browsers: Safari (includes Technology Preview), Chrome (includes Beta, Dev, and Canary), Edge (includes Beta, Dev, and Canary), Brave (includes Beta and Nightly), Mighty, Ghost Browser, Wavebox, Sidekick, Opera (includes Beta, Developer, and GX), or Vivaldi\n- `memoryUsage` *(number)* - Memory usage by the window owner process\n\n### openWindows()\n\nGet metadata about all open windows.\n\nWindows are returned in order from front to back.\n\nReturns `Promise\u003cResult[]\u003e`.\n\n### openWindowsSync()\n\nGet metadata about all open windows synchronously.\n\nWindows are returned in order from front to back.\n\nReturns `Result[]`.\n\n## OS support\n\nIt works on macOS 10.14+, Linux, and Windows 7+.\n\n**Note**: On Windows, there isn't a clear notion of a \"Window ID\". Instead it returns the memory address of the window \"handle\" in the `id` property. That \"handle\" is unique per window, so it can be used to identify them. [Read more…](https://msdn.microsoft.com/en-us/library/windows/desktop/ms632597(v=vs.85).aspx#window_handle)\n\n### Linux support\n\nWayland is not supported. For security reasons, Wayland does not provide a way to identify the active window. [Read more…](https://stackoverflow.com/questions/45465016)\n\n## Electron usage\n\nIf you use this package in an Electron app that is sandboxed and you want to get the `.url` property, you need to add the [proper entitlements and usage description](https://github.com/sindresorhus/get-windows/issues/99#issuecomment-870874546).\n\n## Users\n\n- [active-win-log](https://github.com/uglow/active-win-log) - Window-usage logging CLI.\n- [active-app-qmk-layer-updater](https://github.com/zigotica/active-app-qmk-layer-updater) - Sends the active app info to a QMK device to change keymap layers automatically.\n\n## Related\n\n- [windows-cli](https://github.com/sindresorhus/windows-cli) - CLI for this package\n\n## Development\n\nTo bypass the `gyp` build:\n\n```sh\nnpm install --ignore-scripts\n```\n\n- Debug logging: Set `DEBUG_GET_WINDOWS=1` to log Linux window enumeration errors and summary counts to the console.\n","funding_links":["https://github.com/sponsors/sindresorhus","https://opencollective.com/sindresorhus","https://buymeacoffee.com/sindresorhus","https://sindresorhus.com/donate"],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2Fget-windows","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsindresorhus%2Fget-windows","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2Fget-windows/lists"}