松葉 matsuba


matsuba is a lightweight Japanese IME for Linux. It comes with kana input, kanji conversion and completion as well as a utility cli.

matsuba is still very much so a young project so bugs and issues will be present. Please do not hesitate to leave an issue.

Features

Some notable features of matsuba are

  • hiragana/katakana conversion
  • kanji dictionary completion
  • querying and mutate state using cli
  • manually convert kana to kanji using cli
  • modular and extensible popup completion menu
  • written in rust

User Guide

This section is for end users of matsuba. It will cover installation, configuration and usage.

What is an IME?

An input method editor (IME) is a program that let's characters that you normally cannot. matsuba is an IME for Japanese. matsuba has two special keybindings call henkan (conversion mode) and muhenkan (no conversion mode). In henkan mode, all characters that you type will be converted into hiragana, and pressing the complete key will bring up a list of kanji that can be converted into. In muhenkan mode, your keyboard behaves like it originally does. This let's you quickly toggle between the two keyboards.

Installation

Linux Packages

matsuba is packaged for various linux distributions.

Arch Linux

Avaliable on the AUR with either the built version of the last stable release

yay -S matsuba-bin

or latest commit directly from git

yay -S matsuba-git

From Source

Clone the repository:

git clone https://github.com/MrPicklePinosaur/matsuba

Build the source:

cargo build --release

Usage

Starting matsud

matsud is the actual server that handles the heaving lifting. You can start it as a daemon by running

matsud &

Alternatively, you can use your init system to automatically manage matsud for you. For systemd users:

sudo systemctl enable matsuba
sudo systemctl start matsuba

Fetching Dictionary

matsuba first needs to fetch kanji lists from the EDICT/JMICT project for use in kanji completions. You can populate the matsuba database by running

matsucli fetch

You can also fine tune which kanji lists are populated via tags/filters. By default all tags are enabled. A full list can be found here. Just pass in which tags you wish to include (or not include) using the tag flag:

matsucli fetch --tag -baseb,-bot,+grmyth

In the above example, baseball words and botany words are not included, but greek myth words are.

matsucli

matsucli is a utility command line interface to interact with the main matsuba daemon, matsud. matsucli let's you query and modify the state of matsuba, such as enabling and disabling henkan mode, as well as converting kana. This is great for interacting with scripts.

Configuration

mastuba is configured with toml. The default configuration file is installed at /usr/share/matsuba/matsuba_default.toml. You can copy it and create per user changes:

cp /usr/share/matsuba/matsuba_default.toml ~/.config/matsuba/matsuba.toml

Currently the places matsuba looks for configuration files are (in increasing presedence):

  • /usr/share/matsuba/matsuba_default.toml
  • ~/.config/matsuba_.toml

Configuration Options

keypurposedefault value
server.listen_addressport the gRPC server listens on[::1]:10000
keys.henkanswitch to henkan modeC-comma
keys.muhenkanswitch to muhenkan modeC-period
keys.acceptaccept the currently selected conversionReturn
keys.deletedelete one character in conversionBackSpace
keys.cancelcancel the entire conversionEscape
keys.next_conversioncycle to the next conversionTab
keys.prev_conversioncycle to the previous conversionS-Tab
theme.bgdefault background color
theme.fgdefault foreground color
theme.selected_bgbackground color of selected conversion
theme.selected_fgforeground color of selected conversion
theme.completion_bgbackground color of completion
theme.completion_fgforeground color of completion
database.cache_dirfile directory that database files will be stored in$HOME/.config/matsuba

Developer Guide

matsuba encourages the creation of 3rd party completion renderers (the little box that pops up when you start typing).

An in-depth developer guide is coming soon...

Contributors

matsuba was developed by MrPicklePinosaur.