The i3 FAQ has migrated to https://github.com/i3/i3/discussions. All content here is read-only.
Ask Your Question
0

set mod key only as left mod key

asked 2013-09-24 02:01:20 +0000

diablo465 gravatar image

hi there, I wish if we can set mod key to left windows key only. it is known that if we put

  set $mod mod4

both of the window key will be working.

but this way inhibit another application using win key. (e.g., windows hotkeys in virtualbox similarly, if we put mod key as alt, it causes trouble using emacs). any solution for this issue?

thanks in advance

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
2

answered 2013-09-25 16:46:50 +0000

Max gravatar image

updated 2013-09-25 16:47:48 +0000

You have to use xmodmap to remap the modifiers. If run without arguments it will show the current modifier mapping:

$ xmodmap 
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),  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)

In my case you might note that mod3 is unused, and Super_R and Super_L are both assigned to mod4. You can now remove the assignment of Super_R to mod4 by

$ xmodmap -e 'remove Mod4 = Super_R'

and then redefine

$ xmodmap -e 'add Mod3 = Super_R'

This will give you

$ xmodmap 
xmodmap:  up to 3 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),  Alt_R (0x6c),  Meta_L (0xcd)
mod2        Num_Lock (0x4d)
mod3        Super_R (0x86)
mod4        Super_L (0x85),  Super_L (0xce),  Hyper_L (0xcf)
mod5        ISO_Level3_Shift (0x5c),  Mode_switch (0xcb)

Then you should be able to use set $mod mod3 in your i3 config to only mean the right super key while preserving the regular function of the left super key for other applications. Of course once you've got it right you might want to add those commands to your ~/.xsession (or create one as outlined in the manpage of i3).

edit flag offensive delete link more

Comments

Thanks, it works like a charm, but I prefer using left super key as i3 mod key and right one as windows logo key (most of my work is done in linux), so i didn't change set $mod mod3.

diablo465 gravatar imagediablo465 ( 2013-09-26 01:52:55 +0000 )edit
0

answered 2013-09-25 16:38:04 +0000

Michael gravatar image

I am not entirely sure how virtualbox treats the keys, but if it does not interpret the X11 keymapping, then just remove the right windows key from Mod4 using xmodmap.

Untested, but xmodmap -e "remove mod4 = Super_R" could work.

edit flag offensive delete link more

Comments

i tried that, but it does not work (both super key are still working as $mod key in i3), even if $xmodmap gives mod4 Super_L (0x85), Super_L (0xce), Hyper_L (0xcf)

diablo465 gravatar imagediablo465 ( 2013-09-26 01:39:48 +0000 )edit

I got it, you have to assign super_R to some where else before making it working. just like $ xmodmap -e "add mod3 = Super_R"

diablo465 gravatar imagediablo465 ( 2013-09-26 01:47:31 +0000 )edit

Question Tools

Stats

Asked: 2013-09-24 02:01:20 +0000

Seen: 3,197 times

Last updated: Sep 25 '13