{"id":18520549,"url":"https://github.com/mullvad/nseventmonitor","last_synced_at":"2025-04-09T09:32:53.238Z","repository":{"id":18813615,"uuid":"82487379","full_name":"mullvad/NSEventMonitor","owner":"mullvad","description":"Node.js module for monitoring NSEvents","archived":false,"fork":false,"pushed_at":"2024-10-16T08:27:43.000Z","size":460,"stargazers_count":18,"open_issues_count":1,"forks_count":4,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-04-08T15:51:06.409Z","etag":null,"topics":["electron","macos","menubar","nsevent"],"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/mullvad.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":"2017-02-19T20:27:56.000Z","updated_at":"2025-04-04T04:26:17.000Z","dependencies_parsed_at":"2023-01-11T20:29:53.659Z","dependency_job_id":"db29451b-1fd0-4bf0-b911-d89a4754dac0","html_url":"https://github.com/mullvad/NSEventMonitor","commit_stats":null,"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mullvad%2FNSEventMonitor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mullvad%2FNSEventMonitor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mullvad%2FNSEventMonitor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mullvad%2FNSEventMonitor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mullvad","download_url":"https://codeload.github.com/mullvad/NSEventMonitor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248012650,"owners_count":21033234,"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":["electron","macos","menubar","nsevent"],"created_at":"2024-11-06T17:21:09.375Z","updated_at":"2025-04-09T09:32:52.917Z","avatar_url":"https://github.com/mullvad.png","language":"Objective-C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NSEventMonitor\n[![Build Status](https://api.travis-ci.org/mullvad/NSEventMonitor.svg)](https://travis-ci.org/mullvad/NSEventMonitor)\n[![dependencies Status](https://david-dm.org/mullvad/NSEventMonitor/status.svg)](https://david-dm.org/mullvad/NSEventMonitor)\n[![devDependencies Status](https://david-dm.org/mullvad/NSEventMonitor/dev-status.svg)](https://david-dm.org/mullvad/NSEventMonitor?type=dev)\n\nCurrently when building menubar apps with Electron, `window.on('blur', ...)` does not fire if user clicks on other menubar items leaving displayed window on screen.\n\nNative macOS popovers usually hide if user clicks anywhere on screen. This extension attempts to fix that for Electron apps, so the following will never be the case anymore:\n\n\u003cimg src=\"readme/screenshot.png\" width=\"200\" /\u003e\n\n## Example\n\n```js\nimport { NSEventMonitor, NSEventMask } from 'nseventmonitor';\n\nlet macEventMonitor = new NSEventMonitor();\n\nwindow.on('blur', () =\u003e {\n  window.hide();\n});\n\nwindow.on('show', () =\u003e {\n  // start capturing global mouse events\n  macEventMonitor.start((NSEventMask.leftMouseDown | NSEventMask.rightMouseDown), () =\u003e {\n    window.hide();\n  });\n});\n\nwindow.on('hide', () =\u003e {\n  // stop capturing global mouse events\n  macEventMonitor.stop();\n});\n```\n\nTo run example app:\n\n```\n$ cd example\n$ npm i\n$ npm start\n```\n\n## Electron support\n\nElectron comes with its own Node.js runtime, which may differ from the one installed on your \ndesktop. Therefore all native modules have to be built specifically for Electron.\n\nWe strongly advise to use `electron-builder` and add a `postinstall` script to your \n`package.json` in order to automatically compile native modules for Electron:\n\n```\nelectron-builder install-app-deps\n```\n\n## Building from source\n\nTo compile the extension run the following command:\n\n```\n$ npm i --build-from-source\n```\n\nYou can confirm everything built correctly by [running the test suite](#to-run-tests).\n\n### To run tests:\n\n```\n$ npm test\n```\n\nNote: tests are currently disabled due to issues with automation on macOS.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmullvad%2Fnseventmonitor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmullvad%2Fnseventmonitor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmullvad%2Fnseventmonitor/lists"}