[xmonad] CycleWS: shiftTo Next EmptyWS >> andThenSomehowFollow

Brandon Allbery allbery.b at gmail.com
Thu Aug 8 17:51:58 CEST 2013


On Thu, Aug 8, 2013 at 11:28 AM, Rhys Ulerich <rhys.ulerich at gmail.com>wrote:

> I'd like to achieve an action like 'shiftTo Next EmptyWS >>
> andThenSomehowFollow'.  The goal is to move the window to the next
> empty workspace and then to follow it there.
>
> My silly attempts with
>     , ((modm .|. shiftMask, xK_Down), followTo Next EmptyWS)
> using
>   followTo d = shiftTo d >> moveTo d
> don't work.  I suspect this is because I'm not properly saving the
> Next EmptyWS result prior to mutating the state.
>

IIRC you can't easily get at the workspace it chooses, and of course after
the window is shifted it's no longer empty.

Better is to do it the other way around:

    import qualified XMonad.StackSet as W

    {- ... -}

    followTo which wsel = withFocused $ \w -> do
      moveTo which wsel
      here <- gets $ tag . workspace . current . windowset
      windows $ W.shift here w

-- 
brandon s allbery kf8nh                               sine nomine associates
allbery.b at gmail.com                                  ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/xmonad/attachments/20130808/3f5d5b3e/attachment.htm>


More information about the xmonad mailing list