[xmonad] XMonad.StackSet doesn't have focusLast

Adam Vogt vogt.adam at gmail.com
Mon Nov 16 12:55:49 EST 2009


* On Monday, November 16 2009, Ted Zlatanov wrote:

>Similar to focusDown and focusUp in XMonad.StackSet, is there a way to
>do focusLast?  I am learning Haskell but don't know it well enough to
>write that function yet.
>
>I saw something promising in
>http://xmonad.org/xmonad-docs/xmonad-contrib/src/XMonad-Hooks-InsertPosition.html
>(with a specific note wondering if focusLast should go into StackSet)
>but don't know if it will work.  Any help is most welcome.
>
>Thanks
>Ted

You can take the definition of focusLast' from that module (it's not
exported, so you can't import it from H.InsertPositition without
changing the export list of that module, and then recompiling)
and pass it to the function XMonad.StackSet.modify':

> import qualified XMonad.StackSet as W

...

> -- somewhere in your config
> focusLast :: W.StackSet i l a s sd -> W.StackSet i l a s sd
> focusLast = W.modify' focusLast'

> focusLast' ::  W.Stack a -> W.Stack a
> focusLast' st = let ws = W.integrate st
>     in W.Stack (last ws) (tail $ reverse ws) []

I suppose that the easiest path for adding such functions to StackSet
is to collect them somewhere in contrib first (to demonstrate that they
actually are common functions).

--
Adam


More information about the xmonad mailing list