[xmonad] list of visible workspaces

Brandon Allbery allbery.b at gmail.com
Thu Aug 2 20:03:06 CEST 2012

On Thu, Aug 2, 2012 at 1:19 PM, Bryan Huh <bhh1988 at gmail.com> wrote:

> What I'm trying to do is prevent my focus from switching to a different
> screen if I mistakenly try to switch to an already visible workspace. I
> already am not using greedyView so I don't have the problem of the visible
> workspaces swapping on me. But suppose I have two screens and workspace 1
> is on the left, workspace 2 is on the right. If I'm focused on the left
> screen, and I were to press mod-2, the focus switches to the screen on the
> right. If I now press mod-3 it will be the right screen which switches to
> workspace 3. This annoys me, because it effectively prevents me from
> cycling through workspaces on one screen. Greedyview I think would not have
> this issue, but the screen swapping confuses me. What I want is, when I'm
> on the left screen and I press mod-2, which is an already visible
> workspace, nothing should happen. No swapping of screens, and no moving of
> focus.

    viewHidden :: WorkspaceId -> X ()
    viewHidden w = do
      ws <- gets windowset
      when (w `notElem` (map W.tag $ W.current ws : W.visible ws)) (W.view

   [((m .|. modm, k), windows $ f i)
>         | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
>         , (f, m) <- [(viewHidden, 0), (W.shift, shiftMask)]

It's not quite as simple as you'd hoped, because of the whole purity thing;
"workspaces conf" doesn't change, but whether a workspace is visible or not
is dynamic and special care needs to be taken with it.

brandon s allbery                                      allbery.b at gmail.com
wandering unix systems administrator (available)     (412) 475-9364 vm/sms
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/xmonad/attachments/20120802/06543b0f/attachment.htm>

More information about the xmonad mailing list