Register global hotkeys on Mac?

I am writing an application with Titanium Developer that allows you to use Javascript, PHP, Ruby and Python. It provides an API with certain standard functions that may be required, but one that does not have global events.

Now I want to assign global hotkeys for my application and is pretty much left slurred. Now I focus only on MAC, but I can not find solutions for Python or Ruby. I found the following library for the Cocoa library:

https://github.com/secondgear/SGHotKeysLib

But I don’t have zero experience in Objective-C and I don’t want to invest time in learning it just to implement one thing.

Can someone advise me on one of the following.

  • How to register global hotkeys on Mac using Python
  • How to register global hotkeys on mac with Ruby
  • How to use SGHotkeysLib to create a CLI daemon that could redirect global hotkeys to other applications (I could use a command line tool to, for example, register that Command + K starts a specific application).

Or perhaps any other ideas that I did not think about?

It would be very helpful to evaluate the pointer in the right direction.

Thanks in advance.

+4
source share
1 answer

You can use Python to directly call PyObjC, which is the Python interface for Objective-C. A search for "pyobjc hotkey" appeared on this document . (For some reason, on the official PyObjC, for some reason, it is broken.)

+2
source

All Articles