From 67af43c814819f0c836f796b6f1c61cc446143df Mon Sep 17 00:00:00 2001 From: Brent Yorgey Date: Fri, 1 Feb 2008 13:04:30 +0100 Subject: WorkspaceCompare: some refactoring. * Export WorkspaceCompare and WorkspaceSort types. * Extract commonality in sort methods into mkWsSort, which creates a workspace sort from a workspace comparison function. * Rename getSortByTag to getSortByIndex, since it did not actually sort by tag at all; it sorts by index of workspace tags in the user's config. * Create a new getSortByTag function which actually does sort lexicographically by tag. * Enhance documentation. darcs-hash:20080201120430-bd4d7-71310db2b8d4248ddfb77e3fa25dd0f3b98ea00b.gz --- XMonad/Hooks/DynamicLog.hs | 6 +++--- XMonad/Hooks/EwmhDesktops.hs | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'XMonad/Hooks') diff --git a/XMonad/Hooks/DynamicLog.hs b/XMonad/Hooks/DynamicLog.hs index ecc4891..def78e7 100644 --- a/XMonad/Hooks/DynamicLog.hs +++ b/XMonad/Hooks/DynamicLog.hs @@ -268,7 +268,7 @@ defaultPP = PP { ppCurrent = wrap "[" "]" , ppLayout = id , ppOrder = id , ppOutput = putStrLn - , ppSort = getSortByTag + , ppSort = getSortByIndex } -- | Settings to emulate dwm's statusbar, dzen only. @@ -305,10 +305,10 @@ byorgeyPP = defaultPP { ppHiddenNoWindows = showNamedWorkspaces , ppUrgent = dzenColor "red" "yellow" , ppSep = " | " , ppWsSep = "" - , ppTitle = shorten 65 + , ppTitle = shorten 70 , ppOrder = reverse } - where showNamedWorkspaces wsId = if (':' `elem` wsId) + where showNamedWorkspaces wsId = if any (`elem` wsId) ['a'..'z'] then pad wsId else "" diff --git a/XMonad/Hooks/EwmhDesktops.hs b/XMonad/Hooks/EwmhDesktops.hs index 231525d..5a3d030 100644 --- a/XMonad/Hooks/EwmhDesktops.hs +++ b/XMonad/Hooks/EwmhDesktops.hs @@ -38,17 +38,17 @@ import XMonad.Util.WorkspaceCompare -- > return () -- > -- > main = xmonad defaultConfig { logHook = myLogHook } --- +-- -- For more detailed instructions on editing the layoutHook see: -- -- "XMonad.Doc.Extending#The_log_hook_and_external_status_bars" --- | +-- | -- Notifies pagers and window lists, such as those in the gnome-panel -- of the current state of workspaces and windows. ewmhDesktopsLogHook :: X () ewmhDesktopsLogHook = withWindowSet $ \s -> do - sort' <- getSortByTag + sort' <- getSortByIndex let ws = sort' $ W.workspaces s let wins = W.allWindows s @@ -62,7 +62,7 @@ ewmhDesktopsLogHook = withWindowSet $ \s -> do -- Current desktop let curr = fromJust $ elemIndex (W.tag (W.workspace (W.current s))) $ map W.tag ws - + setCurrentDesktop curr setClientList wins @@ -70,11 +70,11 @@ ewmhDesktopsLogHook = withWindowSet $ \s -> do -- Per window Desktop -- To make gnome-panel accept our xinerama stuff, we display -- all visible windows on the current desktop. - forM_ (W.current s : W.visible s) $ \x -> + forM_ (W.current s : W.visible s) $ \x -> forM_ (W.integrate' (W.stack (W.workspace x))) $ \win -> do setWindowDesktop win curr - forM_ (W.hidden s) $ \w -> + forM_ (W.hidden s) $ \w -> let wn = fromJust $ elemIndex (W.tag w) (map W.tag ws) in forM_ (W.integrate' (W.stack w)) $ \win -> do setWindowDesktop win wn -- cgit v1.2.3