[xmonad] Cycle through all visible windows

Linus Arver linusarver at gmail.com
Thu Feb 23 19:49:09 UTC 2017


On Thu, Feb 23, 2017 at 09:19:18AM -0600, alexsu04 at gmail.com wrote:
> 
> Hi all,
> 
> I’ve been trying to get XMonad set up for dual monitor, but have been struggling with finding a way to cycle focus through every window (not workspace) visible on either screen. The behavior would be similar to XMonad.Actions.WindowNavigation (the experimental module), but the cycling wouldn’t be bound to any direction, just cycle through all visible windows in the normal Alt-Tab sequence (left to right, top to bottom).
> 
> I’ve found some code in a previous thread that supposedly manipulates the StackSet, but it didn’t work for me:
> 
> > -- top of config
> > import qualified XMonad.StackSet as W
> 
> > -- somewhere at top level
> > onAllWS f = windows $ \ws at W.StackSet{ W.current = c, W.visible = vs } ->
> >    let screenNext x = W.current . f $ ws { W.current = x }
> >        c':vs' = map screenNext (c:vs)
> >    in ws{ W.current = c', W.visible = vs' }
> 
> ...
> 
> >  -- in keybindings: there are much more W.swap* W.focus* and W.shift* functions to use.
> >  ,((modm, xK_f), onAllWS W.focusDown)
> >  ,((modm, xK_d), onAllWS W.focusUp)
> >  ,((modm, xK_g), onAllWS W.swapMaster)
> 
> 
> Unfortunately, I’m still too terrible at Haskell to fix whatever is wrong with the above code, and haven’t found any other modules that have the functionality I want. Any help would be appreciated!

Have you looked at XMonad.Actions.CycleWS? I use it to cycle through all
workspaces with windows in them. My config is customized beyond the
standard XMonad config so you'd have to adapt it to your needs:
https://github.com/listx/syscfg/blob/master/xmonad/xmonad.hs#L150

Another alternative might be XMonad.Actions.GridSelect as it gives you a
popup of all open windows (not workspaces).

Best,
Linus

> 
> Thanks!
> 
> Alex

> _______________________________________________
> xmonad mailing list
> xmonad at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad



More information about the xmonad mailing list