iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
⌨

Switching Input Methods with Alt-L/Alt-R on Ubuntu 24.04 LTS (US Keyboard)

に公開
2025/07/26

Switching Input with Alt-L/Alt-R

I use a US keyboard on a daily basis. I use "Ei-Kana" on Mac and "alt-ime-ahk" on Windows to switch input methods using Alt-L/Alt-R. To achieve the same on Ubuntu 24.04 LTS, I installed fcitx5-mozc.

https://ei-kana.appspot.com/

https://github.com/karakaram/alt-ime-ahk

https://packages.ubuntu.com/jammy/fcitx5-mozc

Installing fcitx5-mozc

sudo apt install fcitx5-mozc
im-config -n fcitx5

After running the above in the terminal, restart your PC.

Configuring Keybindings

Run fcitx5-configtool from the terminal to change your keyboard settings.

fcitx5-configtool

Running the above command opens a window like the one below.

Fcitx5 Configuration Window

Select the Global Options tab, set the keybindings for Activate Input Method and Inactivate Input Method to Right Alt and Left Alt respectively, and then click the OK button.

Fcitx5 Configuration Window showing the Global Options tab

Now, you can switch input methods by simply pressing the left or right Alt key.

Resolving the Issue Where Pressing the Alt Key in Visual Studio Code Focuses the Menu

By default, pressing the Alt key in Visual Studio Code causes the focus to shift to the menus at the top of the window, such as File, Edit, and Selection. To resolve this, add the following settings to Visual Studio Code's settings.json.

settings.json
{
  "window.titleBarStyle": "custom",
  "window.customMenuBarAltFocus": false
}

Resolving the Issue Where Japanese Inline Input Is Not Possible in Visual Studio Code

After opening the Fcitx5 configuration screen with fcitx5-configtool,

  1. Select the Add-on tab
  2. Click the gear ⚙ icon to the right of X Input Method Frontend
  3. Check "Use On The Spot style for XIM (requires restart)"
    Fcitx5 configuration window: Add-on tab, X Input Method Frontend settings with "Use On The Spot style for XIM (requires restart)" checked
  4. Click the OK button
  5. Click the input menu in the top right of the desktop and click Restart
    Appearance of the Ubuntu input menu

References

https://gihyo.jp/admin/serial/01/ubuntu-recipe/0689

https://stackoverflow.com/a/69899986

https://note.com/junf/n/n7644536ff2a7?magazine_key=m2587441b50a6

Discussion