[xmonad] Cycle through all visible windows

Peter Jones mlists at pmade.com
Thu Feb 23 21:34:13 UTC 2017


<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



More information about the xmonad mailing list