I often find myself pressing Mod-Tab and then Mod-Enter to switch focus to the next window in the stack and move it to the master window.

Is there possibly a keyboard shortcut that accomplishes this in one keystroke instead of two? Otherwise, what would I need to place in my xmonad.hs to create such a shortcut?

1 Answer 1


Extremely late answer, but perhaps still helpful to somebody:

The functions that you need are: windows $ W.swapMaster . W.focusDown, where: swapMaster and focusDown are imported from XMonad.StackSet:

import qualified XMonad.StackSet as W

A minimal xmonad.hs:

import XMonad
import XMonad.Util.EZConfig
import qualified Data.Map as M
import qualified XMonad.StackSet as W

main = xmonad $ def `additionalKeysP` myKeys

myKeys = [ ("M-a", windows $ W.swapMaster . W.focusDown )]

Here, the keybinding is Mod-a.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .