[xmonad] Cycle through all visible windows

Alex Su sua at uchicago.edu
Thu Feb 23 21:46:45 UTC 2017


The code compiles fine, just doesn't do what I expect, so no error messages.

>From what I can gather, the W.focus* functions take a StackSet and outputs
another StackSet, which is then passed to the windows function to actually
perform the action. My understanding is that onAllWS is supposed to modify
the StackSet somehow to enable Alt-Tabbing across all windows on visible
screens; beyond that my Haskell is a little too elementary to understand
what is happening.

On Thu, Feb 23, 2017 at 3:34 PM, Peter Jones <mlists at pmade.com> wrote:

> <alexsu04 at gmail.com> writes:
> > 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)
>
> Okay, let's start again.
>
> Why doesn't the code above work?  Does it fail to compile or just fail
> to work the way you expect?  If it fails to compile, what error messages
> are you getting from the compiler?
>
>
> --
> Peter Jones, Founder, Devalot.com
> Defending the honor of good code
>
> _______________________________________________
> xmonad mailing list
> xmonad at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/xmonad/attachments/20170223/a6cefe95/attachment.html>


More information about the xmonad mailing list