Xkb

如何在 XKB 配置文件中添加包含行?

  • June 19, 2016

我這樣做只是在英語(Dvorak-US)鍵盤上添加了一個 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

meuh的正確答案:使用雙引號並將它們轉義為

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

引用自:https://unix.stackexchange.com/questions/290738