Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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,

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

You must log in to answer this question.

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