{"id":28394762,"url":"https://github.com/filippofinke/mouse-hook","last_synced_at":"2026-05-09T09:38:30.885Z","repository":{"id":296009278,"uuid":"992063570","full_name":"filippofinke/mouse-hook","owner":"filippofinke","description":"🖱️ A native Node.js module for hooking into mouse events on macOS","archived":false,"fork":false,"pushed_at":"2025-05-28T15:33:22.000Z","size":13,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-07T18:54:48.308Z","etag":null,"topics":["electron","macos","mouse"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/filippofinke.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2025-05-28T15:01:59.000Z","updated_at":"2025-05-29T08:22:37.000Z","dependencies_parsed_at":"2025-05-28T15:29:30.778Z","dependency_job_id":"87d11027-0a78-44df-87a2-e91103a2861c","html_url":"https://github.com/filippofinke/mouse-hook","commit_stats":null,"previous_names":["filippofinke/mouse-hook"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/filippofinke/mouse-hook","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/filippofinke%2Fmouse-hook","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/filippofinke%2Fmouse-hook/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/filippofinke%2Fmouse-hook/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/filippofinke%2Fmouse-hook/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/filippofinke","download_url":"https://codeload.github.com/filippofinke/mouse-hook/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/filippofinke%2Fmouse-hook/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262166140,"owners_count":23268989,"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","mouse"],"created_at":"2025-05-31T19:00:18.307Z","updated_at":"2026-05-09T09:38:30.849Z","avatar_url":"https://github.com/filippofinke.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eWelcome to mouse-hook\u003c/h1\u003e\n\n\u003e A native Node.js module for hooking into mouse events on macOS\n\n## Features\n\n- [x] Native mouse event hooking on macOS\n- [x] TypeScript support with type definitions\n- [x] Simple callback-based API\n- [x] Real-time mouse click detection\n- [x] Position tracking (x, y coordinates)\n- [x] Button identification (left, right, other)\n\n## Install\n\n```bash\nnpm install mouse-hook\n```\n\n**Requirements:**\n\n- macOS (Currently only supports macOS)\n- Node.js \u003e= 12\n- Accessibility permissions must be granted to the application using this module\n\n## Usage\n\n### TypeScript\n\n```typescript\nimport * as mouseHook from \"mouse-hook\";\n\n// Start listening for mouse events\nmouseHook.startListening((event) =\u003e {\n  console.log(\n    `Button ${event.button} clicked at position (${event.x}, ${event.y})`\n  );\n});\n\n// Check if currently listening\nconsole.log(`Currently listening: ${mouseHook.isListening()}`);\n\n// Stop listening when done\n// mouseHook.stopListening();\n```\n\n### JavaScript\n\n```javascript\nconst mouseHook = require(\"mouse-hook\");\n\n// Start listening for mouse events\nmouseHook.startListening((event) =\u003e {\n  console.log(\n    `Button ${event.button} clicked at position (${event.x}, ${event.y})`\n  );\n});\n```\n\n### API Reference\n\n#### Types\n\n```typescript\ninterface MouseEvent {\n  button: number; // 0 = left, 1 = right, 2 = other\n  x: number; // x-coordinate\n  y: number; // y-coordinate\n}\n\ntype MouseEventCallback = (event: MouseEvent) =\u003e void;\n```\n\n#### Methods\n\n- `startListening(callback: MouseEventCallback): boolean` - Start listening for mouse events\n- `stopListening(): boolean` - Stop listening for mouse events\n- `isListening(): boolean` - Check if currently listening for mouse events\n\n### Running Examples\n\n```bash\n# Run the basic example\nnpm run example\n\n# Run the advanced example (with TypeScript)\nnpx ts-node examples/advanced.ts\n```\n\n## Development\n\n```bash\n# Install dependencies\nnpm install\n\n# Build the native module and TypeScript\nnpm run rebuild\n\n# Clean build files\nnpm run clean\n```\n\n**Note:** This module requires accessibility permissions to access mouse events. When your application attempts to use mouse-hook for the first time, macOS will prompt the user for these permissions.\n\n## Author\n\n👤 **Filippo Finke**\n\n- Website: [https://filippofinke.ch](https://filippofinke.ch)\n- Twitter: [@filippofinke](https://twitter.com/filippofinke)\n- Github: [@filippofinke](https://github.com/filippofinke)\n- LinkedIn: [@filippofinke](https://linkedin.com/in/filippofinke)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffilippofinke%2Fmouse-hook","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffilippofinke%2Fmouse-hook","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffilippofinke%2Fmouse-hook/lists"}