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.

Source Distribution

osxmmkeys-1.0.1.tar.gz (3.7 kB view details)

Uploaded Source

File details

Details for the file osxmmkeys-1.0.1.tar.gz.

File metadata

  • Download URL: osxmmkeys-1.0.1.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.8.10

File hashes

Hashes for osxmmkeys-1.0.1.tar.gz
Algorithm Hash digest
SHA256 bf2ee690ad85ab6a2c646a464ebcae3ab61bfd1a820021e373b2e98651f9daf5
MD5 b49405bce5c601ebb13620a93c956b59
BLAKE2b-256 a55659d27e33b4164dd8eb09089112b7c692b9351454dfed4b88c00b6c340c42

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page