A package to allow delays, and characters not supported by Espanso, to be injected using the Python pynput library.
delays
characters
keyboard
control
python
Paste this command in a terminal to install the package
espanso install delays-characters
Description
Source
Delays-characters
An Espanso trigger that uses the Python
pynput
library to inject text, instead of Espanso. This enables the addition of pauses (sleep), <Tab> etc, and other key combinations not supported by Espanso. It can include use of Espanso {{variables}}.
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".
The package includes a sample script which demonstrates a delay and the effect of simulating pressing the <Shift> key. For different scripts, copy, and rename, the
package.yml
file into the
espanso/match/
directory. Edit the trigger value and Input list to suit your purpose.
NB. The variable {{Trig}} must match the trigger in length at least, so that
parse_pynput.py
removes the trigger text cleanly.
A possible future enhancement could be the addition of mouse control.
package.yml
# yaml-language-server: $schema=https://raw.githubusercontent.com/espanso/espanso/dev/schemas/match.schema.json# Supports type, tap, press, release, and sleep.# For new scripts this file may be copied to the espanso/match directory and edited.matches:-trigger::delay# Remember to include this value in Trig, below.replace:"{{Output}}"vars:-name:Trigtype:echoparams:echo::delay# This MUST match the trigger text.-name:Inputtype:echoparams:echo:|# Amend the contents below to suit, adding variables etc.typeHello,World!tapentertypePausingforonesecondtapentersleep1typeHowareyou?tapspacepressshifttypeIamabotreleaseshifttapentertypeThetriggerwas"{{Trig}}"tapentertaptabtypeTheEnd.-name:Outputtype:scriptparams:args:-python-'%CONFIG%/match/packages/delays-characters/parse_pynput.py'-'{{Trig}}'-'{{Input}}'