[xmonad] Behaviour of window stack when closing a window

Adam Vogt vogt.adam at gmail.com
Tue Dec 21 02:02:43 CET 2010


* On Sunday, December 19 2010, Sönke Hahn wrote:

>Adam Vogt wrote:
>
>> This may not be the best way, but if I understand correctly, you can add
>> a keybinding that runs this (instead of just `kill') to get what you're
>> asking for:
>> 
>> killUp :: X ()
>> killUp = do { kill; windows XMonad.StackSet.focusUp }
>
>Yes, that's better than any of my ideas, thanks. This still would behave 
>differently when an active window gets closed by other means (that is, not 
>by the xmonad-keybinding).

Hi Sönke,

To catch those other cases, it might work to keep track of the
previously focused window, the window above and the window below (with a
layout). Ex. (this encodes that 'up' and 'down' exist when 'focus' does)

-- additional state for an 'l', as XMonad.Layout.LayoutModifier slightly
-- simplifies
data FocusNext l a = FocusNext (Maybe (a         -- focus
                                      , Maybe a  -- up
                                      , Maybe a  -- down
                                      ))


Then when you end up with a previous state like:

  FocusNext (Just (x, Just u, Just d))

And x no longer exists (on this workspace), d is focused and u is just above
d, it seems reasonable that the layout can swap the focus to u. 

This is all hand waving so far, so maybe there will be some issues when
somebody actually implements this.

Adam



More information about the xmonad mailing list