[xmonad] CycleWS: shiftTo Next EmptyWS >> andThenSomehowFollow

Marshall Lochbaum mwlochbaum at gmail.com
Thu Aug 8 18:08:18 CEST 2013


And it requires you to import XMonad.StackSet (for shift and greedyView)
and XMonad.Util.WorkspaceCompare (for getSortByIndex).

Marshall

On Thu, Aug 08, 2013 at 12:03:29PM -0400, Marshall Lochbaum wrote:
> Maybe this will work:
> 
>   followTo :: Direction1D -> WSType -> X ()
>   followTo dir t = doTo dir t getSortByIndex (\w -> (windows (shift w)) >> (windows (greedyView w)))
> 
> It parallels the code for shiftTo and moveTo in Actions/CycleWS.hs.
> 
> Marshall
> 
> On Thu, Aug 08, 2013 at 11:54:28AM -0400, Marshall Lochbaum wrote:
> > None of the following code is tested.
> > 
> > shiftTo and moveTo both take two arguments--a direction (like Next) and
> > a condition (like EmptyWS). So you actually want
> >   followTo d t = (shiftTo d t) >> (moveTo d t)
> > . However, this will shift to the next empty workspace, then move you to
> > the next empty workspace, which is not the workspace you just shifted to
> > since that one is full.
> > 
> > It looks like you want to use findWorkspace, followed by both
> > (windows . shift) and (windows . greedyView). I'll figure out the right
> > implementation (or at least a plausible one) and send it in a second.
> > 
> > Marshall
> > 
> > On Thu, Aug 08, 2013 at 10:28:50AM -0500, Rhys Ulerich wrote:
> > > Hi all,
> > > 
> > > CycleWS's documentation suggests
> > > 
> > > > If you want to follow the moved window, you can use both actions:
> > > >
> > > >    , ((modm .|. shiftMask, xK_Down), shiftToNext >> nextWS)
> > > >    , ((modm .|. shiftMask, xK_Up),   shiftToPrev >> prevWS)
> > > 
> > > 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.
> > > 
> > > I'm a Haskell noob.  Would some kind soul please show me the four
> > > lines I need to implement followTo?
> > > 
> > > Thank you,
> > > Rhys
> > > 
> > > _______________________________________________
> > > xmonad mailing list
> > > xmonad at haskell.org
> > > http://www.haskell.org/mailman/listinfo/xmonad




More information about the xmonad mailing list