Configs2026年5月5日·1 分钟阅读

Espanso — Cross-Platform Text Expander Written in Rust

Espanso is a privacy-first text expansion tool that detects trigger keywords as you type and replaces them with templates, scripts, or dynamic content—running locally on Linux, macOS, and Windows.

Introduction

Espanso runs as a background service that monitors keyboard input and expands short triggers into longer text, shell command output, or dynamic templates. It is open source, stores config locally in YAML files, and supports variables, forms, regex triggers, and extension scripts.

What Espanso Does

  • Replaces typed trigger strings (e.g., :sig) with predefined expansions
  • Supports dynamic variables: date/time, clipboard content, shell command output
  • Provides form-based input: popup dialogs that fill template placeholders
  • Allows regex-based triggers for pattern matching (e.g., :calc/\d+\+\d+/)
  • Syncs configuration via any file-sync tool since config is plain YAML

Architecture Overview

Espanso v2 is written in Rust with platform-specific input backends: Cocoa on macOS, evdev/X11/Wayland on Linux, and Win32 hooks on Windows. A background daemon captures keystrokes, matches against the trigger database (compiled to a state machine), and injects replacement text via the platform's text input API.

Self-Hosting & Configuration

  • Install from Homebrew, Snap, Winget, or direct download from espanso.org
  • Config directory: ~/.config/espanso/ (Linux/macOS) or %APPDATA%/espanso/ (Windows)
  • Define matches in YAML files under match/ directory (one file per category)
  • Use packages from Espanso Hub for pre-built expansions (emails, emojis, code snippets)
  • Set app-specific matches with filter_exec or filter_title fields

Key Features

  • Written in Rust: fast trigger detection with minimal CPU usage
  • Privacy-first: all processing is local, no telemetry or cloud dependency
  • Dynamic content: embed shell scripts, dates, random values, cursor positioning
  • Form UI: interactive popups for filling in templated text
  • Package ecosystem (Espanso Hub) for sharing and reusing match sets

Comparison with Similar Tools

  • TextExpander — commercial, cloud-synced; Espanso is free and local-only
  • Alfred Snippets (macOS) — macOS-only, part of a larger launcher; Espanso is cross-platform and focused
  • AutoHotkey (Windows) — powerful scripting beyond text expansion; Windows-only and more complex
  • aText — lightweight commercial option for macOS/Windows; similar feature set but closed-source
  • Snippety — macOS-only snippet manager; no cross-platform or regex triggers

FAQ

Q: Does Espanso work in all applications? A: Yes. It operates at the OS input level so it works in any text field including browsers, IDEs, and terminals.

Q: How does it handle sensitive data like passwords? A: Matches are local YAML files. You can encrypt them or exclude sensitive files from sync. Espanso itself does not transmit data.

Q: Can I trigger expansions with a keyboard shortcut instead of typing? A: Yes. Use the search bar feature (Alt+Space by default) to fuzzy-search and insert expansions.

Q: Does it work on Wayland? A: Espanso v2 has experimental Wayland support. Full compatibility depends on compositor support for input injection protocols.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产