Japanese input in Openbox

It can be a challenge to get Japanese input working in the Openbox window manager on Debian. Personally I forget how to do it after each OS reinstall, so here’s a quick guide:

Add Japanese locale (ja_JP.UTF-8 UTF-8):

sudo dpkg-reconfigure locales

Install ibus and ibus-anthy:

sudo apt update
sudo apt install ibus ibus-anthy -y

Add environment variables and ibus daemon to Openbox startup:

cat >> .config/openbox/autostart.sh
export GTK_IM_MODULE=ibus
export XMODIFIERS=@im=ibus
export QT_IM_MODULE=ibus
ibus-daemon -d -x

Add Japanese with anthy to the ibus settings (“input-method” -> “add”):

ibus-setup

Restart Openbox (log out and back in again)

Switch between input methods using the keyboard shortcut (super/win + spacebar):