Skip to main content

This is a set of minimal Python bindings for the undocumented macOS framework APIs that even the most modern, sandboxing-friendly shortcut-binding frameworks use under the hood for actually binding global hotkeys.

Unlike something full-featured like MASShortcut, this provides no configuration UI; you have to provide keyboard constants directly.

Simple example:

from quickmachotkey import quickHotKey, mask
from quickmachotkey.constants import kVK_ANSI_X, cmdKey, controlKey, optionKey

@quickHotKey(virtualKey=kVK_ANSI_X, modifierMask=mask(cmdKey, controlKey, optionKey))
def handler() -> None:
    print("handled ⌘⌃⌥X")

if __name__ == "__main__":
    from AppKit import NSApplication  # type:ignore[import]
    from PyObjCTools import AppHelper  # type:ignore[import]
    print("type ⌘⌃⌥X with any application focused")
    NSApplication.sharedApplication()
    AppHelper.runEventLoop()

Metadata

Release files for quickmachotkey 2025.7.28

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for quickmachotkey 2025.7.28
File Size Uploaded
quickmachotkey-2025.7.28.tar.gz 9.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for quickmachotkey 2025.7.28
File Interpreter ABI Platform
quickmachotkey-2025.7.28-py3-none-any.whl Python 3 none any Details

Total release size: 18.9 kB

Release files / quickmachotkey-2025.7.28.tar.gz

Download URL quickmachotkey-2025.7.28.tar.gz
Size 9.0 kB
Tags Source
SHA-256 checksum
How to use checksums
7290908a150ca884f301a0b2490690309cd5857e836e97c7d9f6c9e6f74b8f13
BLAKE2b-256 checksum
How to use checksums
b6f53de969ae98db8f438487d6987587ae3032f5b894f7e28af3114954c9b503
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Release files / quickmachotkey-2025.7.28-py3-none-any.whl

Download URL quickmachotkey-2025.7.28-py3-none-any.whl
Size 9.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bee42c752691add6aec4d6c6a044ef6fe1a6ced7e8b7308992f03d7c0fdc22cc
BLAKE2b-256 checksum
How to use checksums
bfba9e60662622190296b46dda4b676c31a3d19b3c8f930444f9b68e43fa3f8c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

2025.7.28 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page