我有一个德语键盘,并且我经常使用 Alt Gr 进行快捷键。
现在,我最近切换到了较新的 Linux 版本,并且我所有的 Alt Gr 都停止工作了。
显示了绑定(bind)字符,即 Alt Gr + G 的 ŋ
,而不是执行归因于快捷方式的命令。
经过一些研究,我发现了一些长期存在的相关错误单:
- National keyboard layouts support
- AltGr shortcut not working on Ubuntu
- Alt Gr (German keyboard layout) not working for shortcuts
- Cannot type characters that require AltGr
但是那里显示的设置都没有修复快捷方式。那么如何修复它们呢?
xmodmap -pke
和 setxkbmap -print -verbose 10
的输出显示我的旧 Linux(工作快捷方式)和新 Linux 之间没有任何区别。
最佳答案
问题似乎与修饰键有关。
事实证明,xmodmap -pm
显示了两个 Linux 之间的不同配置。
Fedora 22(不工作)显示
shift Shift_L (0x32), Shift_R (0x3e)
lock Caps_Lock (0x42)
control Control_L (0x25), Control_R (0x69)
mod1 Alt_L (0x40), Alt_L (0xcc), Meta_L (0xcd)
mod2 Num_Lock (0x4d)
mod3 Mode_switch (0xcb)
mod4 Super_L (0x85), Super_R (0x86), Super_L (0xce), Hyper_L (0xcf)
mod5 ISO_Level3_Shift (0x5c)
当 Ubuntu(工作)返回时
shift Shift_L (0x32), Shift_R (0x3e)
lock Caps_Lock (0x42)
control Control_L (0x25), Control_R (0x69)
mod1 Alt_L (0x40), Alt_L (0xcc), Meta_L (0xcd)
mod2 Num_Lock (0x4d)
mod3
mod4 Super_L (0x85), Super_R (0x86), Super_L (0xce), Hyper_L (0xcf)
mod5 ISO_Level3_Shift (0x5c), ISO_Level3_Shift (0x6c), Mode_switch (0xcb)
在this Archlinux Wiki article的帮助下,我能够创建以下 ~/.Xmodmap
。
! First we need clear the existing mods
clear mod1
clear mod3
clear mod5
! The Mode_switch needs to be bound to a key, in order to work
! In my layout this wasn't the case, so I needed to manually do this
keycode 203 = Mode_switch NoSymbol Mode_switch
! Finally delcare the correct modifiers
add mod1 = Alt_L Meta_L
add mod5 = ISO_Level3_Shift Mode_switch
这修复了 PyCharm 中的 Alt Gr 快捷方式,现在它们已按预期被识别。
设置
>
键盘映射
>
使用国家布局快捷键
已关闭。
请注意,只要没有绑定(bind)快捷方式,我仍然可以在其他编辑器以及 PyCharm 中编写特殊字符,例如 ŋ
。
关于linux - Intellij (PyCharm) 在 Linux 中不再识别 AltGr 快捷方式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/77723880/