{"id":16054994,"url":"https://github.com/xan105/node-win-screen-resolution","last_synced_at":"2025-10-05T17:18:11.047Z","repository":{"id":46148105,"uuid":"284940250","full_name":"xan105/node-win-screen-resolution","owner":"xan105","description":"Get the current and all available screen resolution on Windows","archived":false,"fork":false,"pushed_at":"2024-06-22T05:00:21.000Z","size":9033,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-17T12:56:06.776Z","etag":null,"topics":["native-module","nodejs","resolution","screen","windows"],"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/xan105.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":"xan105","custom":"https://www.paypal.me/xan105","patreon":"xan105"}},"created_at":"2020-08-04T09:52:23.000Z","updated_at":"2024-10-12T07:41:51.000Z","dependencies_parsed_at":"2024-05-12T11:15:37.753Z","dependency_job_id":null,"html_url":"https://github.com/xan105/node-win-screen-resolution","commit_stats":{"total_commits":29,"total_committers":1,"mean_commits":29.0,"dds":0.0,"last_synced_commit":"440fe1d7e4fac3059e3508f8713d193595d635ab"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xan105%2Fnode-win-screen-resolution","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xan105%2Fnode-win-screen-resolution/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xan105%2Fnode-win-screen-resolution/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xan105%2Fnode-win-screen-resolution/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xan105","download_url":"https://codeload.github.com/xan105/node-win-screen-resolution/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221585913,"owners_count":16847850,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["native-module","nodejs","resolution","screen","windows"],"created_at":"2024-10-09T02:05:12.855Z","updated_at":"2025-10-05T17:18:06.031Z","avatar_url":"https://github.com/xan105.png","language":"JavaScript","funding_links":["https://github.com/sponsors/xan105","https://www.paypal.me/xan105","https://patreon.com/xan105"],"categories":[],"sub_categories":[],"readme":"About\n=====\n\nA NAPI Native C++ addon to get the current and all available screen resolution on Windows (DPI Aware).\n\nExample\n=======\n\n```js\nimport { \n  getCurrentResolution, \n  getAvailableResolution \n} from \"win-screen-resolution\";\n\nconsole.log(getCurrentResolution()); \n//{ width: 1920, height: 1080 }\n\nconsole.log(getAvailableResolution());\n/*\n[\n  { width: 1920, height: 1080 },\n  { width: 1768, height: 992 },\n  { width: 1680, height: 1050 },\n  { width: 1600, height: 1024 },\n  ...\n]\n*/\n```\n\nYou may want the raw data which has more information such as the refresh rate:\n\n```js\nimport { \n  getCurrentDisplayMode, \n  getAvailableDisplayMode \n} from \"win-screen-resolution\";\n\nconsole.log(getCurrentDisplayMode()); \n//{ width: 1920, height: 1080, hz: 60, scale: 100, color: 32 }\n\nconsole.log(getAvailableDisplayMode());\n/*\n[\n  { width: 640, height: 480, hz: 59, color: 32 },\n  { width: 640, height: 480, hz: 60, color: 32 },\n  { width: 640, height: 480, hz: 75, color: 32 },\n  { width: 720, height: 480, hz: 60, color: 32 },\n  ...\n]\n*/\n```\n\nMulti-monitor\n\n```js\nimport { \n  getActiveDisplays, \n  setPrimaryDisplay \n} from \"win-screen-resolution\";\n\nconst displays = getActiveDisplays();\nconsole.log(displays);\n/*\n[{\n    id: '\\\\\\\\.\\\\DISPLAY1',\n    adapter: 'NVIDIA GeForce GTX 1060 6GB',\n    monitor: 'LG ULTRAGEAR(DisplayPort)',\n    primary: true,\n    width: 2560,\n    height: 1440,\n    hz: 165,\n    scale: 100,\n    offset: { x: 0, y: 0 }\n  },\n  {\n    id: '\\\\\\\\.\\\\DISPLAY5',\n    adapter: 'Intel(R) HD Graphics 530',\n    monitor: 'Dell U2417H (HDMI)',\n    primary: false,\n    width: 1920,\n    height: 1080,\n    hz: 59,\n    scale: 100,\n    offset: { x: 2560, y: 0 }\n  }]\n*/\n\n//Change primary display\nsetPrimaryDisplay(displays[1].id); //by identifier\n//OR\nsetPrimaryDisplay(1); //by index\n```\n\nInstallation\n============\n\n```\nnpm install win-screen-resolution\n```\n\n🚀 x86, x64 and arm64 prebuilt binary provided.\n\nForce compiling:\n```\nnpm install win-screen-resolution --build-from-source\n```\n\nYou will need C/C++ build tools and Python 3.x (node-gyp) to build this module.\n\n⚠️ This package doesn't have any installation restrictions in its package.json file to facilitate multi-platform development; however, it is at the moment only designed to work on Windows.\n\nAPI\n===\n\n⚠️ This module is only available as an ECMAScript module (ESM) starting with version 2.0.0.\u003cbr /\u003e\nPrevious version(s) are CommonJS (CJS) with an ESM wrapper.\n\n**DPI Awareness**\n\nThe following exports are DPI aware meaning that their results won't change with different DPI scalor factor.\nPlease note that support for DPI awareness on Windows 7/8 was removed in 3.x. If you need it use previous version.\n\n## Named export\n\n### `getCurrentDisplayMode(): object`\n\nGet the current **primary display** video mode as follows:\n\n```ts\n{\n  width: number, //Horizontal resolution\n  height: number, //Vertical resolution\n  hz: number, //Refresh rate\n  color: number, //Color depth in bits/pixel\n  scale: number|object //DPI scale factor in %\n}\n```\n\n❌ Will throw if not running Win10 or greater.\n\n### `getAvailableDisplayMode(): object[]`\n\nGet all available video modes from the **primary display** as follows: \n\n```ts\n[\n  {\n    width: number, //Horizontal resolution\n    height: number, //Vertical resolution\n    hz: number, //Refresh rate\n    color: number //Color depth in bits/pixel\n  }\n]\n```\n\n❌ Will throw if not running Win10 or greater.\n\n### `getCurrentResolution(): object`\n\nGet the current **primary display** screen resolution as follows:\n\n```ts\n{\n  width: number,\n  height: number\n}\n```\n\nThis is a short hand to `getCurrentDisplayMode()`.\n\n❌ Will throw if not running Win10 or greater.\n\n### `getAvailableResolution(): object[]`\n\nGet all available screen resolutions from the **primary display** as follows sorted _from highest to lowest_ as follows:\n\n```ts\n[\n  {\n    width: number,\n    height: number\n  }\n]\n```\n\nThis is a short hand to `getAvailableDisplayMode()`.\n\n💡 Available screen resolution below _800x600_ are ignored because of Windows 10 min display resolution requirement.\n\n❌ Will throw if not running Win10 or greater.\n\n### `getActiveDisplays(): object[]`\n\nList the current settings of every display devices attached to the desktop as follows:\n\n```ts\n[\n  {\n    id: string, //Device id\n    adapter: string, //Adapter name\n    monitor: string, //Monitor name\n    primary: boolean,\n    width: number, //Pixels X\n    height: number, //Pixels Y\n    hz: number, //Frequency\n    scale: number|object, //DPI scale factor\n    offset: { x: number, y: number } //Position in the Windows virtual screen¹\n  }\n]\n```\n\n¹[Windows virtual screen](https://learn.microsoft.com/en-us/windows/win32/gdi/the-virtual-screen)\n\n❌ Will throw if not running Win10 or greater.\n\n### `setPrimaryDisplay(display: string|number): void`\n\nSwitch the primary display to specified display.\n\nIf display is a `string` then the device id is assumed;\u003cbr /\u003e\nIf it's a `number` then the array index is used.\n\nCall `getActiveDisplays()` to list available displays.\n\n⚠️ Please be carefull that the list of displays might have changed between the time you called `getActiveDisplays()` and `setPrimaryDisplay()`.\nDepending on your use case you might be better of using the device id to avoid this problem.\n\n❌ Will throw on error.\u003cbr /\u003e\n❌ Will throw if not running Win10 or greater.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxan105%2Fnode-win-screen-resolution","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxan105%2Fnode-win-screen-resolution","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxan105%2Fnode-win-screen-resolution/lists"}