From 52bb28824d6a2ee7593fe8286aa828d1e101abae Mon Sep 17 00:00:00 2001 From: Tomas Janousek Date: Thu, 15 Apr 2021 08:48:40 +0100 Subject: [PATCH] X.U.ClickableWorkspaces: Improve getWsIndex doc --- XMonad/Util/ClickableWorkspaces.hs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/XMonad/Util/ClickableWorkspaces.hs b/XMonad/Util/ClickableWorkspaces.hs index 55793b3f..e8b337f4 100644 --- a/XMonad/Util/ClickableWorkspaces.hs +++ b/XMonad/Util/ClickableWorkspaces.hs @@ -56,13 +56,14 @@ import Data.List (elemIndex) clickableWrap :: Int -> String -> String clickableWrap i ws = xmobarAction ("xdotool set_desktop " ++ show i) "1" ws --- Note that 'getWsIndex' from "XMonad.Util.WorkspaceCompare" only works for --- predefined workspaces. When used together with "XMonad.Action.DynamicWorkspaces", --- 'getWsIndex' needs to be rewritten to get the correct index of a workspace. --- The workspace order perceived by @xdotool@ is the same as that by 'getSortByIndex'. --- So 'getSortByIndex' is used in such case. - --- | Return the index of a workspace if it exists. +-- | 'XMonad.Util.WorkspaceCompare.getWsIndex' extended to handle workspaces +-- not the static 'workspaces' config, such as those created by +-- "XMonad.Action.DynamicWorkspaces". +-- +-- Uses 'getSortByIndex', as that's what "XMonad.Hooks.EwmhDesktops" uses to +-- export the information to tools like @xdotool@. (Note that EwmhDesktops can +-- be configured with a custom sort function, and we don't handle that here +-- yet.) getWsIndex :: X (WorkspaceId -> Maybe Int) getWsIndex = do wSort <- getSortByIndex