5
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

WSL2上のGUI(WSLg)で日本語入力を行う際の最低限の設定

Last updated at Posted at 2021-05-02

前提条件

Windows10 Build:21364以降のWSL2でLinuxカーネルのアップデートが完了していること
Windows11でも動作確認済み

設定コマンド

sudo apt update
sudo apt install -y fcitx-bin fcitx-mozc dbus-x11 language-pack-ja 
sudo update-locale LANG=ja_JP.UTF8

cat << EOS | sudo tee /etc/fonts/local.conf
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig><dir>/mnt/c/Windows/Fonts</dir></fontconfig>
EOS

cat << EOS >> ~/.profile
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
export XMODIFIERS=@im=fcitx
export DefaultIMModule=fcitx
fcitx-autostart &> /dev/null
EOS

日本語入力

GUIアプリを立ち上げてctrl+spaceで入力可能となります
image.png

Windowsからの直接起動

Windowsが自動生成するショートカットだとbashは間に挟みませんが、これをやらないと日本語入力が出来ません

wslg.exe ~ -d Ubuntu bash --login -c gedit
5
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?