Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

1 Answer

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

TL;DR

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

should work.

Why?

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
add comment

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.