I have a Korean keyboard that looks like this:
Hanja (한자), just to the left of space, is so little utilized even when typing in Korean, yet it's in prime real real estate for my left thumb as an i3 window manager mod key. That will free up Alt for use in my code editor.
My question is: How can I turn the Hanja key into a modifier key?
I verified the key with xev
:
KeyPress event, serial 32, synthetic NO, window 0x2200001,
root 0x281, subw 0x0, time 11955968, (-132,626), root:(491,646),
state 0x0, keycode 131 (keysym 0xff34, Hangul_Hanja), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 32, synthetic NO, window 0x2200001,
root 0x281, subw 0x0, time 11955968, (-132,626), root:(491,646),
state 0x20, keycode 131 (keysym 0xff34, Hangul_Hanja), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
Keycode 131 = 0x83
From the output of xmodmap
, I see that mod3
is available.
shift Shift_L (0x32), Shift_R (0x3e)
lock Caps_Lock (0x42)
control Control_L (0x25), Control_R (0x69)
mod1 Alt_L (0x40), Alt_R (0x6c), 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)
I tried xmodmap -e "add mod3 = Hangul_Hanja"
resulting in the following…
shift Shift_L (0x32), Shift_R (0x3e)
lock Caps_Lock (0x42)
control Control_L (0x25), Control_R (0x69)
mod1 Alt_L (0x40), Alt_R (0x6c), Meta_L (0xcd)
mod2 Num_Lock (0x4d)
mod3 Hangul_Hanja (0x83)
mod4 Super_L (0x85), Super_R (0x86), Super_L (0xce), Hyper_L (0xcf)
mod5 ISO_Level3_Shift (0x5c), Mode_switch (0xcb)
… after adding set $mod Mod3
to my i3 config file and restarting, I ended up with no modifier key whatsoever, i.e. it didn't work.
Also, the Hanja key isn't behaving like the typical modifier key. If I press and hold the key it creates repeated keystrokes, whereas the typical modifier key does not.
I hope there's some keyboard experts in the house that can offer some of their expertise.
Linux Mint 18 (Cinnamon)
i3 Window Manager
Best Answer
X11 modifier handling is a bit peculiar. You can't take any key and declare it to be a modifier: some things have to be consistent between the modifier settings and the keysym settings.
The classic modifiers are
Shift
,Control
,Alt
,Meta
,Hyper
andSuper
(with two keysyms each, e.g.Shift_L
andShift_R
) (plus Caps Lock and Num Lock which behave somewhat differently). Most applications won't work with other keysyms used as modifiers.So to use the Hanja key as a modifier, make it be
Hyper_L
(for example).This makes the key no longer used as the Hanja key at all. There may be a way to keep both functions if you use XKB instead of xmodmap, but I don't know how.