如何在 xorg 中创建新的键盘布局?

如何在 xorg 中创建新的键盘布局?

我使用波兰布局,但是当我在终端中使用AltGr(在我的情况下是right Alt)+时,它是打印,并且与+ -- 的情况相同。bAltGrgrfæ

我用:

  • Fedora 工作站 37
  • 奥格
  • 脉宽调制
  • 联想A485

我尝试创建没有映射的新æ布局

    $ sudo cp /usr/share/X11/xkb/symbols/pl /usr/share/X11/xkb/symbols/custom_pl
    $ sudo nvim /usr/share/X11/xkb/symbols/custom_pl
    -- Before --
        key <AC04>  { [         f,          F,           ae,           AE ] };
    ...
        key <AB05>  { [         b,          B, rightdoublequotemark, leftdoublequotemark ] };
    -- Before --

    -- After --
            key <AC04>  { [         f,          F,           ,            ] };
        ...
            key <AB05>  { [         b,          B, ,  ] };
    -- After --

添加:custom_pl/usr/share/X11/xkb/rules/xorg.lst

...
  no              Norwegian
  pl              Polish
  custom_pl       Polish (Good to bash shortcuts)
  pt              Portuguese
  ro              Romanian
...

/usr/share/X11/xkb/rules/xorg.xml

    <layout>
      <configItem>
        <name>custom_pl</name>
        <!-- Keyboard indicator for Polish with normal linux shourtcut layouts -->
        <shortDescription>custom_pl</shortDescription>
        <description>Polish</description>
        <countryList>
          <iso3166Id>PL</iso3166Id>
        </countryList>
        <languageList>
          <iso639Id>pol</iso639Id>
        </languageList>
      </configItem>
      <variantList>
        <variant>
          <configItem>
            <name>legacy</name>
            <description>Polish (legacy)</description>
          </configItem>
        </variant>
      </variantList>
    </layout>

添加新布局到xorg.conf.d

 $ sudo nvim /etc/X11/xorg.conf.d/00-keyboard.conf
# Written by systemd-localed(8), read by systemd-localed and Xorg. It's
# probably wise not to edit this file manually. Use localectl(1) to
# instruct systemd-localed to update it.
Section "InputClass"
        Identifier "system-keyboard"
        MatchIsKeyboard "on"
        Option "XkbLayout" "custom_pl, ua"
        Option "XkbModel" "pc105+inet"
        Option "XkbOptions" "grp:alt_shift_toggle"
EndSection

重新启动电脑。我有一个错误:

$ localectl set-keymap custom_pl                                                                       
    Failed to set keymap: Keymap custom_pl is not installed.
$ setxkbmap custom_pl
Error loading new keyboard description

我试过: https://michal.kosmulski.org/computing/articles/custom-keyboard-layouts-xkb.html https://discussion.fedoraproject.org/t/how-to-define-custom-keyboard-mappings-under-fedora-silverblue/77368

没什么,我仍然没有 custom_pl 布局。你能帮我吗?

相关内容