[xmonad] Cycle through all visible windows

alexsu04 at gmail.com alexsu04 at gmail.com
Thu Feb 23 15:19:18 UTC 2017


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!

Thanks!

Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/xmonad/attachments/20170223/efe4819b/attachment.html>


More information about the xmonad mailing list