
* 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... (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