
Mod1を介しての定義を変更して、xmodmap
を含めないようにしましたALT_R(理由を理解するには、一番下までスクロールしてください)。 修飾子の現在のレイアウトは次のとおりです。ALT_Rの定義に参加していないにもかかわらずmod1、 によって生成された記録では、どちらかの Alt キーが押されたときに がに設定されるxev
ことが示されています( では 8 として定義されています)。KeyEvent.state
mod1Mask
/usr/include/X11/X.h
がそうではないとxmodmask
言っているのに、なぜ+ がそうであるかのように報告するのでしょうか?ALT_Rmod1X
ALT_Rf
xmodmap: up to 4 keys per modifier, (keycodes in parentheses):
shift Shift_L (0x32), Shift_R (0x3e)
lock Caps_Lock (0x42)
control Control_L (0x25), Control_R (0x69)
mod1 Alt_L (0x40), 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), Mode_switch (0xcb)
次のシーケンスは+の後にALT_L+が続きます。fALT_Rf
KeyPress event, serial 32, synthetic NO, window 0x1000001,
root 0xc0, subw 0x0, time 4126632, (85,488), root:(86,489),
state 0x0, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyPress event, serial 32, synthetic NO, window 0x1000001,
root 0xc0, subw 0x0, time 4126850, (85,488), root:(86,489),
state 0x8, keycode 41 (keysym 0x66, f), same_screen YES,
XLookupString gives 1 bytes: (66) "f"
XmbLookupString gives 1 bytes: (66) "f"
XFilterEvent returns: False
KeyRelease event, serial 32, synthetic NO, window 0x1000001,
root 0xc0, subw 0x0, time 4126930, (85,488), root:(86,489),
state 0x8, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 32, synthetic NO, window 0x1000001,
root 0xc0, subw 0x0, time 4126969, (85,488), root:(86,489),
state 0x0, keycode 41 (keysym 0x66, f), same_screen YES,
XLookupString gives 1 bytes: (66) "f"
XFilterEvent returns: False
KeyPress event, serial 32, synthetic NO, window 0x1000001,
root 0xc0, subw 0x0, time 4127907, (85,488), root:(86,489),
state 0x0, keycode 108 (keysym 0xffea, Alt_R), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyPress event, serial 32, synthetic NO, window 0x1000001,
root 0xc0, subw 0x0, time 4128123, (85,488), root:(86,489),
state 0x8, keycode 41 (keysym 0x66, f), same_screen YES,
XLookupString gives 1 bytes: (66) "f"
XmbLookupString gives 1 bytes: (66) "f"
XFilterEvent returns: False
KeyRelease event, serial 32, synthetic NO, window 0x1000001,
root 0xc0, subw 0x0, time 4128164, (85,488), root:(86,489),
state 0x8, keycode 108 (keysym 0xffea, Alt_R), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 32, synthetic NO, window 0x1000001,
root 0xc0, subw 0x0, time 4128203, (85,488), root:(86,489),
state 0x0, keycode 41 (keysym 0x66, f), same_screen YES,
XLookupString gives 1 bytes: (66) "f"
XFilterEvent returns: False
背景:
ALT_R+を使用して機能を実行するアプリケーションがあります。このアプリケーションを Xmonad で使用する場合、 +ENTERの組み合わせにより、「現在のウィンドウをマスター ウィンドウと入れ替える」機能がトリガーされます。デフォルトでは、およびは にマップされます。Mod1ENTERALT_LALT_RMod1
私の では、Xmonad を起動する前に、 が定義の一部にならないように.xinitrc
でキーマップを変更しました。それにもかかわらず、Xmonad は+を入力するとウィンドウのスワッピング動作を実行します。Xmonad はに が含まれなくなったことを認識していないようです。xmodmap
ALT_RMod1ALT_RENTERMod1ALT_R
これが私の.xinitrc
# Java's GUI can't handle some non-reparenting window managers like
# Xmonad without being told how to behave
export _JAVA_AWT_WM_NONREPARENTING=1
# The right Alt key is useful in IntelliJ, tell Xmonad to ignore it
xmodmap ~/.Xmodmap
# Start Xmonad
xmonad
xmodmap
Xmonad 起動後の出力は上記になります。
シーケンスを記録し、 が登録されないxev
ことを確認しました。 代わりに、 が記録された後にいくつかの/イベントが発生します。ENTERFocusIn
FocusOut
ALT_R
KeyPress event, serial 32, synthetic NO, window 0x1200001,
root 0xc0, subw 0x0, time 1432589, (92,374), root:(93,375),
state 0x0, keycode 108 (keysym 0xffea, Alt_R), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
FocusOut event, serial 32, synthetic NO, window 0x1200001,
mode NotifyGrab, detail NotifyAncestor
PropertyNotify event, serial 32, synthetic NO, window 0x1200001,
atom 0x155 (WM_STATE), time 1433760, state PropertyNewValue
FocusOut event, serial 32, synthetic NO, window 0x1200001,
mode NotifyUngrab, detail NotifyPointer
FocusIn event, serial 32, synthetic NO, window 0x1200001,
mode NotifyUngrab, detail NotifyAncestor
KeymapNotify event, serial 32, synthetic NO, window 0x0,
keys: 0 0 0 0 0 0 0 0 0 0 0 0 0 16 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
KeyRelease event, serial 32, synthetic NO, window 0x1200001,
root 0xc0, subw 0x0, time 1434117, (92,374), root:(93,375),
state 0x8, keycode 108 (keysym 0xffea, Alt_R), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
答え1
Alt_R が他の修飾子に割り当てられていない場合は、デフォルトで Mod1Mask に設定されるようです。
Xmodmap で右 alt を単にアンバインドするだけでは、状態 0x8 の報告を停止するのに十分ではなかったため、別の修飾子にバインドする必要がありました (いずれにせよ空だったので Mod3 を選択しました)。その後、xev は状態 0x20 の報告を開始しました。
ただし、これは解決策というよりは回避策です。