Both alt and ctrl are individually used for lots of things, and my current keyboard doesn't have a Windows key. Can I make the xmonad mod key be ctrl-alt instead of just one key? (For example, ctrl-alt-1 should go the first desktop, but ctrl-1 and alt-1 should both be passed along to the current application.)


Yes you can. It is rather simple really. I will jump into an example and then explain it. This example comes directly from an old version of my config file which you can find online here. Now for some code:

, ((altMask .|. controlMask, xK_Left  ), prevWS)
, ((altMask .|. controlMask, xK_Right ), nextWS)

And that is all that there is to it. When I press Alt+Ctrl+Left it executes prevWS (from CycleWS) and when i press Alt+Ctrl+Right it executes nextWS. And that is all there is to it. You will find that in the myKeys section of my XMonad config and if you need more help just ask me in the comments.

I should note that in the config file:

altMask = mod1Mask

Alt should be one of the mod-? keys.

Oh, and just incase you are new to XMonad, if you don't want to dive into creating a larger config file like mine and want to keep it bare bones for now and just add or modify a few keys then I reccomend using the EZConfig functions as shown in this example main function here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.