日本人向け
日本語のページを別に用意しています。
次のページをご参照ください。
impsbl.hatenablog.jp
Abstract
Although major Linux distribution as Ubuntu provides language input method as Mozc and user can use it out of the box, some distribution as Clear Linux doesn't. Typical solution for such exceptional distribution is to build own binary.
Distrobox will be rational solution to improve this situation. Distrobox gives some leverage to minor distribution with major distribution's container.
Example, exceptional distribution hosts major distribution's container. Installing language input method to container, then Distrobox provides it to the host transparently.
This post introduces how to provide Japanese input capability to Clear Linux with Mozc on Ubuntu container through Distrobox.
Although Clear Linux works as container host in this post, concept of solution here will work commonly for other distribution.
Assumption and Resources
version | |
---|---|
Clear Linux Desktop*1 | 36420 |
Distrobox*2 | 1.3.0 |
Ubuntu container*3 | 22.04 |
Preparation
Update catch-up of Clear Linux
swupd check-update sudo swupd update
Docker installation and configuration
Install Docker and make it runnable without reboot.
sudo swupd bundle-add containers-basic
sudo systemctl enable --now docker
To run Docker without root, add current user to "docker" group and makes it effective immediately.
sudo usermod -aG docker $USER exec su -l $USER
Due to stateless concept *4, Clear Linux doesn't have "/etc/hosts". This command is to supplement it.
sudo touch /etc/hosts
Distrobox
Installation
Install Distrobox following the official guidance*5. In the case of this post,
curl -s https://raw.githubusercontent.com/89luca89/distrobox/main/install | sudo sh
Although the next command is not required this time, don't forget to register its path in the case to install to a custom directory. This is for the case installed to to "~/.local/bin".
PATH=$PATH:~/.local/bin
Ubuntu container
Pull Docker image with Distrobox command. The next command is for
Docker image | Ubuntu 22.04 |
Name of container | ubuntu |
distrobox create --image docker.io/library/ubuntu:22.04 --name ubuntu
Distrobox currently support following distributions*6. User can pick favorite one.
Then, enter the container.
distrobox-enter ubuntu
Mozc on Ubuntu and IBus
Be careful. In this section, run all commands on container, not on host.
At first, catch-up updates.
sudo apt update -y sudo apt upgrade -y
Install mozc packages and related one.
sudo apt install ibus-mozc mozc-data mozc-server mozc-utils-gui -y sudo apt install libcanberra-gtk* -y
IBus configuration from Ubuntu
Then, start IBus configuration on Ubuntu.
ibus-setup
From here, follow step-by-step in GUI as following screenshots show. If the list of ibus-setup doesn't include Mozc, try next command.
ibus restart
ibus-setup
Screenshot: step-by-step on Ubuntu
After adding Mozc, back to desktop on host.
Settings on Clear Linux
Be careful. In this section, do all operation on host, not on container.
Now, Settings of Clear Linux can see Mozc on Ubuntu. Open settings and follow
Settings > Keyboard > Input Sources
Adding Mozc on Host, then taskbar shows input method as screenshots indicate. Japanese input with Mozc on Clear Linux finally works.
Screenshot: Mozc on Clear Linux
Daily use after rebooting
Although both host and container keep configuration of Input Sources above after reboot, it doesn't work on host without Ubuntu container. Run the next command on host just after booting. It would be better to add it at the end of ".profile". In case of Wayland, please refer the post below.
distrobox enter -n ubuntu -- ibus-daemon -drx
Screenshot: Mozc on Clear Linux