在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):Clipy/Magnet开源软件地址(OpenSource Url):https://github.com/Clipy/Magnet开源编程语言(OpenSource Language):Swift 97.8%开源软件介绍(OpenSource Introduction):MagnetCustomize global hotkeys in macOS. Supports usual hotkey and double tap hotkey like Alfred.app. Also supports sandbox application. UsageCocoaPods
Carthage
Upgrading from Magnet v2.x to v3.xSee Upgrading from Magnet v2.x ExampleRegister Normal hotkeyAdd if let keyCombo = KeyCombo(key: .b, cocoaModifiers: [.command, .control]]) {
let hotKey = HotKey(identifier: "CommandControlB", keyCombo: keyCombo, target: self, action: #selector())
hotKey.register() // or HotKeyCenter.shared.register(with: hotKey)
} Or you can use closures. if let keyCombo = KeyCombo(key: .b, cocoaModifiers: [.command, .control]) {
let hotKey = HotKey(identifier: "CommandControlB", keyCombo: keyCombo) { hotKey in
// Called when ⌘ + Control + B is pressed
}
hotKey.register()
} Register Double tap hotkeyAdd if let keyCombo = KeyCombo(doubledCocoaModifiers: .command) {
let hotKey = HotKey(identifier: "CommandDoubleTap", keyCombo: keyCombo, target: self, action: #selector())
hotKey.register() // or HotKeyCenter.shared.register(with: hotKey)
} Add if let keyCombo = KeyCombo(doubledCarbonModifiers: controlKey) {
let hotKey = HotKey(identifier: "ControlDoubleTap", keyCombo: keyCombo, target: self, action: #selector())
hotKey.register() // or HotKeyCenter.shared.register(with: hotKey)
} Support modifiersDouble tap hotkey only support following modifiers.
Unregister hotkeysHotKeyCenter.shared.unregisterAll() or HotKeyCenter.shared.unregisterHotKey(with: "identifier") or let hotKey = HotKey(identifier: "identifier", keyCombo: KeyCombo, target: self, action: #selector())
hotKey.unregister() // or HotKeyCenter.shared.unregister(with: hotKey) DependenciesHow to Build
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论