{"id":20073577,"url":"https://github.com/ragingwind/electron-shortcut","last_synced_at":"2025-05-05T21:30:55.091Z","repository":{"id":57221894,"uuid":"47220002","full_name":"ragingwind/electron-shortcut","owner":"ragingwind","description":"Helper for global shortcut registering","archived":false,"fork":false,"pushed_at":"2016-12-27T08:37:43.000Z","size":40,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-21T07:09:47.082Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/ragingwind.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}},"created_at":"2015-12-01T21:59:00.000Z","updated_at":"2018-02-16T11:18:55.000Z","dependencies_parsed_at":"2022-08-29T04:01:55.631Z","dependency_job_id":null,"html_url":"https://github.com/ragingwind/electron-shortcut","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ragingwind%2Felectron-shortcut","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ragingwind%2Felectron-shortcut/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ragingwind%2Felectron-shortcut/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ragingwind%2Felectron-shortcut/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ragingwind","download_url":"https://codeload.github.com/ragingwind/electron-shortcut/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252579993,"owners_count":21771248,"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-11-13T14:46:50.040Z","updated_at":"2025-05-05T21:30:54.794Z","avatar_url":"https://github.com/ragingwind.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# electron-shortcut\n\n\u003e Helper for registering global shortcut\n\n\n## Install\n\n```\n$ npm install --save electron-shortcut\n```\n\n\n## Usage\n\n```js\nconst Shortcut = require('electron-shortcut');\n\n// create and register a shortcut with auto-register when windows got focus\nvar shortcut = new Shortcut('Command+1', handler);\n\n// create and register shortcuts with manual-register\nvar shortcut = new Shortcut(['Command+2', 'Command+3'], {\n\tautoRegister: false\n}, handler);\n\nshortcut.register();\n\n// with static method\nShortcut.register('Command+1', {autoRegister: true}, handler);\nShortcut.unregister();\n```\n\n## Shortcut(events, [options], handler)\n\n#### events\n\nType: `string` or 'array'\n\nNames for shortcut to register as global shortcut\n\n#### options\n\n- `autoRegister`: default: true, Auto un/register shortcuts on windows got focus.\n- `cmdOrCtrl`: default: false, All events of Command or Cmd will be changed into Control or Ctrl by OS running your application on\n\n#### handler\n\nGlobal event handler for events\n\n### register()\n\nRegister shortcuts with shortcut list already added.\n\n### unregister()\n\nUnregister shortcuts with shortcut list already added.\n\n### add(events, [options], handler)\n\nAdd a new shortcut\n\n### remove(events)\n\nRemove a shortcut. If events is not set, remove all of events.\n\n### get(events)\n\nReturn array of shortcut by event names\n\n### set(events, [options], handler)\n\nUpdate shortcut with new options by event name\n\n## Shortcut.register(events, [options], handler)\n\nRegister events with static method. See [Shortcut](#shortcutevents-options-handler) for more information of arguments.\n\n## Shortcut.unregister([events])\n\nUnregister events with static method\n\n## License\n\nMIT © [ragingwind](http://ragingwind.me)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fragingwind%2Felectron-shortcut","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fragingwind%2Felectron-shortcut","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fragingwind%2Felectron-shortcut/lists"}