skip to navigation
skip to content

Not Logged In

osxmmkeys 0.0.4

Easily handle media keys on OS X.

osxmmkeys is a simple Python library for handling media keys on OS X. Key presses can be observed with no side effects, or have their default behaviours overridden entirely.

Installation

To install osxmmkeys with pip, use:

$ pip install pyobjc-core
$ pip install osxmmkeys

The extra install command is due to an issue in pyobjc. It will work without it, but will be quite a bit slower.

Usage

Simple example:

import osxmmkeys

def handler():
    print("Play/pause key was pressed")

tap = osxmmkeys.Tap()
tap.on('play_pause', handler)
tap.run()

Threaded example:

import osxmmkeys, time

def handler():
    print("Play/pause key was pressed")

tap = osxmmkeys.Tap()
tap.on('play_pause', handler)
tap.start()

try:
    while True:
        time.sleep(1)
except (KeyboardInterrupt, SystemExit):
    tap.stop()

Supported key names:

  • play_pause
  • next_track
  • prev_track
  • mute
  • volume_down
  • volume_up
  • backlight_down
  • backlight_up
  • kb_backlight_down
  • kb_backlight_up
 
File Type Py Version Uploaded on Size
osxmmkeys-0.0.4.tar.gz (md5) Source 2015-02-23 3KB
  • Downloads (All Versions):
  • 12 downloads in the last day
  • 73 downloads in the last week
  • 247 downloads in the last month