Global "Command" key listener

Discussion in 'Mac Programming' started by vg-gb, Nov 5, 2013.

  1. vg-gb macrumors newbie

    Nov 5, 2013
    I'm working on a "status bar" application.

    I want to switch my app into "mode B" whenever the Command ⌘ key is pressed (and released: keyDown + keyUp). Globally.

    Command + <Key> combinations should work as usual.

    "Mode B" lasts only 3 seconds. Within this period the app catches all keyboard events. Active application focus should not change.

    I'm a beginner, don't know where to start.

    Any thoughts about that? Please, help!
  2. robbieduncan Moderator emeritus


    Jul 24, 2002
    So essentially you are asking for help making an app with a secret keylogger function? I don't think that's wise...
  3. vg-gb, Nov 5, 2013
    Last edited: Nov 5, 2013

    vg-gb thread starter macrumors newbie

    Nov 5, 2013
    Keylogger? Nope! I just want to use combinations of Command + <key> without interference with any other predefined ⌘-combinations.

    I believe that the only way to do this is to release "Command" before pressing a meaningful key. Useability hack, nothing more.
  4. ArtOfWarfare macrumors G3


    Nov 26, 2007
    There's no high level way of doing this, and I haven't done this kind of thing in several months, but I believe the terms you should search for are "Event Taps".

Share This Page