开发者

Registering Global Hotkeys on a mac?

开发者 https://www.devze.com 2023-02-28 20:21 出处:网络
I\'m writing an app with Titanium Developer which lets me use Javascript, PHP, Ruby and Python. It provides an API with certain standard features one might want but one that\'s lacking is global event

I'm writing an app with Titanium Developer which lets me use Javascript, PHP, Ruby and Python. It provides an API with certain standard features one might want but one that's lacking is global events.

Now I want to assign global hotkeys to my app and are pretty much left clueless. Right now I'm only targeting MAC but am unable to find any solutions for Python or Ruby. I've found the following library for Cocoa which seems able to do it:

https://github.com/secondgear/SGHotKeysLib

But I have zero experience in Objective C and don't want to invest the time into learning it just to implement one single thing.

Can anyone advice me on one of the following..

  • How to register global hotkeys on a mac with Python
  • How to register global hotkeys on a mac with Ruby
  • How to use SGHotkeysLib to make a CLI daemon that could direct global hotkeys to other apps (I could use a command line tool to, for example, register that Command+K runs a certain app).

Or possibly any other ideas I haven't thought of?

Just a pointer in the right directi开发者_Python百科on would be much appreciated.

Thanks in advance.


You may be able to use Python to directly invoke PyObjC, which is a Python interface to Objective-C. A search for "pyobjc hotkey" turned up this document. (The one at the official PyObjC is broken for some reason.)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号