Skip to main content

No project description provided

Project description

yek

Hotkeys for super-humans

Setup

  1. Install uv.
  2. make install (creates .venv and installs deps with uv).

Development

  • make test runs the unittest suite inside the env.
  • Run examples with ./.venv/bin/python examples/open_window.py.

Platform backends:

  • macOS: uses a native listener and will open the Input Monitoring privacy pane so you can grant access.
  • Linux: uses pynput; grant access if your desktop environment prompts.

macOS/Linux may require granting keyboard monitoring/assistive access for global hotkey capture. On macOS, the app will open the Input Monitoring privacy panel to help you approve it.

Avoiding collisions

  • The engine rejects overlapping routes at registration time. If two shortcuts could fire on the same keys (including holds), a ValueError is raised with the colliding matcher details and signatures.
  • Prefer Hold(..., only=True) for modifiers, or add an extra key to disambiguate similar combos.
  • You can override ordering with @app.on(..., priority=10) if you intentionally want a general route to sit behind a specific one.
  • Validate a routes file without running it: python -m yek.shortcuts examples/open_window.py (exits non-zero on collision) or make check-shortcuts FILE=path/to/routes.py.

Feature examples

from yek import App
from yek.keys import Cmd, Shift, Ctrl, Left, Char, String
from yek.matchers import Hold
from yek.time import Wait

app = App()

# Simple chord: Cmd+Shift+O
@app.on(Cmd / Shift / Char("o"))
def open_file(_): ...

# Case-insensitive char: matches "a" or "A"
@app.on(Char("a"))  # default case=False
def any_a(_): ...

# Exact string typed in order (skips non-char keys)
@app.on(String("hello"))
def greet(_): ...

# Hold-only guard (prevents collisions): Ctrl must be the only key held, then Left tap
@app.on(Hold(Ctrl, only=True) / Left)
def ctrl_left_only(_): ...

# Timed press-release: tap Left for between 50–250ms
@app.on(Left @ (0.05, 0.25))
def left_tap(_): ...

# Sequence with timing gaps: Shift then Left within 500ms (0.5s)
@app.on((Shift / Left) @ Wait(0.5))
def nudge_left(_): ...

# Alternation: Cmd+Shift+S or Cmd+Shift+Alt+S
@app.on((Cmd / Shift / Char("s")) | (Cmd / Shift / Char("s") / Char("alt")))
def save(_): ...

# Priority override: force this to run before shorter/same-length routes
@app.on(Cmd / Shift / Char("z"), priority=20)
def undo_special(_): ...

# Held combo that repeats but fires every 200ms at most
@app.on(Hold(Cmd, Shift).throttle(every_ms=200))
def scrub(_): ...

if __name__ == "__main__":
    app()

Notes on uv

  • With a PEP 621 [project] table in pyproject.toml, uv run ... works without extra flags.
  • Prefer make install / make test, or run ad-hoc commands with uv run -- python your_script.py if you want to override the interpreter.

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

yek-0.0.7.tar.gz (22.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yek-0.0.7-py3-none-any.whl (26.6 kB view details)

Uploaded Python 3

File details

Details for the file yek-0.0.7.tar.gz.

File metadata

  • Download URL: yek-0.0.7.tar.gz
  • Upload date:
  • Size: 22.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for yek-0.0.7.tar.gz
Algorithm Hash digest
SHA256 ff638e136e0d00c5eec5465238943df5060b4fdc47aa3b32a4a6dfa3a1e62e97
MD5 690b0beddadaa979b6dcc30e28d0d4b4
BLAKE2b-256 53352dd2537b54d99ab38657abda80a8fe9c3ea24a945c04ae01e6147c7350d5

See more details on using hashes here.

File details

Details for the file yek-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: yek-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 26.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for yek-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 02ae7fd9b43c049cb959f3ee3e01f44f1721f3166a2fd3e193810f5263b1311b
MD5 3e8f3536692e289b35e76a653a1f86a0
BLAKE2b-256 6e90fb14c6404cf2ae95037a8615f5908dac36463b69afb3b683d1971471cce8

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