xmodmap 설정을 지우려면 어떻게합니까?


43

제목이 정확히 무엇을 요구하는지.xmodmap 설정을 지우려면 어떻게합니까?

저는 IBM 모델 M을 가지고 있으며 어떻게 든 xkeycaps가 End 키가 전혀 키가 아니라는 것을 알게되었습니다.xev은 키를 사용할 때 키 누르기를보고하므로 키보드로 이벤트가 생성되고 있음을 알고 있습니다.또한 xkeycaps는 내 화살표 키가 모두 엉뚱하다고 생각하고 스크롤 막대가 깨져서 아래로 스크롤 만합니다. 그래서 스크롤 할 수 없으므로지도에 가까운 IBM 키보드를 찾을 수 없으므로 키를 수정할 수 있습니다.

키보드를 기본 설정으로 재설정하려고하는데 xmodmap 맨 페이지에 "모두 재설정"또는 "모두 지우기"또는 그 특성 (찾을 수있는)이 없습니다.

68

xmodmap has no notion of state, so it has no way to reset state directly. You can simulate it by using xmodmap -pke >.xmodmap.orig before making any changes (although it doesn't save the modifier map, which you would have to save and restore manually) — but it's a bit too late for that.

Modern systems don't generally use xmodmap to configure the keyboard, though. setxkbmap is the modern way to do it; and that does reset bindings when run. So you may be able to use setxkbmap -layout us to reset things to normal. More complete would be to check for the default configuration in /etc/X11/xorg.conf. For example, on my system

jinx:718 Z$ sed -n '/Identifier.*Keyboard/,/EndSection/p' /etc/X11/xorg.conf
        Identifier      "Generic Keyboard"
        Driver  "kbd"
        Option  "XkbModel"      "pc105"
        Option  "XkbLayout"     "us"
        Option  "XkbOptions"    "grp:alt_shift_toggle"
EndSection

The corresponding command is

setxkbmap -model pc105 -layout us -option grp:alt_shift_toggle

If there were an XkbVariant entry in the output, you would pass its value with -variant. One thing to watch out for is that options are handled specially: you can only set one option per -option parameter, and you need to use -option '' to reset parameters first. So to fully reset when there is something like XkbOptions "grp:alt_shift_toggle,grp:ctrls_toggle" you would need

setxkbmap -model pc105 -layout us -option '' -option grp:alt_shift_toggle -option grp:ctrls_toggle

16

setxkbmap -option resets the meta keys to default.


1

Experimenting with xmodmap, I messed up my key settings by using xmodmap -en "keysym BackSpace = Delete". Thought the -n flag would cause no action to be taken because the man xmodmap page stated that

-n      This  option indicates that xmodmap should not change the mappings, but should display what it would
               do, like make(1) does when given this option.

However, the command caused my Delete key to be useless.

After reading the above, I just typed setxkbmap, hoping it would show me the options, whereas in fact it returned immediately with no output, and then my Delete key was miraculously working again!

So it looks as though

setxkbmap

alone will do the job...