インプットメソッド——ibus-mozc


ibus-mozc

ibus-mozcはその名前のとおり「ibus」と「mozc」2つのソフトウェアから成ります。

ibusはIntelligent Input Busを意味する名前で、Linux OS向けのインプットフレームワーク(input framework)です。一方mozcはマルチプラットフォームの日本語のインプットメソッドエディタ(Input Method Editor, IME)です。インプットメソッド(input method)は文字を入力するためのソフトウェアのことで、日本語や中国語・韓国語といったキーボードで直接入力できない文字を書くために使われます。ibus-mozcは、ibusフレームワークで開発されたmozcということになります。

インストール

pkgsrc(7)ではinputmethod/ibus-mozcパッケージとして提供されています。ibus-mozcパッケージに依存しているgypパッケージがPython 3.4/3.5/3.6/3.7に対応していないため、マクロPYTHON_VERSION_DEFAULTは27を指定する必要があります。

# cd /usr/pkgsrc/inputmethod/ibus-mozc
# make PYTHON_VERSION_DEFAULT=27 install clean clean-depends

$HOME/.xinitrc

X11起動時にibus-mozcを動かすには$HOME/.xinitrc内のウィンドウマネージャを動かす行の前に以下を加えてください。

export XMODIFIERS="@im=ibus"
export GTK_IM_MODULE="ibus"
export QT_IM_MODULE="ibus"
export DefaultIMModule="ibus"
ibus-daemon -drx

設定

以下の設定をそのまま使うといいでしょう。コピーして使うなり、keymap.txtをダウンロードしてください。ibus-setup(1)を実行し、mozcの設定に移り、キーマップをインポートしてください。設定適用後はCtrl+Spaceで日本語入力を切り替えられます。

status	key	command
Composition	Backspace	Backspace
Composition	Ctrl a	MoveCursorToBeginning
Composition	Ctrl Backspace	Backspace
Composition	Ctrl d	MoveCursorRight
Composition	Ctrl Down	MoveCursorToEnd
Composition	Ctrl e	MoveCursorToBeginning
Composition	Ctrl Enter	Commit
Composition	Ctrl f	MoveCursorToEnd
Composition	Ctrl g	Delete
Composition	Ctrl h	Backspace
Composition	Ctrl i	ConvertToFullKatakana
Composition	Ctrl k	MoveCursorLeft
Composition	Ctrl l	MoveCursorRight
Composition	Ctrl Left	MoveCursorToBeginning
Composition	Ctrl m	Commit
Composition	Ctrl n	MoveCursorToEnd
Composition	Ctrl o	ConvertToHalfWidth
Composition	Ctrl p	ConvertToFullAlphanumeric
Composition	Ctrl Right	MoveCursorToEnd
Composition	Ctrl s	MoveCursorLeft
Composition	Ctrl Shift Space	InsertFullSpace
Composition	Ctrl t	ConvertToHalfAlphanumeric
Composition	Ctrl u	ConvertToHiragana
Composition	Ctrl Up	MoveCursorToBeginning
Composition	Ctrl x	MoveCursorToEnd
Composition	Ctrl z	Cancel
Composition	Delete	Delete
Composition	Down	MoveCursorToEnd
Composition	Eisu	ToggleAlphanumericMode
Composition	End	MoveCursorToEnd
Composition	Enter	Commit
Composition	ESC	Cancel
Composition	F10	ConvertToHalfAlphanumeric
Composition	F2	ConvertWithoutHistory
Composition	F6	ConvertToHiragana
Composition	F7	ConvertToFullKatakana
Composition	F8	ConvertToHalfWidth
Composition	F9	ConvertToFullAlphanumeric
Composition	Hankaku/Zenkaku	IMEOff
Composition	Henkan	Convert
Composition	Hiragana	InputModeHiragana
Composition	Home	MoveCursorToBeginning
Composition	Katakana	InputModeFullKatakana
Composition	Left	MoveCursorLeft
Composition	Muhenkan	SwitchKanaType
Composition	Right	MoveCursorRight
Composition	Shift Backspace	Backspace
Composition	Shift ESC	Cancel
Composition	Shift Left	MoveCursorLeft
Composition	Shift Muhenkan	ConvertToFullAlphanumeric
Composition	Shift Right	MoveCursorRight
Composition	Shift Space	Convert
Composition	Space	Convert
Composition	Tab	PredictAndConvert
Conversion	Backspace	Cancel
Conversion	Ctrl a	SegmentFocusFirst
Conversion	Ctrl Backspace	Cancel
Conversion	Ctrl d	SegmentFocusRight
Conversion	Ctrl Down	CommitOnlyFirstSegment
Conversion	Ctrl e	ConvertPrev
Conversion	Ctrl Enter	Commit
Conversion	Ctrl f	SegmentFocusLast
Conversion	Ctrl g	Cancel
Conversion	Ctrl h	Cancel
Conversion	Ctrl i	ConvertToFullKatakana
Conversion	Ctrl k	SegmentWidthShrink
Conversion	Ctrl l	SegmentWidthExpand
Conversion	Ctrl Left	SegmentFocusFirst
Conversion	Ctrl m	Commit
Conversion	Ctrl n	CommitOnlyFirstSegment
Conversion	Ctrl o	ConvertToHalfWidth
Conversion	Ctrl p	ConvertToFullAlphanumeric
Conversion	Ctrl Right	SegmentFocusLast
Conversion	Ctrl s	SegmentFocusLeft
Conversion	Ctrl Shift Space	InsertFullSpace
Conversion	Ctrl t	ConvertToHalfAlphanumeric
Conversion	Ctrl u	ConvertToHiragana
Conversion	Ctrl Up	ConvertPrev
Conversion	Ctrl x	ConvertNext
Conversion	Ctrl z	Cancel
Conversion	Delete	Cancel
Conversion	Down	ConvertNext
Conversion	Eisu	ToggleAlphanumericMode
Conversion	End	SegmentFocusLast
Conversion	Enter	Commit
Conversion	ESC	Cancel
Conversion	F10	ConvertToHalfAlphanumeric
Conversion	F6	ConvertToHiragana
Conversion	F7	ConvertToFullKatakana
Conversion	F8	ConvertToHalfWidth
Conversion	F9	ConvertToFullAlphanumeric
Conversion	Hankaku/Zenkaku	IMEOff
Conversion	Henkan	ConvertNext
Conversion	Hiragana	InputModeHiragana
Conversion	Home	SegmentFocusFirst
Conversion	Katakana	InputModeFullKatakana
Conversion	Left	SegmentFocusLeft
Conversion	Muhenkan	SwitchKanaType
Conversion	PageDown	ConvertNextPage
Conversion	PageUp	ConvertPrevPage
Conversion	Right	SegmentFocusRight
Conversion	Shift Backspace	Cancel
Conversion	Shift Down	ConvertNextPage
Conversion	Shift ESC	Cancel
Conversion	Shift Henkan	ConvertPrev
Conversion	Shift Left	SegmentWidthShrink
Conversion	Shift Muhenkan	ConvertToFullAlphanumeric
Conversion	Shift Right	SegmentWidthExpand
Conversion	Shift Space	ConvertPrev
Conversion	Shift Tab	ConvertPrev
Conversion	Shift Up	ConvertPrevPage
Conversion	Space	ConvertNext
Conversion	Tab	PredictAndConvert
Conversion	Up	ConvertPrev
DirectInput	Eisu	IMEOn
DirectInput	F13	IMEOn
DirectInput	Hankaku/Zenkaku	IMEOn
DirectInput	Henkan	Reconvert
DirectInput	Hiragana	IMEOn
DirectInput	Katakana	IMEOn
Precomposition	Backspace	Revert
Precomposition	Ctrl Backspace	Undo
Precomposition	Ctrl Shift Space	InsertFullSpace
Precomposition	Eisu	ToggleAlphanumericMode
Precomposition	Hankaku/Zenkaku	IMEOff
Precomposition	Hiragana	InputModeHiragana
Precomposition	Henkan	Reconvert
Precomposition	Katakana	InputModeFullKatakana
Precomposition	Muhenkan	InputModeSwitchKanaType
Precomposition	Shift Muhenkan	ToggleAlphanumericMode
Precomposition	Shift Space	InsertAlternateSpace
Precomposition	Space	InsertSpace
Prediction	Ctrl Delete	DeleteSelectedCandidate
Suggestion	Down	PredictAndConvert
Suggestion	Shift Enter	CommitFirstSuggestion
Composition	Ctrl Space	IMEOff
Conversion	Ctrl Space	IMEOff
DirectInput	Ctrl Space	IMEOn
Precomposition	Ctrl Space	IMEOff
Composition	ASCII	InsertCharacter
Composition	Kanji	IMEOff
Composition	OFF	IMEOff
Composition	ON	IMEOn
Conversion	Kanji	IMEOff
Conversion	OFF	IMEOff
Conversion	ON	IMEOn
DirectInput	Kanji	IMEOn
DirectInput	ON	IMEOn
Precomposition	ASCII	InsertCharacter
Precomposition	Kanji	IMEOff
Precomposition	OFF	IMEOff
Precomposition	ON	IMEOn