mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-08-06 15:01:53 -07:00
Configs that apply WorkspaceId transformations, such as IndependentScreens (adding/removing a screen-number prefix) and NamedWorkspaces (adding/removing a name suffix), cannot use clickablePP as is, since they need to apply clickableWrap to an appropriately transformed WorkspaceId. Rather than force them to reimpliment clickableWrap, export it. An example use-case, where IndependentScreens has added a screen number prefix to the workspace ids (0_1, 0_2, ...), and we want a status-bar that shows the ids without screen number (1, 2, ...), but also makes them clickable: getClickable :: (WorkspaceId -> WorkspaceId) -> X (WorkspaceId -> String) getClickable f = do wsIndex <- getWsIndex pure $ \ws -> case wsIndex (f ws) of Just idx -> clickableWrap idx ws Nothing -> ws composePP :: PP -> ScreenId -> X PP composePP pp s = do clickable <- getClickable (marshall s) return . marshallPP s $ pp { ppCurrent = ppCurrent pp . clickable, ppVisible = ppVisible pp . clickable, ppHidden = ppHidden pp . clickable, ppHiddenNoWindows = ppHiddenNoWindows pp . clickable, ppUrgent = ppUrgent pp . clickable }