X11

如何使用 setxkbmap 的 ‘-config’ 選項?

  • April 9, 2020

我有一個包含以下內容的鍵盤映射文件:

xkb_keymap {
   xkb_keycodes  { include "evdev+aliases(qwerty)" };
   xkb_types     { include "complete+numpad(shift3)"   };
   xkb_compat    { include "complete"  };
   xkb_symbols   { include "macintosh_vndr/apple(alukbd)+macintosh_vndr/us+inet(evdev)+altwin(swap_alt_win)+capslock(backspace)+compose(rctrl)+macintosh_vndr/apple(alupckeys)+shift(both_capslock)"   };
   xkb_geometry  { include "macintosh(applealu_ansi)"  };
};

我以為我可以載入它setxkbmap -config keymap,但我不能。

你應該如何使用’-config’?如何載入 xkb_keymap 部分?

*編輯:*我知道我可以用 載入它xkbcomp keymap :0,但仍然:’-config’ 是如何工作的?

*Edit2:*這就是我得到的輸出:

$ setxkbmap -v 10 -config ~/xkb/keymap 
Setting verbose level to 10
locale is C
Found file /home/user/xkb/keymap
Couldn't find configuration file "/home/user/xkb/keymap"
-config file
      Specifies the name of an XKB configuration
      file which describes the keyboard to be used.

我認為這可以追溯到xf86cfg. 在多個 VT 上啟動X時,每個伺服器的鍵盤配置文件可能具有不同的鍵盤配置:

<Xroot>/lib/X11/xkb/X0-config.keyboard
<Xroot>/lib/X11/xkb/X1-config.keyboard

鍵盤配置文件由key = value對組成,每行一個。這是我相當簡單的測試文件/home/don/my-config.keyboard

Rules    =  "xorg"
Model    =  "pc104"
Layout   =  "fr"
Variant  =  "dvorak"
Options  =  "grp:caps_toggle,grp_led:caps" 

載入它setxkbmap

setxkbmap -config /home/don/my-config.keyboard

這是:

setxkbmap -query

返回:

rules:      xorg
model:      pc104
layout:     fr
variant:    dvorak
options:    grp:caps_toggle,grp_led:caps

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