如何在 Ubuntu 16.04 的 Dvorak 中输入带点的 A?

如何在 Ubuntu 16.04 的 Dvorak 中输入带点的 A?

我想在 Macbook Air 2013-mid 的 Ubuntu 16.04 键盘上输入带点 ( Ä/ ä) 的 A 作为一级键绑定,输出setxkbmap -query

rules:      evdev
model:      pc105
layout:     us,us
variant:    dvorak,
options:    ctrl:nocaps

AltGr默认情况下,键盘上没有,只有两个 Alt。此命令将右 Alt 设为撰写键 ( AltGr),但保留您自己的自定义键盘配置等,将 Capslock 设为 CTRL caps:ctrl_modifier,请参阅这里

gsettings set org.gnome.desktop.input-sources xkb-options \
    "$(gsettings get org.gnome.desktop.input-sources xkb-options \ 
    | sed "s/]/, 'compose:ralt']/")"

如果要改变这一点,那么如果有独立的解决方案那就太好了,xmodmap因为它将会贬值。

两级键绑定方法

我们只能使用带有死键的 Dvorak International 进行两级键绑定方法。

  • SeverusTux 的答案是两级命令为AltGr- Shift- Q+ A,它仅在 中有效us-drovak, international with deadkeys
  • SeverusTux。Ctrl++++++Shift可以工作并为您提供u。您如何将其映射到单级键绑定- ?e4EnteräAlta

我确实看到 GUI 在其他地方进行了更改。我真的想知道在哪里

masi@masi:~$ cat /usr/share/X11/locale/en_US.UTF-8/Compose > /home/masi/Desktop/test1
% I make here a change in the GUI as proposed by Severus: compose key = right Alt
masi@masi:~$ cat /usr/share/X11/locale/en_US.UTF-8/Compose > /home/masi/Desktop/test2
masi@masi:~$ diff /home/masi/Desktop/test1 /home/masi/Desktop/test2
[ no output ]

这表明 xserver 更新速度不快。您必须将键盘换成其他键盘,然后再换回来,才能进行更改。

单层按键绑定方法

我想要英语(US-dvorak)中的一级命令AltGr- AforäAltGr- Shift- Afor 。我按了 ,然后按Äxev -e keyboardAltGr

[ignore the beginning; press AltGr]
KeyPress event, serial 28, synthetic NO, window 0x4400001, 
root 0xd6, subw 0x0, time 13661220, (186,522), root:(186,574), 
state 0x0, keycode 108 (keysym 0xffea, Alt_R), same_screen YES, 
XLookupString gives 0 bytes: 
XmbLookupString gives 0 bytes: 
XFilterEvent returns: False 

KeyRelease event, serial 28, synthetic NO, window 0x4400001, 
root 0xd6, subw 0x0, time 13661284, (186,522), root:(186,574), 
state 0x8, keycode 108 (keysym 0xffea, Alt_R), same_screen YES, 
XLookupString gives 0 bytes: 
XFilterEvent returns: False

你可以通过获得所有可能的开关more /usr/share/X11/xkb/rules/xorg.lst | grep lv3,但我们只感兴趣lv3:ralt_switch

  lv3:switch           Right Ctrl
  lv3:menu_switch      Menu
  lv3:win_switch       Any Win key
  lv3:lwin_switch      Left Win
  lv3:rwin_switch      Right Win
  lv3:alt_switch       Any Alt key
  lv3:lalt_switch      Left Alt
  lv3:ralt_switch      Right Alt
  lv3:ralt_switch_multikey Right Alt, Shift+Right Alt key is Compose
  lv3:ralt_alt         Right Alt key never chooses 3rd level
  lv3:enter_switch     Enter on keypad
  lv3:caps_switch      Caps Lock
  lv3:bksl_switch      Backslash
  lv3:lsgt_switch      <Less/Greater>
  lv3:caps_switch_latch Caps Lock chooses 3rd level, acts as onetime lock when pressed together with another 3rd-level-chooser
  lv3:bksl_switch_latch Backslash chooses 3rd level, acts as onetime lock when pressed together with another 3rd-level-chooser
  lv3:lsgt_switch_latch <Less/Greater> chooses 3rd level, acts as onetime lock when pressed together with another 3rd-level-chooser

我的键盘布局经过测试但主要为英语(US-dvorak)

在此处输入图片描述

最终解决方案[Sneetsher]

我将英语(德沃夏克语)中的 A 设置为AltGr- a。将更改合并到/usr/share/X11/xkb/symbols/us; 现在德语-Dvorak 中,因为它也适用于斯堪的纳维亚语言(来自这里

// based on a keyboard map from an 'xkb/symbols/dk' file
// Added A with dots and O with dots for AltGr-A and AltGr-O, respectively. Sneether and Masi, 17-June-2016.

partial alphanumeric_keys
xkb_symbols "dvorak" {

    name[Group1]= "English (Dvorak)";

    key <TLDE> { [       grave, asciitilde, dead_grave, dead_tilde      ] };

    key <AE01> { [          1,  exclam          ]       };
    key <AE02> { [          2,  at              ]       };
    key <AE03> { [          3,  numbersign      ]       };
    key <AE04> { [          4,  dollar          ]       };
    key <AE05> { [          5,  percent         ]       };
    key <AE06> { [          6,  asciicircum, dead_circumflex, dead_circumflex ] };
    key <AE07> { [          7,  ampersand       ]       };
    key <AE08> { [          8,  asterisk        ]       };
    key <AE09> { [          9,  parenleft,  dead_grave] };
    key <AE10> { [          0,  parenright      ]       };
    key <AE11> { [ bracketleft, braceleft       ]       };
    key <AE12> { [ bracketright, braceright,  dead_tilde] };

    key <AD01> { [  apostrophe, quotedbl, dead_acute, dead_diaeresis    ] };
    key <AD02> { [      comma,  less,   dead_cedilla, dead_caron        ] };
    key <AD03> { [      period, greater, dead_abovedot, periodcentered  ] };
    key <AD04> { [          p,  P               ]       };
    key <AD05> { [          y,  Y               ]       };
    key <AD06> { [          f,  F               ]       };
    key <AD07> { [          g,  G               ]       };
    key <AD08> { [          c,  C               ]       };
    key <AD09> { [          r,  R               ]       };
    key <AD10> { [          l,  L               ]       };
    key <AD11> { [      slash,  question        ]       };
    key <AD12> { [      equal,  plus            ]       };

    key <AC01> {[ a,          A,    adiaeresis,       Adiaeresis ]      };
    key <AC02> {[ o,          O,    odiaeresis,       Odiaeresis ]      };
    key <AC03> { [ e, E, ediaeresis, Ediaeresis ] };
    key <AC04> { [ u, U, udiaeresis, Udiaeresis ] };
    key <AC05> { [          i,  I               ]       };
    key <AC06> { [          d,  D               ]       };
    key <AC07> { [          h,  H               ]       };
    key <AC08> { [          t,  T               ]       };
    key <AC09> { [          n,  N               ]       };
    key <AC10> { [ s, S, ssharp ] };
    key <AC11> { [      minus,  underscore      ]       };

    key <AB01> { [   semicolon, colon, dead_ogonek, dead_doubleacute ] };
    key <AB02> { [          q,  Q               ]       };
    key <AB03> { [          j,  J               ]       };
    key <AB04> { [          k,  K               ]       };
    key <AB05> { [          x,  X               ]       };
    key <AB06> { [          b,  B               ]       };
    key <AB07> { [          m,  M               ]       };
    key <AB08> { [          w,  W               ]       };
    key <AB09> { [          v,  V               ]       };
    key <AB10> { [          z,  Z               ]       };

    key <BKSL> { [  backslash,  bar             ]       };

    include "level3(ralt_switch)"
};

或者使用仍有缺陷的脚本

# restore your current keyboard settings 
sudo apt-get install --reinstall xkb-data
gsettings set org.gnome.desktop.input-sources xkb-options "['compose:ralt', 'caps:ctrl_modifier']"

sudo sed -i.bak 's/[[ \t]*a,[ \t]*A[ \t]*]/[ a,          A,    adiaeresis,       Adiaeresis ]/g;' /usr/share/X11/xkb/symbols/us; 
sudo sed -i.bak 's/[[ \t]*o,[ \t]*O[ \t]*]/[ o,          O,    odiaeresis,       Odiaeresis ]/g;' /usr/share/X11/xkb/symbols/us; 
# German-Dvorak feels better
#sudo sed -i.bak 's/[[ \t]*e,[ \t]*E[ \t]*]/[ e,          E,    ediaeresis,       Ediaeresis ]/g;' /usr/share/X11/xkb/symbols/us; 
#sudo sed -i.bak 's/[[ \t]*u,[ \t]*U[ \t]*]/[ u,          U,    udiaeresis,       Udiaeresis ]/g;' /usr/share/X11/xkb/symbols/us; 
#sudo sed -i.bak 's/[[ \t]*s,[ \t]*S[ \t]*]/[ s,          S,    ssharp ]/g;' /usr/share/X11/xkb/symbols/us; 

# add     include "level3(ralt_switch)" to the end of the environment
# https://unix.stackexchange.com/a/290407/16920
# https://unix.stackexchange.com/q/290405/16920
pos=( $( sed -n -f - /usr/share/X11/xkb/symbols/us <<END_SED
    /xkb_symbols "dvorak" {/,/^};/{
            /xkb_symbols "dvorak" {/=
            /^};/=
    }
END_SED
) )
sudo sed -i.bak "${pos[1]}i\    include \"level3(ralt_switch)\"" /usr/share/X11/xkb/symbols/us

sudo dpkg-reconfigure xkb-data
# Change your keyboard. Change Back. Should work. But some bug. I cannot get the script works stably. 

漏洞

  1. 将键盘重新加载回 xserver 时遇到的 TODO 问题https://unix.stackexchange.com/q/290449/16920手动更改并不总是有效。
  2. 并发症:Xserver 不能快速加载这些键,甚至在重启/注销后也无法加载。

系统:Ubuntu 16.04
Linux 内核:4.4 - 4.6
键盘型号:pc105
两级键绑定方法的键盘布局:带死键的 US-dvorak 国际化
单级键绑定方法的键盘布局:英语(德沃夏克语)=美式德沃夏克, 但是也英语(经典德沃夏克键盘)

答案1

  • 输入 ä ,unicode 为 U00E4

  • 输入 Ä ,unicode 是 U00C4

如果你想要其他字符的 unicode,你可以从gucharmap

要手动输入,请按ctrl+shift+u然后输入 00e4 并命中Enter,这应该输入ä

但有一个更好的方法撰写键

如果你想设定你的 Right alt 作为使用命令行的组合键:只需执行此操作:

gsettings set org.gnome.desktop.input-sources xkb-options "['compose:ralt']"

如果你想通过 GUI 进行设置:

启用撰写键,方法是:系统设置-->键盘-->打字-->右Alt. (如果您愿意,可以选择其他键)

在此处输入图片描述

就这样 !!

现在转到您最喜欢的文本编辑器并执行以下操作:

新闻发布Right Alt其次是"其次是a.现在你应该看到A

同样可以做到A、按下并释放Right Alt其次是"其次是A

笔记 :您可能需要按Shift+'要得到"

提示:

如果您希望查看所有类似的快捷方式,请查看此文件:/usr/share/X11/locale/en_US.UTF-8/Compose

答案2

英语(Dvorak,带死键的国际化) -dvorak-intl 运行良好!

我可以Ä使用ShiftAltGrq默认设置输入。查看文件/usr/share/X11/xkb/symbols/us,其中的q键声明为

key <AB02> { [ q, Q, adiaeresis, Adiaeresis ] };

level3(ralt_switch)在底部使用Right Alt/AltGr作为第三级移位,以便

  • 第一列qq
  • 第二栏QShiftq
  • 第三列äAltGrq
  • 第四列ÄShiftAltGrq

可视化

X11 XKB 布局级别

  • dvorak-intl仅定义了 4 个级别,我绘制了 XKB 支持的所有 8 个级别,以便您可以获得总体概述。
  • Shift是标准的 2 级换档,AltGr是大多数需要 3 级和 4 级的布局的默认 3 级换档。只有少数布局定义了 5、6、7、8 级,因此 5 级换档键,我RCtrl仅用于解释。
  • 定义键的所有 4 行<AB02>都是等效的。

在英语 (Dvorak)上将ä&设置Ä为 3 级和 4 级键 -布局advorak

在键处加上ö& 。(它没有出现在屏幕截图中,因为它是在屏幕截图之后添加的)Öo

同样dvorak-intl,我们可以对进行相同的设置dvorak

  1. 清除之前的修改

    sudo apt-get install --reinstall xkb-data
    gsettings set org.gnome.desktop.input-sources xkb-options "[]"
    
  2. 检查点

    • 尝试英语(Dvorak,国际版带死键) -dvorak-intl

      AltGrq打印ä。如果它不起作用,那么此设置将存在同样的问题。有些东西阻止右 Alt 用作 3 级移位。

      英语(德沃夏克,带死键的国际版)

    • 验证当前地图dvorak

      英语(德沃夏克语)

    • 验证右 Alt 映射,它应该是Alt_R

      $ xev -e keyboard
      [ignore start things; press AltGr]
      
      KeyPress event, serial 28, synthetic NO, window 0x3400001,
          root 0x281, subw 0x0, time 1855861, (769,284), root:(834,336),
          state 0x10, keycode 108 (keysym 0xffea, Alt_R), same_screen YES,
          XLookupString gives 0 bytes: 
          XmbLookupString gives 0 bytes: 
          XFilterEvent returns: False
      
      KeyRelease event, serial 28, synthetic NO, window 0x3400001,
          root 0x281, subw 0x0, time 1855965, (769,284), root:(834,336),
          state 0x18, keycode 108 (keysym 0xffea, Alt_R), same_screen YES,
          XLookupString gives 0 bytes: 
          XFilterEvent returns: False
      
  3. 修改a地图

    $ sudo vim /usr/share/X11/xkb/symbols/us +224
    
    key <AD11> { [      slash,  question        ]       };
    key <AD12> { [      equal,  plus            ]       };
    
    key <AC01> { [          a,  A, adiaeresis, Adiaeresis ]       };
    key <AC02> { [          o,  O, odiaeresis, Odiaeresis ]       };
    key <AC03> { [          e,  E               ]       };
    
  4. 将右 Alt 设置为 3 级移位

    $ sudo vim /usr/share/X11/xkb/symbols/us +248
    
        key <AB09> { [          v,  V               ]       };
        key <AB10> { [          z,  Z               ]       };
    
        key <BKSL> { [  backslash,  bar             ]       };
    
        include "level3(ralt_switch)"
    };
    
    // Dvorak international with dead keys
    

    有许多键可用作 ISO_Level3_Shift。检查可用选项

    $ more /usr/share/X11/xkb/rules/xorg.lst | grep lv3:
      lv3:switch           Right Ctrl
      lv3:menu_switch      Menu
      lv3:win_switch       Any Win key
      lv3:lwin_switch      Left Win
      lv3:rwin_switch      Right Win
      lv3:alt_switch       Any Alt key
      lv3:lalt_switch      Left Alt
      lv3:ralt_switch      Right Alt
      lv3:ralt_switch_multikey Right Alt, Shift+Right Alt key is Compose
      lv3:ralt_alt         Right Alt key never chooses 3rd level
      lv3:enter_switch     Enter on keypad
      lv3:caps_switch      Caps Lock
      lv3:bksl_switch      Backslash
      lv3:lsgt_switch      &lt;Less/Greater&gt;
      lv3:caps_switch_latch Caps Lock chooses 3rd level, acts as onetime lock when pressed together with another 3rd-level-chooser
      lv3:bksl_switch_latch Backslash chooses 3rd level, acts as onetime lock when pressed together with another 3rd-level-chooser
      lv3:lsgt_switch_latch &lt;Less/Greater&gt; chooses 3rd level, acts as onetime lock when pressed together with another 3rd-level-chooser
    

    例如,如果您喜欢使用 Caps Lock 作为第 3 级移位,则请输入include "level3(caps_switch)"而不是include "level3(ralt_switch)"

  5. 强制重新加载布局

    sudo dpkg-reconfigure xkb-data
    

    更改为另一种布局然后返回。

  6. 检查点

    • 验证当前地图dvorak

      英语(德沃夏克语)

    • 验证右 Alt 映射。它应该是ISO_Level3_Shift

      $ xev -e keyboard
      
      KeyPress event, serial 35, synthetic NO, window 0x3600001,
          root 0x281, subw 0x0, time 4755266, (154,154), root:(219,206),
          state 0x0, keycode 108 (keysym 0xfe03, ISO_Level3_Shift), same_screen YES,
          XKeysymToKeycode returns keycode: 92
          XLookupString gives 0 bytes: 
          XmbLookupString gives 0 bytes: 
          XFilterEvent returns: False
      
      KeyRelease event, serial 35, synthetic NO, window 0x3600001,
          root 0x281, subw 0x0, time 4755435, (154,154), root:(219,206),
          state 0x80, keycode 108 (keysym 0xfe03, ISO_Level3_Shift), same_screen YES,
          XKeysymToKeycode returns keycode: 92
          XLookupString gives 0 bytes: 
          XFilterEvent returns: False
      

现在,它应该可以工作了!


单行命令

cd /; \
echo -e "--- /usr/share/X11/xkb/symbols/us\t2016-01-22 09:38:25.000000000 +0100\n+++ /usr/share/X11/xkb/symbols/us\t2016-06-17 15:43:07.656076074 +0100\n@@ -221,8 +221,8 @@\n     key <AD11> { [\tslash,\tquestion\t]\t};\n     key <AD12> { [\tequal,\tplus\t\t]\t};\n \n-    key <AC01> { [\t    a,\tA \t\t]\t};\n-    key <AC02> { [\t    o,\tO\t\t]\t};\n+    key <AC01> { [\t    a,\tA, adiaeresis, Adiaeresis ]\t};\n+    key <AC02> { [\t    o,\tO, odiaeresis, Odiaeresis ]\t};\n     key <AC03> { [\t    e,\tE\t\t]\t};\n     key <AC04> { [\t    u,\tU\t\t]\t};\n     key <AC05> { [\t    i,\tI\t\t]\t};\n@@ -245,6 +245,8 @@\n     key <AB10> { [\t    z,\tZ\t\t]\t};\n \n     key <BKSL> { [  backslash,  bar             ]       };\n+\n+    include \"level3(ralt_switch)\"\n };\n \n // Dvorak international with dead keys\n" \
| sudo patch -p1; \
sudo dpkg-reconfigure xkb-data; \
cl=$(gsettings get org.gnome.desktop.input-sources current); \
gsettings set org.gnome.desktop.input-sources current 0; \
gsettings set org.gnome.desktop.input-sources current 1; \
gsettings set org.gnome.desktop.input-sources current "$cl"

相关内容