Xmonadは左右のAltを異なる方法で処理できますか?

Xmonadは左右のAltを異なる方法で処理できますか?

ALT_RENTER+を使用して機能を実行するアプリケーションがあります。 Xmonadでこのアプリケーションを使用すると、Mod1+の組み合わせはENTER「現在のウィンドウをメインウィンドウに置き換える」機能をトリガーします。デフォルトでALT_LおよびALT_RにマップされますMod1

私はXmonadを起動する前に定義の一部ではない.xinitrcキーマップを変更しました。それにもかかわらず、Xmonadは+が入力されたときにウィンドウ交換動作を実行します。 Xmonadはそれがもう含まれていないことを知らないようです。xmodmapALT_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が起動した後の出力です。

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)

シーケンスを記録し、xevそのENTERシーケンスが登録されていないことを確認しました。代わりに、録画後に複数のイベントFocusInFocusOut発生します。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

もう一つの興味深い観察は、各キーイベントがxev押されたか押されたかに関係なく、8として報告されることです。定数は 8 と定義されます。次の順序は+次+です。stateALT_LALT_RMod1Mask/usr/include/X11/X.hALT_LfALT_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

今質問はxmodmaskそうではないと言うと、ALT_Rレポート+がmod1なぜそう見えるのかということです。XALT_Rf

ベストアンサー1

Xmonadは、他の修飾子マスクを使用している場合にのみこれを実行できます。ソースコードには特別なケースがあります。たとえば、次のようになります。

-- modMask lets you specify which modkey you want to use. The default
-- is mod1Mask ("left alt").  You may also consider using mod3Mask
-- ("right alt"), which does not conflict with emacs keybindings. The
-- "windows key" is usually mod4Mask.
--
myModMask       = mod1Mask

おすすめ二つ修飾子マスク(Xには事前定義されたキー修飾子が含まれていないため)alt(またはmeta)キー。これには以下が含まれます移動するロックするコントロール— および指定されていない修飾キー 5 つ。 Xmonadは(ソースコードを読む)ShiftとLockに加えて、これらのキーについて特別なことを知りません。

だから割り当てる必要がありますAlt_LそしてAlt_RXmonadで他の目的に使用するには、修飾子マスクを取り外します。

おすすめ記事