Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

29 lines (20 sloc) 1.131 kb
from Foundation import *
from AppKit import *
# based on example at
#from Carbon.CarbonEvt import RegisterEventHotKey, GetApplicationEventTarget
from Carbon.Events import cmdKey, controlKey
kEventHotKeyPressedSubtype = 6
kEventHotKeyReleasedSubtype = 9
class PyShelfApplication(NSApplication):
def finishLaunching(self):
super(PyShelfApplication, self).finishLaunching()
# register cmd-control-J
#if NSUserDefaults.standardUserDefaults().boolForKey_("useHotkey"):
# self.hotKeyRef = RegisterEventHotKey(38, cmdKey | controlKey, (0, 0), GetApplicationEventTarget(), 0)
def sendEvent_(self, theEvent):
if theEvent.type() == NSSystemDefined and theEvent.subtype() == kEventHotKeyPressedSubtype:
if NSUserDefaults.standardUserDefaults().boolForKey_("useHotkey"):
if self.delegate():
super(PyShelfApplication, self).sendEvent_(theEvent)
Jump to Line
Something went wrong with that request. Please try again.