Ant*_*son 5 gnome keyboard-layout manjaro setxkbmap
几个月前我安装了 Manjaro 21.x(不记得确切的版本)并选择了 Gnome 风格。像往常一样,我将操作系统设置为具有两种键盘布局(美国和SE),生活很棒。然后,当我意识到 Gnome 不适合我时,生活变得不那么美好了。因此,我只需使用包管理器安装 XFCE 即可切换回旧的 XFCE。现在,每当我启动 Linux(或注销并再次登录)时,我的键盘布局实际上似乎是美国的,因为每次我写\xc3\xa5\xc3\xa4\xc3\xb6它都会变成[\';. 这种情况发生在操作系统的任何地方。
我尝试对其进行故障排除,但实际上什么也没发现。看来操作系统真的相信我使用 SE 布局。例如,XFCE 中的布局切换器显示 SE:
\n\n有趣命令的一些输出(无论我是否遇到问题或解决它,它们都是相同的):
\n\xe2\x9e\x9c cat /etc/vconsole.conf \nKEYMAP=sv-latin1\nFONT=\nFONT_MAP=\n\n\xe2\x9e\x9c localectl status \n System Locale: LANG=en_US.utf8\n LC_TIME=sv_SE.utf8\n LC_COLLATE=C\n VC Keymap: sv-latin1\n X11 Layout: se,us\n X11 Variant: ,\n\n\xe2\x9e\x9c setxkbmap -print -verbose 10 \nSetting verbose level to 10\nlocale is C\nTrying to load rules file ./rules/evdev...\nTrying to load rules file /usr/share/X11/xkb/rules/evdev...\nSuccess.\nApplied rules from evdev:\nrules: evdev\nmodel: pc105\nlayout: se,us\nvariant: ,\noptions: grp:win_space_toggle,terminate:ctrl_alt_bksp\nTrying to build keymap using the following components:\nkeycodes: evdev+aliases(qwerty)\ntypes: complete\ncompat: complete\nsymbols: pc+se+us:2+inet(evdev)+group(win_space_toggle)+terminate(ctrl_alt_bksp)\ngeometry: pc(pc105)\nxkb_keymap {\n xkb_keycodes { include "evdev+aliases(qwerty)" };\n xkb_types { include "complete" };\n xkb_compat { include "complete" };\n xkb_symbols { include "pc+se+us:2+inet(evdev)+group(win_space_toggle)+terminate(ctrl_alt_bksp)" };\n xkb_geometry { include "pc(pc105)" };\n};\n\n\xe2\x9e\x9c cat /etc/X11/xorg.conf.d/00-keyboard.conf\n# Written by systemd-localed(8), read by systemd-localed and Xorg. It\'s\n# probably wise not to edit this file manually. Use localectl(1) to\n# instruct systemd-localed to update it.\nSection "InputClass"\n Identifier "system-keyboard"\n MatchIsKeyboard "on"\n Option "XkbLayout" "se,us"\n Option "XkbVariant" ","\nEndSection\nRun Code Online (Sandbox Code Playgroud)\n系统信息:
\n\xe2\x9e\x9c cat /etc/os-release \nNAME="Manjaro Linux"\nID=manjaro\nID_LIKE=arch\nBUILD_ID=rolling\nPRETTY_NAME="Manjaro Linux"\nANSI_COLOR="32;1;24;144;200"\nHOME_URL="https://manjaro.org/"\nDOCUMENTATION_URL="https://wiki.manjaro.org/"\nSUPPORT_URL="https://manjaro.org/"\nBUG_REPORT_URL="https://bugs.manjaro.org/"\nLOGO=manjarolinux\n\n\xe2\x9e\x9c gnome-shell --version\nGNOME Shell 3.38.4\n\n\xe2\x9e\x9c xfce4-about --version\nxfce4-about 4.16.0 (Xfce 4.16)\nRun Code Online (Sandbox Code Playgroud)\n要解决此问题,我所要做的就是通过单击上面屏幕截图中的 SE 或使用我分配的键盘快捷键来更改布局。完成此操作后,布局切换器仍然显示“SE”,我猜这是预料之中的。另外,\xc3\xa5\xc3\xa4\xc3\xb6现在也成为了大家所期待的\xc3\xa5\xc3\xa4\xc3\xb6。
kleinbottle4的回答帮助我找到了解决方案。
TL;DR:我创建了~/.Xkbmap我想要的布局并将其添加se到其内容中。
在浏览了~/.xinit从他们的答案中建议的文件中读取的文件后,我开始稍微了解了这个结构。但我花了一段时间,在绝望地尝试运行find /etc -type f -exec grep -Hn setxkbmap {} \;并查看结果之后:
/etc/lightdm/Xsession:27: setxkbmap `cat "$file"`
/etc/gdm/Xsession:133: setxkbmap `cat "$sysxkbmap"`
/etc/gdm/Xsession:138: setxkbmap `cat "$userxkbmap"`
/etc/gdm/Xsession:149: setxkbmap -symbols "$xkbsymbols"
/etc/gdm/Init/Default:71:SETXKBMAP=`gdmwhich setxkbmap`
Run Code Online (Sandbox Code Playgroud)
我发现可能应该设置键盘布局,~/.Xkbmap因为查找结果中的两个 Xsession 文件都引用了该文件。
从/etc/gdm/Xsession我们有:
userxkbmap="$HOME/.Xkbmap"
...
# merge in keymaps
if [ -f "$userxkbmap" ]; then
setxkbmap `cat "$userxkbmap"`
XKB_IN_USE=yes
fi
Run Code Online (Sandbox Code Playgroud)
我们有/etc/lightdm/Xsession:
# Load keymaps
for file in "/etc/X11/Xkbmap" "$HOME/.Xkbmap"; do
if [ -f "$file" ]; then
echo "Loading keymap: $file"
setxkbmap `cat "$file"`
XKB_IN_USE=yes
fi
done
Run Code Online (Sandbox Code Playgroud)
现在,当我注销/登录时,我会启用正确的布局。
| 归档时间: |
|
| 查看次数: |
927 次 |
| 最近记录: |