[xmonad] list of visible workspaces

Brandon Allbery allbery.b at gmail.com
Thu Aug 2 18:53:19 CEST 2012


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

> How do you get a list of visible workspaces (only those workspaces that
> are displayed on the monitors)? Currently I get the entire list of
> workspaces in my xmonad config with (XMonad.workspaces conf). It looks like
> this command returns a list of strings, each of which denote a workspace
> (i.e. ["1", "2"... ] ). But not sure how to get a list of only those which
> are visible (I could also probably work with a list of hidden workspaces).
>

This depends to some extent on how you plan to use it; for example, when
passing that list to an outside program using ppVisible or ppOrder from
XMonad.Hooks.DynamicLog may be more convenient than other mechanisms.

The general case, however, is roughly along the lines of

    visibleWorkspaces :: X [WorkspaceId]
    visibleWorkspaces = do
      ws <- gets windowset
      return $ map W.tag $ W.current ws : W.visible ws

Note that this is impure, so you can't simply drop it in place of
(workspaces conf).  If you give us more detail as to what you're trying to
do, we can help you work it into your configuration properly.

-- 
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/45d94e0c/attachment.htm>


More information about the xmonad mailing list