重新映射键(包括修饰符)

重新映射键(包括修饰符)

我在 Ubuntu 18.04 上使用替代的德语键盘布局:

~$ setxkbmap de koy

现在我想交换三个键 (Mod3 → f → ß → Mod3),如图所示: 交换三把钥匙

这是这些键的键码:

~$ xmodmap -pke | grep -E 'keycode  (33|48|51)'
keycode  33 = ssharp U1E9E ssharp U1E9E ampersand Greek_finalsmallsigma KP_Add KP_Add jot NoSymbol ampersand Greek_finalsmallsigma KP_Add KP_Add jot
keycode  48 = f F f F at Greek_phi period KP_Decimal Greek_PHI NoSymbol at Greek_phi period KP_Decimal Greek_PHI
keycode  51 = ISO_Level3_Shift NoSymbol ISO_Level3_Shift

Q1:为什么 f 键和 ß 键有 15 列?/usr/share/X11/xkb/symbols/de只定义了8列!

我可以使用这些 xmodmap 命令交换密钥:

~$ xmodmap -e "keycode  51 = ssharp U1E9E ssharp U1E9E ampersand Greek_finalsmallsigma KP_Add KP_Add jot NoSymbol ampersand Greek_finalsmallsigma KP_Add KP_Add jot"
~$ xmodmap -e "keycode  33 = f F f F at Greek_phi period KP_Decimal Greek_PHI NoSymbol at Greek_phi period KP_Decimal Greek_PHI"
~$ xmodmap -e "keycode  48 = ISO_Level3_Shift NoSymbol ISO_Level3_Shift"

现在钥匙已经交换了,但是……

  • ß (ssharp) 键ß在所有级别上返回!预期(与交换前一样):ß ẞ & + ς ∘
  • 键 48(以前的 f 键)除与其他修饰符一起使用时外,其作用与 Mod3 相同:Shift+Mod3+a 应该给出一个,α但现在给出一个A

只是再次检查:

~$ xmodmap -pke | grep -E 'keycode  (33|48|51)'
keycode  33 = f F f F ampersand Greek_phi KP_Add KP_Add Greek_PHI NoSymbol ampersand Greek_phi KP_Add KP_Add Greek_PHI NoSymbol f F ampersand Greek_phi KP_Add KP_Add Greek_PHI NoSymbol f F ampersand Greek_phi KP_Add KP_Add Greek_PHI
keycode  48 = ISO_Level3_Shift NoSymbol ISO_Level3_Shift NoSymbol NoSymbol NoSymbol NoSymbol NoSymbol NoSymbol NoSymbol NoSymbol NoSymbol NoSymbol NoSymbol NoSymbol NoSymbol ISO_Level3_Shift NoSymbol NoSymbol NoSymbol NoSymbol NoSymbol NoSymbol NoSymbol ISO_Level3_Shift
keycode  51 = ssharp NoSymbol ssharp U1E9E at Greek_finalsmallsigma period KP_Decimal

键码 48 和 51 不是我设置的。

Q2:出了什么问题?

在 StackExchange 上的其他一些问题中,人们表示在更改修饰符之前删除或清除修饰符很重要。但这总是失败:

~$ xmodmap -pm
xmodmap:  up to 3 keys per modifier, (keycodes in parentheses):

shift       Shift_L (0x32),  Shift_R (0x3e)
lock        Shift_L (0x32)
control     Control_L (0x25),  Control_R (0x69)
mod1        Alt_L (0x40),  Meta_L (0xcd)
mod2        BadKey (0xcf)
mod3        ISO_Level5_Shift (0xcb)
mod4        Super_L (0x85),  Super_R (0x86),  Super_L (0xce)
mod5        ISO_Level3_Shift (0x5c)

~$ xmodmap -e "remove mod5 = ISO_Level3_Shift"
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  118 (X_SetModifierMapping)
  Value in failed request:  0x17
  Serial number of failed request:  11
  Current serial number in output stream:  11

~$ xmodmap -e "clear mod5"
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  118 (X_SetModifierMapping)
  Value in failed request:  0x17
  Serial number of failed request:  8
  Current serial number in output stream:  8

Q3:这些错误是什么意思?

相关内容