Skip to content

tmke8/shinran

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

shinran

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.

shin + espanso = shinran

Screencast

Demo

Architecture

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.

Install

Prerequisites

Rust compiler

libxkbcommon headers

E.g., on Ubuntu:

sudo apt install libxkbcommon-dev

Wayland frontend

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_wayland

And then, e.g., for sway, put this in your config:

bindsym $mod+x exec ~/.local/bin/shinran_wayland

IBus frontend

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 install

To start shinran, the following has to be executed:

ibus engine shinran

You have to bind this to a keyboard shortcut. See here for how that works in GNOME.

Implementation status

  • Wayland frontend
  • 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…)

Acknowledgments

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).

About

A privacy-preserving text expander for Linux.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Contributors