Linux Mint(Cinnamon)下切换已保存键盘布局的快捷键设置方法
Got it, let's walk through how to set up a keyboard shortcut that cycles through your saved keyboard layouts—just like Windows + Space in Windows or GNOME. The steps vary a bit depending on your desktop environment, so I'll cover the most common ones below:
Since you mentioned GNOME's Windows + Space behavior, this is straightforward (and it's likely already set up by default, but let's confirm or adjust it):
- Open Settings (hit the Super key and search for "Settings" to launch it)
- Navigate to Keyboard > Keyboard Shortcuts
- Scroll down to the Typing section, then look for the action labeled Switch to next input source
- If the shortcut isn't already set to Super+Space, click the current shortcut field, then press the Super+Space combination to assign it
- Close the settings window, and you're done—pressing Super+Space will now cycle through all your added keyboard layouts
For KDE users, here's how to replicate the same behavior:
- Open System Settings (find it via your application launcher or right-click the desktop and select "Configure Desktop")
- Go to Input Devices > Keyboard > Shortcuts tab
- In the left-hand pane, select Input Method
- Locate the action Switch to Next Input Method
- Click the field labeled "None" (or the current shortcut), then press Super+Space to assign the combination
- Click "Apply" to save the changes, and test the shortcut to make sure it cycles through your layouts
Xfce requires a small helper tool to get the cycling behavior, but it's easy to set up:
- First, install the
xkb-switchtool (it handles layout cycling):- For Debian/Ubuntu-based distros: run
sudo apt install xkb-switch - For Fedora/RHEL-based distros: run
sudo dnf install xkb-switch
- For Debian/Ubuntu-based distros: run
- Open Settings Manager > Keyboard > Application Shortcuts tab
- Click the Add button
- In the "Command" field, enter
xkb-switch -n(this command triggers switching to the next layout) - Click "OK", then press Super+Space when prompted to assign the shortcut
- Click "OK" again to save, and now your shortcut will cycle through your saved layouts
If you're using a window manager instead of a full desktop environment, you can set this up directly via X11 config:
- First, confirm your keyboard layouts are configured by checking
/etc/X11/xorg.conf.d/00-keyboard.conf(runcat /etc/X11/xorg.conf.d/00-keyboard.confto view it) - Add the following line to your startup script (like
.xinitrcfor X11, or your WM's config file e.g.,~/.config/i3/configfor i3):
Replacesetxkbmap -layout us,es,fr -option grp:win_space_toggleus,es,frwith your actual layout codes (e.g.,us,defor English and German) - This line tells X11 to use the specified layouts and assign Super+Space as the cycle shortcut. You can adjust the shortcut by changing
grp:win_space_toggle—other options includegrp:alt_shift_togglefor Alt+Shift, orgrp:ctrl_shift_togglefor Ctrl+Shift.
内容的提问来源于stack exchange,提问作者user869304

