我想在Ubuntu 16.04的Macbook Air 2013-mid键盘中以点(Ä
/ ä
)作为A 级键盘绑定键入A ,输出为setxkbmap -query
rules: evdev
model: pc105
layout: us,us
variant: dvorak,
options: ctrl:nocaps
默认情况下,AltGr键盘上没有两个Alt。此命令使您右移组合键(AltGr),但保留您自己的自定义键盘配置,例如以Capslock为CTRL by 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+ e4+ Enter可以给你
ä
。您如何将其映射到一级键绑定Alt- a?
当您看到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不会快速更新。您必须将键盘更改为其他键盘,然后再次返回以进行更改。
一键式绑定方法
我想一个级别的命令AltGr- A为ä
和AltGr- Shift- A为Ä
英语(US-德沃夏克)。我xev -e keyboard
按AltGr
[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
我的键盘布局已经过测试,但是主要的英语(美国-dvorak)
最终解决方案[Sneetsher]
我将英文(dvorak)的点设置为AltGr- a。合并中的变化/usr/share/X11/xkb/symbols/us
; 现在是德语-德沃夏克语,因为它也适用于斯堪的纳维亚语言(从此处开始)
// 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.
虫子
- 将键盘重新加载到xserver的TODO问题https://unix.stackexchange.com/q/290449/16920手动更改并不总是有效。
- 并发症:Xserver不能快速加载那些密钥,即使在重启/注销后的所有情况下也不能加载。
系统:Ubuntu 16.04
Linux内核:
4.4-4.6
键盘模型:pc105
用于两级键绑定方法的键盘布局:具有死
键的US-dvorak国际键盘用于一级键绑定方法的键盘布局:英语(Dvorak) = US-dvorak,也可以英语(经典德沃夏克)
ctrl+shift+u
然后键入e4
,然后按Enter。如果可行,那么您可以尝试进一步获得一个简单的密钥。