
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

* 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

On Mon, 16 Nov 2009 12:55:49 -0500 Adam Vogt
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
AV> You can take the definition of focusLast' from that module (it's not AV> exported, so you can't import it from H.InsertPositition without AV> changing the export list of that module, and then recompiling) AV> and pass it to the function XMonad.StackSet.modify': I'm really, really inexperienced in Haskell so I wasn't able to do this correctly. I'll keep trying.
import qualified XMonad.StackSet as W
AV> ...
-- 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) []
AV> I suppose that the easiest path for adding such functions to StackSet AV> is to collect them somewhere in contrib first (to demonstrate that they AV> actually are common functions). I don't know the process, but would like to voice my support for this function in particular. Switching focus to the last window is very nice and I'm used to it. Right now I have to limit myself to 2 windows per screen so that moving forward can act like focusLast. Thanks Ted

* On Tuesday, December 01 2009, Ted Zlatanov wrote:
I don't know the process, but would like to voice my support for this function in particular. Switching focus to the last window is very nice and I'm used to it. Right now I have to limit myself to 2 windows per screen so that moving forward can act like focusLast.
Thanks Ted
Another option is to bind a key to run this:
focusLast :: X () focusLast = windows $ W.focusUp . W.focusMaster
Which is the same as what your focusLast would be, or the same as pressing "M-m" then "M-k" (though with less synchronizing of state with X). So there is a way to get your behavior without all the trouble I suggested earlier. -- Adam
participants (2)
-
Adam Vogt
-
Ted Zlatanov