如何将 include 行添加到 XKB 配置文件?

如何将 include 行添加到 XKB 配置文件?

我这样做只是将 ralt_switch 添加到英语(德沃夏克-美国)键盘

sudo sed -i "249i\    include 'level3(ralt_switch)'" \      
    /usr/share/X11/xkb/symbols/us
sudo dpkg-reconfigure xkb-data

重新启动后,您会在登录时看到一个无法使用的键盘,您无法输入任何内容。您必须按照说明使用 Live USB 修复该文件这里chroot。重启后,文件/usr/share/X11/xkb/symbols/us发生了更多的变化;每个环境现在都include 'level3(ralt_switch)'在其部分的末尾

66,67d65
< 
<     include "level3(ralt_switch)"
130,131d127
< 
<     include "level3(ralt_switch)"
185,186d180
< 
<   include "level3(ralt_switch)"
248d241
<     include 'level3(ralt_switch)'
313,314d305
< 
<     include "level3(ralt_switch)"
359,360d349
< 
<     include "level3(ralt_switch)"
600,601d588
< 
<     include "level3(ralt_switch)"
655,656d641
< 
<     include "level3(ralt_switch)"
720,721d704
< 
<     include "level3(ralt_switch)"
787,788d769
< 
<     include "level3(ralt_switch)"
831,832d811
< 
<    include "level3(ralt_switch)"
851d829
<     include "level3(switch)"
898,899d875
< 
<     include "level3(switch)"
929,930d904
< 
<     include "level3(switch)"
979,980d952
< 
<     include "level3(switch)"
1038,1039d1009
< 
<    include "level3(ralt_switch)"
1102,1103d1071
< 
<    include "level3(ralt_switch)"
1188,1189d1155
< 
<   include "level3(ralt_switch)"
1233,1234d1198
< 
<         include "level3(alt_switch)"
1277,1278d1240
< 
<     include "level3(ralt_switch)"
1318,1319d1279
< 
<     include "level3(ralt_switch)"
1365,1366d1324
< 
<     include "level3(ralt_switch)"
1415,1416d1372
< 
<     include "level3(ralt_switch)"

我通过以下方式生成了这些行

sudo sed -i.bak "${pos[1]}i\    include 'level3(ralt_switch)'" /usr/share/X11/xkb/symbols/us

我正在考虑如何在include "level....或许 ...

系统:Ubuntu 16.04 64 位
Linux 内核:4.6
Linux 内核选项:wl
硬件:Macbook Air 2013-mid

答案1

正确答案由: 有双引号并转义它们

sudo sed -i.bak  \
    "${pos[1]}i\ include \"level3(ralt_switch)\"" /usr/share/X11/xkb/symbols/us

相关内容