{"id":13784827,"url":"https://github.com/defuncart/global_shortcuts","last_synced_at":"2025-04-07T08:32:23.313Z","repository":{"id":50242766,"uuid":"371925304","full_name":"defuncart/global_shortcuts","owner":"defuncart","description":"A macOS plugin which can register a callback for a global keyboard shortcut.","archived":false,"fork":false,"pushed_at":"2021-05-31T18:39:33.000Z","size":97,"stargazers_count":8,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-22T15:22:58.232Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Dart","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/defuncart.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-05-29T08:53:36.000Z","updated_at":"2023-06-03T01:33:31.000Z","dependencies_parsed_at":"2022-09-14T22:23:23.759Z","dependency_job_id":null,"html_url":"https://github.com/defuncart/global_shortcuts","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/defuncart%2Fglobal_shortcuts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/defuncart%2Fglobal_shortcuts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/defuncart%2Fglobal_shortcuts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/defuncart%2Fglobal_shortcuts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/defuncart","download_url":"https://codeload.github.com/defuncart/global_shortcuts/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247620409,"owners_count":20968207,"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":[],"created_at":"2024-08-03T19:00:53.039Z","updated_at":"2025-04-07T08:32:22.808Z","avatar_url":"https://github.com/defuncart.png","language":"Dart","funding_links":[],"categories":["Packages"],"sub_categories":[],"readme":"# global_shortcuts\n\nA macOS plugin which can register a callback for a global keyboard shortcut.\n\nAs the shortcut is global, the callback will be triggered even when the app does not have focus.\n\n## Installation\n\n```yaml\ndependencies:\n  global_shortcuts: any\n```\n\n## Usage\n\nRegister a callback for a given `ShortcutKey` and zero or more `ShortcutModifier`\n\n```dart\nFuture\u003cvoid\u003e register() async {\n  try {\n    await GlobalShortcuts.register(\n      key: ShortcutKey.r,\n      modifiers: [ShortcutModifier.shift, ShortcutModifier.command],\n      onKeyCombo: _onKeyCombo,\n    );\n  } on Exception catch (_) {}\n}\n\nvoid _onKeyCombo() =\u003e print('Shortcut Pressed at ${DateTime.now()}');\n```\n\nShortcut can be unregistered using\n\n```dart\nFuture\u003cvoid\u003e unregister() async {\n  try {\n    await GlobalShortcuts.unregister();\n  } on Exception catch (_) {}\n}\n```\n\nOnly one shortcut combo can be registered. If, for instance, CTRL+SPACE is registered after SHIFT+CMD+R, then the callback for SHIFT+CMD+R will no longer be invoked.\n\n## Notes\n\n* Presently the plugin only supports macOS. Windows support may be investigated, linux support is unlikely.\n* macOS plugin uses [HotKey](https://github.com/soffes/HotKey/) which does not seem to support all modifiers (i.e fn) while os global shortcuts like CMD+SPACE do not seem to be caught.\n* Due to 0.0.x versioning, package is presently experimental.\n\n## Collaboration\n\nSpotted any problems? Please open [an issue on GitHub](https://github.com/defuncart/global_shortcuts/issues)! Would like to work on a windows or linux version? Fork the repo and submit a PR!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdefuncart%2Fglobal_shortcuts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdefuncart%2Fglobal_shortcuts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdefuncart%2Fglobal_shortcuts/lists"}