Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Xmonad uses

1) Mod+2 for switching to workspace 2
2) Mod+Shift+2 for moving window to workspace 2

How would you remap 1) to Mod+k and 2) to Mod+Shift+k in ~/xmonad/xmonad.hs?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

You can do it, but it's not particularly pleasant (and don't forget that in the default configuration, M-k and MS-k are already used to cycle between windows and move windows around in the stack order - you probably don't want to mask those functions).

What follows is based on a brief look at the source in XMonad/Config.hs. You will need to import XMonad.StackSet:

import qualified XMonad.StackSet as W

and in your keybindings, you want a couple of lines like this:

, ((0 .|. modMask, xK_k), windows $ W.greedyView "2")
, ((shiftMask .|. modMask, xK_k), windows $ W.shift "2")

Note that unless you explicitly remove the bindings for (or rebind) M-2 and MS-2, they'll still behave as before.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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