{"id":13479492,"url":"https://github.com/Clipy/Magnet","last_synced_at":"2025-03-27T09:32:37.300Z","repository":{"id":5553276,"uuid":"53421480","full_name":"Clipy/Magnet","owner":"Clipy","description":"Customize global hotkeys in macOS.","archived":false,"fork":false,"pushed_at":"2024-11-06T00:41:31.000Z","size":187,"stargazers_count":434,"open_issues_count":9,"forks_count":44,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-24T12:10:00.726Z","etag":null,"topics":["alfred","clipy","dvorak","hotkey","macos","qwerty","sandbox","shortcut","swift"],"latest_commit_sha":null,"homepage":"https://clipy-app.com","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/Clipy.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":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-03-08T15:07:28.000Z","updated_at":"2025-03-23T19:16:31.000Z","dependencies_parsed_at":"2024-05-20T08:44:07.723Z","dependency_job_id":"bc9ed223-09f9-4dde-a35a-7e4be12e8a45","html_url":"https://github.com/Clipy/Magnet","commit_stats":{"total_commits":114,"total_committers":10,"mean_commits":11.4,"dds":0.3157894736842105,"last_synced_commit":"0d6a869cbb40142488ed58c1be631b6823fca169"},"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Clipy%2FMagnet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Clipy%2FMagnet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Clipy%2FMagnet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Clipy%2FMagnet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Clipy","download_url":"https://codeload.github.com/Clipy/Magnet/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245817631,"owners_count":20677323,"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":["alfred","clipy","dvorak","hotkey","macos","qwerty","sandbox","shortcut","swift"],"created_at":"2024-07-31T16:02:17.498Z","updated_at":"2025-03-27T09:32:37.262Z","avatar_url":"https://github.com/Clipy.png","language":"Swift","readme":"# Magnet\n![CI](https://github.com/Clipy/Magnet/workflows/Xcode-Build/badge.svg)\n[![Release version](https://img.shields.io/github/release/Clipy/Magnet.svg)](https://github.com/Clipy/Magnet/releases/latest)\n[![License: MIT](https://img.shields.io/github/license/Clipy/Magnet.svg)](https://github.com/Clipy/Magnet/blob/master/LICENSE)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![Version](https://img.shields.io/cocoapods/v/Magnet.svg)](http://cocoadocs.org/docsets/Magnet)\n[![Platform](https://img.shields.io/cocoapods/p/Magnet.svg)](http://cocoadocs.org/docsets/Magnet)\n[![SPM supported](https://img.shields.io/badge/SPM-supported-DE5C43.svg?style=flat)](https://swift.org/package-manager)\n\nCustomize global hotkeys in macOS. Supports usual hotkey and double tap hotkey like Alfred.app.\n\nAlso supports sandbox application.\n\n## Usage\n### CocoaPods\n```\npod 'Magnet'\n```\n\n### Carthage\n```\ngithub \"Clipy/Magnet\"\n```\n\n## Upgrading from Magnet v2.x to v3.x\nSee [Upgrading from Magnet v2.x](/Documentation/Upgrading_Magnet_2.md)\n\n## Example\n### Register Normal hotkey\nAdd `⌘ + Control + B` hotkey.\n\n```swift\nif let keyCombo = KeyCombo(key: .b, cocoaModifiers: [.command, .control]]) {\n   let hotKey = HotKey(identifier: \"CommandControlB\", keyCombo: keyCombo, target: self, action: #selector())\n   hotKey.register() // or HotKeyCenter.shared.register(with: hotKey)\n}\n```\n\nOr you can use closures.\n```swift\nif let keyCombo = KeyCombo(key: .b, cocoaModifiers: [.command, .control]) {\n    let hotKey = HotKey(identifier: \"CommandControlB\", keyCombo: keyCombo) { hotKey in\n        // Called when ⌘ + Control + B is pressed\n    }\n    hotKey.register()\n}        \n```\n\n### Register Double tap hotkey\nAdd `⌘ double tap` hotkey.\n```swift\nif let keyCombo = KeyCombo(doubledCocoaModifiers: .command) {\n   let hotKey = HotKey(identifier: \"CommandDoubleTap\", keyCombo: keyCombo, target: self, action: #selector())\n   hotKey.register() // or HotKeyCenter.shared.register(with: hotKey)\n}\n```\n\nAdd `Control double tap` hotkey.\n```swift\nif let keyCombo = KeyCombo(doubledCarbonModifiers: controlKey) {\n   let hotKey = HotKey(identifier: \"ControlDoubleTap\", keyCombo: keyCombo, target: self, action: #selector())\n   hotKey.register() // or HotKeyCenter.shared.register(with: hotKey)\n}\n```\n\n#### Support modifiers\nDouble tap hotkey only support following modifiers.\n- Command Key\n  - `NSEventModifierFlags.command` or `cmdKey`\n- Shift Key\n  - `NSEventModifierFlags.shift` or `shiftKey`\n- Option Key\n  - `NSEventModifierFlags.option` or `optionKey`\n- Control Key\n  - `NSEventModifierFlags.control` or `controlKey`\n\n### Unregister hotkeys\n```swift\nHotKeyCenter.shared.unregisterAll()\n```\n\nor\n\n```swift\nHotKeyCenter.shared.unregisterHotKey(with: \"identifier\")\n```\n\nor\n\n```swift\nlet hotKey = HotKey(identifier: \"identifier\", keyCombo: KeyCombo, target: self, action: #selector())\nhotKey.unregister() // or HotKeyCenter.shared.unregister(with: hotKey)\n```\n\n## Dependencies\n- [Sauce](https://github.com/Clipy/Sauce)\n\n## How to Build\n1. Move to the project root directory\n2. Install dependency library with `carthage` or `git submodule`\n3. `carthage checkout --use-submodules` or `git submodule update --init --recursive`\n4. Open `Magnet.xcworkspace` on Xcode.\n5. build.\n","funding_links":[],"categories":["Swift"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FClipy%2FMagnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FClipy%2FMagnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FClipy%2FMagnet/lists"}