How to add Dictionaries to RIME Input Method on Ubuntu/Pop-OS

在RIME输入法中增加词典

1. RIME的配置目录

Ubuntu/PopOS中位于:~/.config/ibus/rime

2. 下载词典文件

使用git clone下载RIME扩充词库: https://github.com/rime-aca/dictionaries
使用rime-install下载zhwiki词典:https://github.com/felixonmars/fcitx5-pinyin-zhwiki

3. 将所有词库文件cp到RIME配置目录中

cp *dict* ~/.config/ibus/rime/

4. 增加一个custom配置文件用以调用词库

在下载的RIME扩充词库目录中,有一个luna_pinyin.custom.yaml,当使用朙月拼音的时候可以直接使用该配置,但是我使用的是朙月拼音简化字方案,因此需要将该配置文件改名为:
luna_pinyin_simp.custom.yaml

在这个配置文件中,可以看到输入法的对应

# 附朙月拼音系列方案與其對應的 id 一覽表:
# 輸入方案  id
# 朙月拼音  luna_pinyin
# 朙月拼音·简化字  luna_pinyin_simp
# 朙月拼音·臺灣正體 luna_pinyin_tw
# 朙月拼音·語句流  luna_pinyin_fluency

4. 通过import_tables来进行多个词典加载

查看luna_pinyin_simp.custom.yaml可以看到它指定了”translator/dictionary”: luna_pinyin.extended为词典方案,再查看luna_pinyin.extended.dict.yaml可以看到这个配置文件里import了其他词典

import_tables:
  - luna_pinyin
  - luna_pinyin.hanyu
  - luna_pinyin.poetry
  - luna_pinyin.cn_en

通过这种方法将所有词典文件都加载到输入法中

5. 修改luna_pinyin.extended.dict.yaml,增加zhwiki词典

import_tables:
  - luna_pinyin
  - luna_pinyin.hanyu
  - luna_pinyin.poetry
  - luna_pinyin.cn_en
  - zhwiki

6. 重新部署RIME输入法

右键点击RIME的图标选择“部署”。

BTW:如果要修改输入法备选字的个数(比如从默认5个修改为7个),需要创建default.custom.yaml,并写入:

# default.custom.yaml
patch:
  "menu/page_size": 7 

参考文档: https://blog.mikelyou.com/2020/07/31/rime-input/

How to move WSL distro in Windows 11 to another drive

Introduction:

In the world of development and system administration, Windows Subsystem for Linux (WSL) has become a valuable tool. It allows users to run a Linux distribution alongside their Windows environment, opening up a world of possibilities for developers and administrators. In this article, we’ll guide you through the process of migrating a WSL instance, using a real-world example, step by step.

Prerequisites:

Before we begin, ensure that you have the following prerequisites in place:

  • Windows 10 or later with WSL installed.
  • An existing WSL instance (in our case, Ubuntu).
  • Sufficient storage space for the migration.

Step 1: Create a Target Directory

To start the migration process, we need a target directory to store the migrated WSL instance. In PowerShell, use the ‘mkdir’ command to create this directory. In our example, we create a directory named ‘D:\WSL\Ubuntu’:

mkdir -p D:\WSL\Ubuntu

Step 2: List All Running WSL Instances

Before we proceed further, let’s list all the running WSL instances. The following command will display a list of all WSL instances, including their state and version:

wsl -l --all -v

Step 3: Export the Source WSL Instance

Now, let’s export the source WSL instance (in our case, ‘Ubuntu’) into a tar file. This step automatically shuts down the WSL instance and restarts it after the export:

wsl --export Ubuntu D:\WSL\Ubuntu.tar

Step 4: Unregister the Source WSL Instance

Once the export is complete, we need to unregister the source WSL instance to avoid conflicts. Use the following command:

wsl --unregister Ubuntu

Step 5: Confirm Unregistration

To confirm that the source WSL instance has been successfully unregistered, run the following command:

wsl -l --all -v

Step 6: Import into the Target Directory

Now it’s time to import the previously exported WSL instance into the target directory. In this step, we specify the target directory and version (in our case, version 2):

wsl --import Ubuntu D:\WSL\Ubuntu D:\WSL\Ubuntu.tar --version 2

Step 7: Verify the Migration

To ensure that the migration was successful, list all WSL instances once again:

wsl -l --all -v

Step 8: Access the Migrated WSL Instance

Now, you can access the migrated WSL instance by using the following command:

wsl -d Ubuntu

Conclusion:

Migrating WSL instances is a powerful way to manage and organize your development environments. By following these steps, you can seamlessly move your WSL instances to different directories or machines, ensuring flexibility and efficiency in your development workflow. Keep in mind that WSL provides a bridge between Windows and Linux, allowing you to enjoy the best of both worlds.

Check the all steps screenshot as below.

# create target directory
PS C:\Users\kamus> mkdir -p D:\WSL\Ubuntu

# List all the wsl running
PS C:\Users\kamus> wsl -l --all -v
  NAME                   STATE           VERSION
* Ubuntu                 Running         2
  docker-desktop         Stopped         2
  docker-desktop-data    Stopped         2
  
# Export source wsl
PS C:\Users\kamus> wsl --export Ubuntu D:\WSL\Ubuntu.tar

# When doing export, wsl will be shutdown automatically and restart after exporting
PS C:\Users\kamus> wsl -l --all -v
  NAME                   STATE           VERSION
* Ubuntu                 Running         2
  docker-desktop         Stopped         2
  docker-desktop-data    Stopped         2
  
# Unregister the source wsl
PS C:\Users\kamus> wsl --unregister Ubuntu
正在注销...

# Check unregister is successful
PS C:\Users\kamus> wsl -l --all -v
  NAME                   STATE           VERSION
* docker-desktop         Stopped         2
  docker-desktop-data    Stopped         2
  
# Import into the target directory
PS C:\Users\kamus> wsl --import Ubuntu D:\WSL\Ubuntu D:\WSL\Ubuntu.tar --version 2

# Check results
PS C:\Users\kamus> wsl -l --all -v
  NAME                   STATE           VERSION
* docker-desktop         Stopped         2
  Ubuntu                 Stopped         2
  docker-desktop-data    Stopped         2
PS C:\Users\kamus> wsl -d Ubuntu
Welcome to Ubuntu 20.04.5 LTS (GNU/Linux 5.10.102.1-microsoft-standard-WSL2 x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Fri Jan  5 14:40:25 JST 2024

  System load:  0.68               Processes:             8
  Usage of /:   2.0% of 250.98GB   Users logged in:       0
  Memory usage: 4%                 IPv4 address for eth0: 172.28.208.11
  Swap usage:   0%


0 updates can be applied immediately.


The list of available updates is more than a week old.
To check for new updates run: sudo apt update


This message is shown once a day. To disable it please create the
/root/.hushlogin file.
root@Kamus-Trident:/mnt/c/Users/kamus# cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.5 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.5 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
root@Kamus-Trident:/mnt/c/Users/kamus#