[xmonad] How to swap screen in a multihead environment?

Brent Yorgey byorgey at seas.upenn.edu
Fri Sep 4 19:30:25 EDT 2009


On Sat, Aug 29, 2009 at 01:48:52PM +0200, Daniel Schoepe wrote:
> On Sat, Aug 29, 2009 at 12:37:27PM +0200, Felix Bou wrote:
> > At his moment, I am using two physical screens and I would like to use
> > a key binding to do the following thing: "swap screens".
> > 
> > By swap screens I mean moving from
> >   -the configuration [1 2] to the configuration [2 1]
> >   -the configuration [1 3] to the configuration [3 1]
> >   -the configuration [4 2] to the configuration [2 4]
> > etc
> > When I say configuration [1 2] I mean that workspace 1 is on left
> > screen and workspace2 in on right screen; and the same idea for [2 1],
> > [1 3], etc
> 
> This should work:
> 
> import Data.Maybe
> 
> ..
> swapScreens = do
>   screen <- gets (listToMaybe . W.visible . windowset)
>   whenJust screen $ windows . W.greedyView . W.tag . W.workspace


Let's not reinvent the wheel now!  There is already a utility to do
exactly this, 'swapNextScreen' from XMonad.Actions.CycleWS.  Just bind
that to a key and off you go.

-Brent


More information about the xmonad mailing list