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

Remapping both caps lock and windows key

asked 2015-08-12 02:45:00 +0000

zetanot gravatar image

updated 2015-08-14 04:47:17 +0000

I want to use both my caps lock key and windows key in my i3 config. In particular, I want caps lock to take the place of $mod in the config and I also want to be able to reference the windows key in bindsym. How would I do this?

Currently, my .Xmodmap is

clear Lock 
clear mod4

keycode 66 = Hyper_L
add mod4 = Hyper_L

and my i3 config has a line

set $mod Mod4

With this configuration, my windows key behaves like the mod4 key, but I don't want this. I want to be able to press Windows+a and have it behave differently than Capslock+a.

edit retag flag offensive close merge delete

Comments

Do you want to use the windows key as Modifier or as (the last) key?

Adaephon gravatar imageAdaephon ( 2015-08-12 09:41:34 +0000 )edit

the modifier

zetanot gravatar imagezetanot ( 2015-08-12 17:56:50 +0000 )edit

Could you edit the question to show how you got Caps Lock to work as modifier? It is not something i3 can do by default, so I assume you remapped it (with xmodmap?) to some other key. Then would be the question if you want the Windows key to be the same modifier as Caps Lock or a different one.

Adaephon gravatar imageAdaephon ( 2015-08-13 12:46:12 +0000 )edit

I updated it.

zetanot gravatar imagezetanot ( 2015-08-14 04:47:30 +0000 )edit

2 answers

Sort by ยป oldest newest most voted
0

answered 2015-08-14 08:57:00 +0000

Adaephon gravatar image

updated 2015-08-14 08:59:10 +0000

The issue here is that you are essentially removing the Windows keys from the modifier list with clear mod4. In order to have Caps Lock available as an additional modifier instead as a replacement of the Window keys, you would have to set it to a different modifier. You can use modifiers Mod1 through Mod5 in addition to Control, Shift and Mode_switch with i3.

First check, if any modifiers are unused in the the layout you are using (without applying your .Xmodmap). You can get a list of the modifier settings with xmodmap -pm. For the us layout this returns (on my machine):

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)

As you can see mod3 is currently unused. In order to use it you just have to put the following into your .Xmodmap:

clear lock
keycode 66 = Hyper_R
add mod3 = Hyper_R

Note: In this case I used Hyper_R because Hyper_L was already bound to mod4. And 66 is the key code of Caps Lock. This may be different on your machine.

Now you can use this modifier with your i3 keybindings. If you want to keep using the $mod variable with your configuration just set it to either Mod3 or Mod4 depending on if you want to use Caps Lock or the Windows keys for that. But There is no real need to actually use it (It is mainly convenience to ease up first time setup when choosing between Alt (Mod1) and Windows keys (Mod4).

Using the new Modifier is as simple as:

bindsym Mod3+s exec something
binysym Mod3+Mod4+s exec something_else
edit flag offensive delete link more
0

answered 2015-08-13 17:21:48 +0000

i3convert gravatar image

updated 2015-08-13 17:23:01 +0000

You can run the following commands to make caps lock act like the windows key. (I'm assuming that $mod in your configuration is the windows key, i.e., Mod4.)

xmodmap -e "remove lock = Caps_Lock"
xmodmap -e "keycode 66 = Super_L"
edit flag offensive delete link more

Comments

I can already do that. I've updated my question to clarify.

zetanot gravatar imagezetanot ( 2015-08-14 04:53:21 +0000 )edit

Question Tools

1 follower

Stats

Asked: 2015-08-12 02:45:00 +0000

Seen: 203 times

Last updated: Aug 14