Take the 2-minute tour ×

I'm using the EZConfig module for Xmonad. I would like to bind ModMask s to first move my current focused window to my other screen, then move my focus to my other screen.

Using the CycleWS module this would be achieved by running "shiftNextScreen" followed by "nextScreen"

Can i bind two commands to one key?

Also, i tried going

((modMask, xK_s),
     shiftNextScreen nextScreen)

But that doesnt work because nextScreen becomes an argument to shiftNextScreen, which doesn't make sense. I dont know haskell at all.

share|improve this question

1 Answer 1

Seems that nobody could answer your question until now. Let me take a try:


((modMask, xK_s),
     sequence_ [shiftNextScreen, nextScreen])

should work.


If you look at http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Actions-CycleWS.html,

you see the following types for your functions:

nextScreen :: X ()
shiftNextScreen :: X ()

together with the knowledge that X is a Monad and the type of a keybinding is (ButtonMask,KeySym), X () what you want is:

combine nextScreen and shiftNextScreen to get result of type X ()

if we simply make a list as following:

[nextScreen,shiftNextScreen] we have the type [X ()], close but not yet what we want.

As we know that X is a monad, a quick search on hoogle shows up sequence_

which gives us:

sequence_ [shiftNextScreen, nextScreen]

which yields the type X () and is therefore a valid action for the right side of the key mapping.

share|improve this answer

Your Answer


