Eu tenho um aplicativo que utiliza ALT_R + ENTER para executar uma função. Ao usar este aplicativo no Xmonad, a combinação Mod1 + ENTER aciona a função "trocar a janela atual com a janela principal". Por padrão, ALT_L e ALT_R são mapeados para Mod1 .
No meu .xinitrc
, antes de iniciar o Xmonad, alterei meu mapa de chaves com xmodmap
, de modo que ALT_R não faz parte da definição Mod1 . Apesar disso, o Xmonad ainda executa o comportamento de troca de janela ao digitar ALT_R + ENTER . Xmonad parece não estar ciente de que Mod1 não inclui mais ALT_R .
Aqui está meu .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
Aqui está a saída de xmodmap
após o Xmonad iniciar.
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)
Eu gravei a sequência com xev
e confirmei que o ENTER nunca está registrado. Em vez disso, vários eventos FocusIn
/ FocusOut
ocorrem depois que o ALT_R é registrado.
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
Outra observação interessante é que xev
reporta o state
de cada evento-chave como 8, independentemente de estar sendo pressionado ALT_L ou ALT_R . A constante Mod1Mask
em /usr/include/X11/X.h
é definida como 8. A seguinte sequência é ALT_L + f seguida por ALT_R + f .
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
Então a questão agora é se xmodmask
diz que ALT_R não é mod1 , porque X
está reportando ALT_R + < kbd> f como se fosse?