答案1
解决方案是使用
github.com/SnakeJesus/Umlaute-on-US-layout
似乎还需要定义 AltGr 键(参见 Gunnar Hjalmarsson 的评论):
包括“level3(ralt_switch)”
答案2
x11/xmodmap 不适用于 Wayland。Wayland 使用 xkb
所以有两种方法
1. 使用 x11/xmodmap
第一:在启动登录时设置 x11 上的 ubuntu
在登录时选择“x11”而不是“wayland”。您可以在登录时单击右下角的按钮来执行此操作。
显示哪种键盘布局:
如果setxkbmap -print -verbose 10
仅显示
...
layout: us
...
.Xmodmap 上的更改没有效果。
设置正确的国际键盘
setxkbmap -layout 'us(intl)'
必将导致
setxkbmap -print -verbose 10
Setting verbose level to 10
locale is C
Trying to load rules file ./rules/evdev...
Trying to load rules file /usr/share/X11/xkb/rules/evdev...
Success.
Applied rules from evdev:
rules: evdev
model: pc105
layout: us(intl)
Trying to build keymap using the following components:
keycodes: evdev+aliases(qwerty)
types: complete
compat: complete
symbols: pc+us(intl)+inet(evdev)
geometry: pc(pc105)
xkb_keymap {
xkb_keycodes { include "evdev+aliases(qwerty)" };
xkb_types { include "complete" };
xkb_compat { include "complete" };
xkb_symbols { include "pc+us(intl)+inet(evdev)" };
xkb_geometry { include "pc(pc105)" };
};
设置 .Xmodmap
例子:
- 使用修改后的 .Xmodmap
! clear lock
keycode 8 =
keycode 9 = Escape NoSymbol Escape
keycode 10 = 1 exclam 1 exclam
keycode 11 = 2 at 2 at
keycode 12 = 3 numbersign 3 numbersign
keycode 13 = 4 dollar 4 dollar
keycode 14 = 5 percent 5 percent
keycode 15 = 6 asciicircum 6 asciicircum
keycode 16 = 7 ampersand 7 ampersand
keycode 17 = 8 asterisk 8 asterisk threequarters dead_ogonek threequarters
keycode 18 = 9 parenleft 9 parenleft
keycode 19 = 0 parenright 0 parenright
keycode 20 = minus underscore minus underscore
keycode 21 = equal plus equal plus
keycode 22 = BackSpace BackSpace BackSpace BackSpace
keycode 23 = Tab ISO_Left_Tab Tab ISO_Left_Tab
keycode 24 = q Q q Q
keycode 25 = w W w W
keycode 26 = e E e E EuroSign
keycode 27 = r R r R registered
keycode 28 = t T t T
keycode 29 = y Y y Y
keycode 30 = u U u U udiaeresis Udiaeresis
keycode 31 = i I i I
keycode 32 = o O o O odiaeresis Odiaeresis
keycode 33 = p P p P
keycode 34 = bracketleft braceleft bracketleft braceleft
keycode 35 = bracketright braceright bracketright braceright
keycode 36 = Return NoSymbol Return
keycode 37 = Control_L NoSymbol Control_L
keycode 38 = a A a A adiaeresis Adiaeresis
keycode 39 = s S s S ssharp section
keycode 40 = d D d D
keycode 41 = f F f F
keycode 42 = g G g G
keycode 43 = h H h H
keycode 44 = j J j J
keycode 45 = k K k K
keycode 46 = l L l L
keycode 47 = semicolon colon semicolon
keycode 48 = apostrophe quotedbl apostrophe quotedbl
keycode 49 = grave asciitilde grave asciitilde
keycode 50 = Shift_L NoSymbol Shift_L
keycode 51 = backslash bar backslash bar
keycode 52 = z Z z Z
keycode 53 = x X x X
keycode 54 = c C c C
keycode 55 = v V v V
keycode 56 = b B b B
keycode 57 = n N n N
keycode 58 = m M m M
keycode 59 = comma less comma less
keycode 60 = period greater period greater
keycode 61 = slash question slash question
keycode 62 = Shift_R NoSymbol Shift_R
keycode 63 = KP_Multiply KP_Multiply KP_Multiply KP_Multiply KP_Multiply KP_Multiply XF86ClearGrab
keycode 64 = Alt_L Meta_L Alt_L Meta_L
keycode 65 = space NoSymbol space
keycode 66 = ISO_Level3_Shift NoSymbol ISO_Level3_Shift
! keycode 66 = Caps_Lock NoSymbol Caps_Lock
keycode 67 = F1 F1 F1 F1 F1 F1 XF86Switch_VT_1
keycode 68 = F2 F2 F2 F2 F2 F2 XF86Switch_VT_2
keycode 69 = F3 F3 F3 F3 F3 F3 XF86Switch_VT_3
keycode 70 = F4 F4 F4 F4 F4 F4 XF86Switch_VT_4
keycode 71 = F5 F5 F5 F5 F5 F5 XF86Switch_VT_5
keycode 72 = F6 F6 F6 F6 F6 F6 XF86Switch_VT_6
keycode 73 = F7 F7 F7 F7 F7 F7 XF86Switch_VT_7
keycode 74 = F8 F8 F8 F8 F8 F8 XF86Switch_VT_8
keycode 75 = F9 F9 F9 F9 F9 F9 XF86Switch_VT_9
keycode 76 = F10 F10 F10 F10 F10 F10 XF86Switch_VT_10
keycode 77 = Num_Lock NoSymbol Num_Lock
keycode 78 = Scroll_Lock NoSymbol Scroll_Lock
keycode 79 = KP_Home KP_7 KP_Home KP_7
keycode 80 = KP_Up KP_8 KP_Up KP_8
keycode 81 = KP_Prior KP_9 KP_Prior KP_9
keycode 82 = KP_Subtract KP_Subtract KP_Subtract KP_Subtract KP_Subtract KP_Subtract XF86Prev_VMode
keycode 83 = KP_Left KP_4 KP_Left KP_4
keycode 84 = KP_Begin KP_5 KP_Begin KP_5
keycode 85 = KP_Right KP_6 KP_Right KP_6
keycode 86 = KP_Add KP_Add KP_Add KP_Add KP_Add KP_Add XF86Next_VMode
keycode 87 = KP_End KP_1 KP_End KP_1
keycode 88 = KP_Down KP_2 KP_Down KP_2
keycode 89 = KP_Next KP_3 KP_Next KP_3
keycode 90 = KP_Insert KP_0 KP_Insert KP_0
keycode 91 = KP_Delete KP_Decimal KP_Delete KP_Decimal
keycode 92 = ISO_Level3_Shift NoSymbol ISO_Level3_Shift
keycode 93 =
keycode 94 = Escape NoSymbol Escape NoSymbol
keycode 95 = F11 F11 F11 F11 F11 F11 XF86Switch_VT_11
keycode 96 = F12 F12 F12 F12 F12 F12 XF86Switch_VT_12
keycode 97 =
keycode 98 = Katakana NoSymbol Katakana
keycode 99 = Hiragana NoSymbol Hiragana
keycode 100 = Henkan_Mode NoSymbol Henkan_Mode
keycode 101 = Hiragana_Katakana NoSymbol Hiragana_Katakana
keycode 102 = Muhenkan NoSymbol Muhenkan
keycode 103 =
keycode 104 = KP_Enter NoSymbol KP_Enter
keycode 105 = Control_R NoSymbol Control_R
keycode 106 = KP_Divide KP_Divide KP_Divide KP_Divide KP_Divide KP_Divide XF86Ungrab
keycode 107 = Print Sys_Req Print Sys_Req
keycode 108 = ISO_Level3_Shift NoSymbol ISO_Level3_Shift
keycode 109 = Linefeed NoSymbol Linefeed
keycode 110 = Home NoSymbol Home
keycode 111 = Up NoSymbol Up
keycode 112 = Prior NoSymbol Prior
keycode 113 = Left NoSymbol Left
keycode 114 = Right NoSymbol Right
keycode 115 = End NoSymbol End
keycode 116 = Down NoSymbol Down
keycode 117 = Next NoSymbol Next
keycode 118 = Insert NoSymbol Insert
keycode 119 = Delete NoSymbol Delete
keycode 120 =
keycode 121 = XF86AudioMute NoSymbol XF86AudioMute
keycode 122 = XF86AudioLowerVolume NoSymbol XF86AudioLowerVolume
keycode 123 = XF86AudioRaiseVolume NoSymbol XF86AudioRaiseVolume
keycode 124 = XF86PowerOff NoSymbol XF86PowerOff
keycode 125 = KP_Equal NoSymbol KP_Equal
keycode 126 = plusminus NoSymbol plusminus
keycode 127 = Pause Break Pause Break
keycode 128 = XF86LaunchA NoSymbol XF86LaunchA
keycode 129 = KP_Decimal KP_Decimal KP_Decimal KP_Decimal
keycode 130 = Hangul NoSymbol Hangul
keycode 131 = Hangul_Hanja NoSymbol Hangul_Hanja
加载 .Xmodmap
xmodmap .Xmodmap
2. 使用 wayland 配置
(我没有亲自测试过)