Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add delays-characters package #152

Merged
merged 5 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/delays-characters/0.1.0/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ An Espanso trigger that uses the Python `pynput` library to inject text, *instea

See https://pynput.readthedocs.io/en/latest/keyboard.html#controlling-the-keyboard for details of the keywords, and https://pynput.readthedocs.io/en/latest/keyboard.html#pynput.keyboard.Key for the key names.

If necessary, use `python -m pip install pynput` to add pynput to your Python installation.
If necessary, use `python -m pip install pynput` to add pynput to your Python installation. Tested here with Python 3.10 but may work from Python 2.7 or earlier.

Supports keywords "type", "tap", "press", "release", and "sleep".

Expand Down
9 changes: 8 additions & 1 deletion packages/delays-characters/0.1.0/parse_pynput.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@
# Supports type, tap, press, release, and sleep

import argparse, time
from pynput.keyboard import Controller, Key
try:
from pynput.keyboard import Controller, Key
except ImportError:
import sys
print("Error: The 'pynput' library is not installed.", file=sys.stderr)
print("Install it using: pip install pynput", file=sys.stderr)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this!

sys.exit(1) # Exit with a non-zero status code to indicate failure


# Initialize the keyboard controller
keyboard = Controller()
Expand Down
Loading