{"id":13479527,"url":"https://github.com/soffes/HotKey","last_synced_at":"2025-03-27T09:32:51.165Z","repository":{"id":50636724,"uuid":"97940973","full_name":"soffes/HotKey","owner":"soffes","description":"Simple global shortcuts in macOS","archived":false,"fork":false,"pushed_at":"2024-06-07T06:26:24.000Z","size":76,"stargazers_count":926,"open_issues_count":30,"forks_count":82,"subscribers_count":11,"default_branch":"main","last_synced_at":"2024-10-01T18:17:44.836Z","etag":null,"topics":["appkit","carbon","carthage","keyboard","macos","shortcut","swift"],"latest_commit_sha":null,"homepage":null,"language":"Swift","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/soffes.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":"Support/HotKey.h","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-07-21T11:30:55.000Z","updated_at":"2024-09-29T14:20:09.000Z","dependencies_parsed_at":"2024-06-18T20:11:05.267Z","dependency_job_id":null,"html_url":"https://github.com/soffes/HotKey","commit_stats":{"total_commits":57,"total_committers":5,"mean_commits":11.4,"dds":0.08771929824561409,"last_synced_commit":"4d02d80de143d69b7eeb5962729591a157a57ede"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soffes%2FHotKey","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soffes%2FHotKey/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soffes%2FHotKey/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soffes%2FHotKey/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/soffes","download_url":"https://codeload.github.com/soffes/HotKey/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222230567,"owners_count":16952662,"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":["appkit","carbon","carthage","keyboard","macos","shortcut","swift"],"created_at":"2024-07-31T16:02:18.433Z","updated_at":"2025-03-27T09:32:51.160Z","avatar_url":"https://github.com/soffes.png","language":"Swift","readme":"# HotKey\n\n[![Version](https://img.shields.io/github/release/soffes/HotKey.svg)](https://github.com/soffes/HotKey/releases)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![CocoaPods compatible](https://img.shields.io/cocoapods/v/HotKey.svg)](https://cocoapods.org/pods/HotKey)\n\nSimple global shortcuts in macOS. HotKey wraps the Carbon APIs for dealing with global hot keys to make it easy to use in Swift.\n\n## Installation\n\n### Swift Package Manager\n\nFor installation with [Swift Package Manager](https://github.com/apple/swift-package-manager), simply add the following to your `Package.swift`:\n\n``` swift\n.package(url: \"https://github.com/soffes/HotKey\", from: \"0.2.1\")\n```\n\n### Carthage\n\nFor installation with [Carthage](https://github.com/carthage/carthage), simply add the following to your `Cartfile`:\n\n``` ruby\ngithub \"soffes/HotKey\"\n```\n\n### CocoaPods\n\nFor installation with [CocoaPods](http://cocoapods.org), simply add the following to your `Podfile`:\n\n```ruby\npod 'HotKey'\n```\n\n## Usage\n\nSimply initialize a `HotKey` with a key and modifiers:\n\n```swift\n// Setup hot key for ⌥⌘R\nlet hotKey = HotKey(key: .r, modifiers: [.command, .option])\n```\n\nThis is a convenice initializer that creates a `KeyCombo` for you. You can also initialize with a Carbon key code and Carbon modifier flags if you’re feeling old school.\n\nNow you can set the `keyDownHandler` and get callbacks for when your hot key is pressed:\n\n```swift\nhotKey.keyDownHandler = {\n  print(\"Pressed at \\(Date())\")\n}\n```\n\nYou can also implement `hotKey.keyUpHandler` if you’d like.\n\nYou don’t need to think about when handlers are registered and unregistered. This all happens automatically based on the `HotKey` object’s lifecycle.\n\n## Thanks\n\nHotKey was heavily inspired by PTHotKey.\n","funding_links":[],"categories":["Swift"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoffes%2FHotKey","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoffes%2FHotKey","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoffes%2FHotKey/lists"}