A text expander for Linux.
Normally, a text expander is essentially be a keylogger, because it has to know what you're typing to know that it should be expanding something. But by plugging into the machinery of IMEs, we can implement a text expander that is not a keylogger (or rather, it only logs your keys during the time when it’s absolutely necessary). You start shinran only when you are about to type a trigger word (an idea I got from shin). This has the added benefits that we can show autocompletions.
There are two frontends for shinran: a native Wayland frontend using Input method v2, and an IBus frontend, that’s mostly intended for GNOME (which likely will never support the Wayland-native method).
Shinran uses the Espanso config format for defining text expansions. See “Implementation status” below for information on which Espanso features are currently supported by shinran.
E.g., on Ubuntu:
sudo apt install libxkbcommon-dev
Simply compile the binary and set up a trigger to execute it.
cargo build --bin shinran_wayland --release
cp target/release/shinran_wayland ~/.local/bin/shinran_waylandAnd then, e.g., for sway, put this in your config:
bindsym $mod+x exec ~/.local/bin/shinran_wayland
In order to set up the IBus frontend, the binary needs to be registered with IBus. This is handled by the Makefile:
make
sudo make installTo start shinran, the following has to be executed:
ibus engine shinranYou have to bind this to a keyboard shortcut. See here for how that works in GNOME.
- Wayland frontend
- basic functionality
- popup with candidates
- retrieve application name (for filtering)
- cursor hints
- image matches
- IBus frontend
- basic functionality
- popup with candidates
- basic popup
- candidate selection
- retrieve application name (for filtering)
- cursor hints
- image matches
- Backend
- load Espanso format
- trigger matches
- regex matches
- built-in matches
- basic text insertion of built-in matches
- popup with debug information
- date extension
- random extension
- echo extension
- shell extension
- script extension
- clipboard extension, see #27
- choice extension (can this be done with the candidate popup?)
- form extension (not sure I want to implement that…)
The IBus frontend code started out as a Rust-port of shin (GPLv3).
The Wayland frontend code started out as a Rust-port of anthywl (ISC license) with inspiration from wlhangul (MIT license).
A lot of the backend code started out as a copy of espanso (GPLv3), especially the shinran_config crate and the shinran_render crate (which were copies of espanso-config and espanso-render respectively).