{"id":15699880,"url":"https://github.com/codebytere/node-mac-notch","last_synced_at":"2025-05-12T12:43:22.792Z","repository":{"id":74394893,"uuid":"419643318","full_name":"codebytere/node-mac-notch","owner":"codebytere","description":" A native Node.js module to fetch information about the new camera notch at the top of some MacBooks","archived":false,"fork":false,"pushed_at":"2021-11-15T11:51:06.000Z","size":75,"stargazers_count":6,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-31T22:11:23.133Z","etag":null,"topics":["electronjs","macos","napi","nodejs"],"latest_commit_sha":null,"homepage":"","language":"Objective-C++","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/codebytere.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}},"created_at":"2021-10-21T08:34:05.000Z","updated_at":"2022-12-21T08:33:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"6130c183-4fc4-470f-8551-77a62de1fac9","html_url":"https://github.com/codebytere/node-mac-notch","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codebytere%2Fnode-mac-notch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codebytere%2Fnode-mac-notch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codebytere%2Fnode-mac-notch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codebytere%2Fnode-mac-notch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codebytere","download_url":"https://codeload.github.com/codebytere/node-mac-notch/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253742529,"owners_count":21957039,"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":["electronjs","macos","napi","nodejs"],"created_at":"2024-10-03T19:41:59.771Z","updated_at":"2025-05-12T12:43:22.762Z","avatar_url":"https://github.com/codebytere.png","language":"Objective-C++","readme":"# node-mac-notch\n\nA native Node.js module to fetch information about the new camera notch at the top of some MacBook Pros.\n\n## API\n\n### `Display` Object\n\nThe `Display` object represents a physical display connected to the system. A\nfake `Display` may exist on a headless system, or a `Display` may correspond to\na remote, virtual display.\n\nDisplay objects take the following format:\n\n* `id` Number - The display's unique identifier.\n* `name` String - The human-readable name of the display.\n* `supportedWindowDepths` Number[] - The window depths supported by the display.\n* `rotation` Number - The screen rotation in clockwise degrees.\n* `scaleFactor` Number - Output device's pixel scale factor.\n* `isMonochrome` Boolean - Whether or not the display is a monochrome display.\n* `colorSpace` Object - Representation of a custom color space.\n  * `name` String - The localized name of the color space.\n  * `componentCount` Number - The number of components, excluding alpha, the color space supports.\n* `depth` Number - The number of bits per pixel.\n* `bounds` Object\n  * `x` Number - The x coordinate of the origin of the rectangle.\n  * `y` Number - The y coordinate of the origin of the rectangle.\n  * `width` Number - The width of the rectangle.\n  * `height` Number - The height of the rectangle.\n* `workArea` Object\n  * `x` Number - The x coordinate of the origin of the rectangle.\n  * `y` Number - The y coordinate of the origin of the rectangle.\n  * `width` Number - The width of the rectangle.\n  * `height` Number - The height of the rectangle.\n* `internal` Boolean - `true` for an internal display and `false` for an external display.\n* `isAsleep` Boolean -  Whether or not the display is sleeping.\n* `refreshRate` Number - Returns the refresh rate of the specified display.\n\n### `notch.getAllDisplays()`\n\nReturns `Array\u003cDisplay\u003e` - An array of display objects.\n\nExample:\n\n```js\nconst notch = require('node-mac-notch')\n\nconst displays = notch.getAllDisplays()\n\nconsole.log(displays[0])\n/* Prints:\n[\n  {\n    id: 69734406,\n    name: 'Built-in Retina Display',\n    refreshRate: 0,\n    supportedWindowDepths: [\n      264, 516, 520, 528,\n      544,   0,   0,   0\n    ],\n    isAsleep: false,\n    isMonochrome: false,\n    colorSpace: { name: 'Color LCD', componentCount: 3 },\n    depth: 520,\n    scaleFactor: 2,\n    bounds: { x: 0, y: 0, width: 1680, height: 1050 },\n    workArea: { x: 0, y: 23, width: 1680, height: 932 },\n    rotation: 0,\n    internal: true\n  }\n]\n*/\n```\n\nSee [Apple Documentation](https://developer.apple.com/documentation/appkit/nsscreen?language=objc) for more information.\n\n### `notch.getDisplayByID(displayID)`\n\n* `displayID` Number - The display's unique identifier.\n\nReturns `Display` - the display with the specified `displayID`.\n\nExample:\n\n```js\nconst notch = require('node-mac-notch')\n\nconst display = displays.getDisplayByID(2077749241)\n\nconsole.log(display)\n/* Prints:\n{\n  id: 69734406,\n  name: 'Built-in Retina Display',\n  refreshRate: 0,\n  supportedWindowDepths: [\n    264, 516, 520, 528,\n    544,   0,   0,   0\n  ],\n  isAsleep: false,\n  isMonochrome: false,\n  colorSpace: { name: 'Color LCD', componentCount: 3 },\n  depth: 520,\n  scaleFactor: 2,\n  bounds: { x: 0, y: 0, width: 1680, height: 1050 },\n  workArea: { x: 0, y: 23, width: 1680, height: 932 },\n  rotation: 0,\n  internal: true\n}\n*/\n```\n\nSee [Apple Documentation](https://developer.apple.com/documentation/appkit/nsscreen?language=objc) for more information.\n\n### `notch.safeAreaInsets([displayID])`\n\n* `displayID` Number (optional) - the unique identifier corresponding to a specific display. If no `displayID` is passed, this function will choose the main display your computer has in focus.\n\nReturns `Object` - an object containing the distances from the display's edges at which content isn’t obscured.\n  * `bottom` - The distance from the bottom of the source rectangle to the bottom of the result rectangle.\n  * `left` - The distance from the left side of the source rectangle to the left side of the result rectangle.\n  * `right` - The distance from the right side of the source rectangle to the right side of the result rectangle.\n  * `top` - The distance from the top of the source rectangle to the top of the result rectangle.\n\nIf the display corresponding to `displayID` (or the primary display) does not have a camera housing notch, this function will return `{ bottom: 0, left: 0, top: 0, right: 0 }`.\n\nExample:\n\n```js\nconst notch = require('node-mac-notch')\n\nconst insets = notch.safeAreaInsets()\n\nconsole.log(insets)\n/* Prints:\n{\n  bottom: 0,\n  left: 0,\n  right: 0,\n  top: 38\n}\n*/\n```\n\nSee [Apple Documentation](https://developer.apple.com/documentation/appkit/nsscreen/3882821-safeareainsets?language=objc) for more information.\n\n### `notch.auxiliaryTopLeftArea([displayID])`\n\n* `displayID` Number (optional) - the unique identifier corresponding to a specific display. If no `displayID` is passed, this function will choose the main display your computer has in focus.\n\nReturns `Object` - An object representing the unobscured portion of the top-left corner of the screen.\n  * `x` Number - The x-coordinate of the point, from the bottom left of the display.\n  * `y` Number - The y-coordinate of the point,  from the bottom left of the display.\n  * `width` Number - The width of the safe display area.\n  * `height` Number - The height of the safe display area.\n\nIf this is a notched display, the return value for this method represents the visible top-left portion of the screen. If this is not a notched display, the `width` and `height` properties of `size` will be 0.\n\nExample:\n\n```js\nconst notch = require('node-mac-notch')\n\nconst area = notch.auxiliaryTopLeftArea()\n\nconsole.log(area)\n/* Prints:\n{\n  x: 0,\n  y: 1131,\n  width: 790,\n  height: 38\n}\n*/\n```\n\nSee [Apple Documentation](https://developer.apple.com/documentation/appkit/nsscreen/3882915-auxiliarytopleftarea) for more information.\n\n### `notch.auxiliaryTopRightArea([displayID])`\n\n* `displayID` Number (optional) - the unique identifier corresponding to a specific display. If no `displayID` is passed, this function will choose the main display your computer has in focus.\n\nReturns `Object` - An object representing the unobscured portion of the top-right corner of the screen.\n  * `x` Number - The x-coordinate of the point, from the bottom left of the display.\n  * `y` Number - The y-coordinate of the point,  from the bottom left of the display.\n  * `width` Number - The width of the safe display area.\n  * `height` Number - The height of the safe display area.\n\nIf this is a notched display, the return value for this method represents the visible top-right portion of the screen. If this is not a notched display, the `width` and `height` properties of `size` will be 0.\n\nExample:\n\n```js\nconst notch = require('node-mac-notch')\n\nconst area = notch.auxiliaryTopRightArea()\n\nconsole.log(area)\n/* Prints:\n{\n  x: 1010,\n  y: 1131,\n  width: 790,\n  height: 38\n}\n*/\n```\n\nSee [Apple Documentation](https://developer.apple.com/documentation/appkit/nsscreen/3882915-auxiliarytoprightarea) for more information.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodebytere%2Fnode-mac-notch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodebytere%2Fnode-mac-notch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodebytere%2Fnode-mac-notch/lists"}