soffes / HotKey

Simple global shortcuts in macOS
MIT License
921 stars 82 forks source link

Is it possible to make a hotkey with multiple keys #45

Open NiklasWyld opened 7 months ago

NiklasWyld commented 7 months ago

I know and also use the “normal” HotKeys.

HotKey(key: .p, modifiers: [.control], keyUpHandler: { ... })

However, I now wanted to use a HotKey with a modifier but more different keys. But I can only specify one key for a HotKey/KeyCombo.

Something like this: HotKey(keys: [.a, .b], modifiers: [.control], keyUpHandler: { ... })

INCHMAN1900 commented 4 months ago

This is not recommended. However if you want to achieve this, you can use NSEvent.addGlobalEventListener to monitor keydown and keyup event on your own.