how to make xmonad use two mod keys

Solution 1:

You can use xmodmap to add a second key to e.g. Mod1, so that pressing either would work with modMask = mod1Mask.

Solution 2:

You can just or the keys together... watch:

$ ghci
> :m + XMonad
> :t (.|.)
(.|.) :: (Data.Bits.Bits a) => a -> a -> a
> :t mod1Mask
mod1Mask :: KeyMask
> :t mod2Mask
mod2Mask :: KeyMask
> :t mod1Mask .|. mod2Mask
mod1Mask .|. mod2Mask :: KeyMask

So as you can see you OR two key masks together to get the result that you desire. That's all it takes so you just use it like the last line there.

myAwesomeModMask = mod1Mask .|. mod3Mask
-- or whatever you want it to be

And that is all that there is to it.

Edit: Ah wait, you want two different keys to independently act as the Mod key. That is currently impossible I think as the code currently stands. Solution: check out the source and edit it yourself and then cabal install it again; it would be a small change.

Solution 3:

Just to expand on Daniel Schoepe's answer, I do this in xmonad using the super key (the windows key) but I don't set anyting in xmonad.hs (other than setting modMask = mod4Mask). Using xmodmap I've set the left control as a second super key with the following in my .Xmodmap file:

remove Control = Control_L
keysym Control_L = Super_L
add Control = Control_L

You can also use xmodmap to swap capslock and control, set right control to be super as well, etc, but mind that the changes will only work in X, not in virtual terminals.