HotKey icon indicating copy to clipboard operation
HotKey copied to clipboard

Doesn't seem to work?

Open ospfranco opened this issue 4 years ago • 5 comments

Hey, first thanks for creating the library, I was just in the process of setting it up, so I'm just doing some basic test, but this doesn't seem to work:

func applicationDidFinishLaunching(_ aNotification: Notification) {
       // Register global hotkey
        let hotkey = HotKey(keyCombo: KeyCombo(key: .r, modifiers: [.command, .option]))
        hotkey.keyDownHandler = {
            print("Something should happen")
        }

Am I registering it the wrong place or?

ospfranco avatar May 09 '20 14:05 ospfranco

Ah, I just got it working, the hotkey declaration cannot be a local variable, it needs to be in the class so it doesn't get de-allocated, I think it would be useful to mention it on the Readme, I will create a PR

ospfranco avatar May 09 '20 14:05 ospfranco

https://github.com/soffes/HotKey/pull/27

ospfranco avatar May 09 '20 14:05 ospfranco

Thank you so much @ospfranco, it's truly helpful! 🙏🏻

wilbertliu avatar Jun 02 '20 06:06 wilbertliu

thanks I needed this! needs to be added to readme

brendanballon avatar Jun 28 '20 13:06 brendanballon

thanks

lx70770 avatar Jun 28 '21 03:06 lx70770

thanks

LingYanSi avatar Jan 03 '23 09:01 LingYanSi