iTranslated by AI
Switching Input Methods with Alt-L/Alt-R on Ubuntu 24.04 LTS (US Keyboard)
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.
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.

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.

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.
{
"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,
- Select the
Add-ontab - Click the gear ⚙ icon to the right of
X Input Method Frontend - Check "Use On The Spot style for XIM (requires restart)"
- Click the
OKbutton - Click the input menu in the top right of the desktop and click
Restart
References
Discussion