Skip to main content

Easily handle media keys on OS X.

Project description

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 osxmmkeys

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for osxmmkeys, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size osxmmkeys-1.0.0.tar.gz (3.3 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page