Lightweight text expander for Wayland. Built as a minimal replacement for espanso that reads espanso-format config files.
Supports the most commonly used espanso match features (simple triggers, variables, shell commands). Advanced features like regex triggers, forms, and app-specific configs are not supported.
- Linux + Wayland
wtype(text injection)wl-paste(clipboard variable support)- Root access for
/dev/input/event*
cargo build --release
sudo cp target/release/text_expander /usr/local/bin/sudo text_expander # foreground
sudo text_expander -d # daemon modeLocation: ~/.config/text_expander/
All .yml and .yaml files are loaded recursively.
matches:
# Simple replacement
- trigger: ":sig"
replace: "Best regards,\nJohn"
# Multiple triggers for one replacement
- triggers: [":hi", ":hello"]
replace: "Hello there!"
# Date variable
- trigger: ":date"
replace: "{{date}}"
vars:
- name: date
type: date
params:
format: "%Y-%m-%d"
# Shell command
- trigger: ":ip"
replace: "{{ip}}"
vars:
- name: ip
type: shell
params:
cmd: "curl -s ifconfig.me"
# Clipboard
- trigger: ":paste"
replace: "{{clip}}"
vars:
- name: clip
type: clipboard| Type | Params | Description |
|---|---|---|
date |
format |
strftime format string |
shell |
cmd |
Shell command output |
clipboard |
- | Current clipboard content (via wl-paste) |
echo |
echo |
Static text |
trigger(single string) andtriggers(array of strings)replacewith{{variable}}interpolationvarswithdate,shell,clipboard, andechotypesglobal_varsfor shared variables across matches- Recursive YAML file loading
These espanso features are intentionally out of scope for this minimal tool:
- Regex triggers, word boundaries, case propagation
- Forms, choice dialogs, cursor hints (
$|$) - Rich text (markdown/HTML), image pasting
- App-specific configs, toggle key, search bar
- Config options (backend, clipboard_threshold, etc.)
random,script,matchvariable types
# Stop espanso
systemctl --user stop espanso
# Copy config
mkdir -p ~/.config/text_expander
cp -r ~/.config/espanso/* ~/.config/text_expander/
# Remove espanso (optional)
rm -rf ~/.config/espansoSimple trigger/replace matches and basic variable types will work as-is. Matches using unsupported features (regex, forms, etc.) will be silently skipped.
- Reads keyboard input via evdev (prefers virtual keyboards like keyd/kmonad)
- Buffers keystrokes and matches against triggers
- On match: sends backspaces to delete trigger, types replacement via
wtype
/etc/systemd/system/text_expander.service:
[Unit]
Description=Text Expander
After=graphical.target
[Service]
ExecStart=/usr/local/bin/text_expander
Restart=always
Environment=SUDO_USER=yourusername
Environment=SUDO_UID=1000
[Install]
WantedBy=graphical.targetsudo systemctl enable --now text_expander