[xmonad] workspace switching and Xinerama

Brent Yorgey byorgey at seas.upenn.edu
Mon Jan 26 11:32:25 EST 2009

On Mon, Jan 26, 2009 at 11:36:05AM +0100, Karl Hasselström wrote:
> Two questions for those who've been using this nice WM longer than I
> have ...
> 1. I have two monitors, one that's nice and big, and one that's
>    attached to my laptop. How do I swap the workspaces on them? That
>    is, if they currently show workspaces A and B, what action should I
>    bind to a key to make them show B and A?
>    I imagine this is just a matter of transforming StackSet the right
>    way, but I haven't been able to figure out exactly how.

Try the "swapNextScreen" function from CycleWS.

> 2. Currently, I've bound mod-Right/Left and ctrl-mod-Right/Left to
>    switching to the next Xinerama screen and the next visible window
>    in that direction:
>      import qualified XMonad.Actions.CycleWS as CWS
>      import qualified XMonad.Layout.WindowNavigation as WN
>            , ((modMask x,                 xK_Right), CWS.nextScreen)
>            , ((modMask x,                  xK_Left), CWS.prevScreen)
>            , ((modMask x .|. controlMask, xK_Right), sendMessage $ WN.Go WN.R)
>            , ((modMask x .|. controlMask, xK_Left ), sendMessage $ WN.Go WN.L)
>    However, what I'd like to do is have just one binding for these two
>    tasks, so that mod-Right would switch focus to the next window to
>    the right until it reached the edge of the screen, and then the
>    next press would switch focus to the leftmost window on the
>    Xinerama screen to the right of the one where I just was.

Hmm, that's a tricky one. It should be possible in theory, but you
would need to implement something pretty low-level to make it work,
maybe even a brand new layout modifier based on the WindowNavigation
one.  This could make a nice project for someone.  The problem is that
there's no way (currently) for the WindowNavigation layout modifier to
report what it did (whether it actually moved the focus to a different
window or not), so no way to take another action conditioned on that


More information about the xmonad mailing list