[XMonad] Use string remapping for ewmh logging
This commit is contained in:
parent
68b7cc7a81
commit
0b182e7434
@ -63,7 +63,7 @@ main = xmonad $ pagerHints def
|
|||||||
, manageHook = manageDocks <+> myManageHook <+> manageHook def
|
, manageHook = manageDocks <+> myManageHook <+> manageHook def
|
||||||
, layoutHook = myLayoutHook
|
, layoutHook = myLayoutHook
|
||||||
, logHook = myLogHook +++ ewmhWorkspaceNamesLogHook
|
, logHook = myLogHook +++ ewmhWorkspaceNamesLogHook
|
||||||
, handleEventHook = docksEventHook <+> fullscreenEventHook +++ ewmhWorkspaceNamesEventHook
|
, handleEventHook = docksEventHook <+> fullscreenEventHook +++ ewmhDesktopsEventHook
|
||||||
, startupHook = myStartup +++ ewmhWorkspaceNamesLogHook
|
, startupHook = myStartup +++ ewmhWorkspaceNamesLogHook
|
||||||
, keys = customKeys (const []) addKeys
|
, keys = customKeys (const []) addKeys
|
||||||
} where
|
} where
|
||||||
@ -71,22 +71,15 @@ main = xmonad $ pagerHints def
|
|||||||
|
|
||||||
myLogHook = fadeInactiveLogHook 0.9
|
myLogHook = fadeInactiveLogHook 0.9
|
||||||
|
|
||||||
enableCustomWorkspaceNames = True
|
|
||||||
|
|
||||||
ewmhWorkspaceNamesLogHook = do
|
ewmhWorkspaceNamesLogHook = do
|
||||||
WorkspaceNames namesMap <- XS.get
|
WorkspaceNames namesMap <- XS.get
|
||||||
ewmhDesktopsLogHookCustom $ map (addWorkspaceNamesToTag namesMap)
|
ewmhDesktopsLogHookCustom id (getWorkspaceNameFromTag namesMap)
|
||||||
|
|
||||||
ewmhWorkspaceNamesEventHook e = do
|
getWorkspaceNameFromTag namesMap tag =
|
||||||
WorkspaceNames namesMap <- XS.get
|
case M.lookup tag namesMap of
|
||||||
ewmhDesktopsEventHookCustom (map $ addWorkspaceNamesToTag namesMap) e
|
Nothing -> tag
|
||||||
|
Just label -> printf "%s: %s " tag label
|
||||||
|
|
||||||
addWorkspaceNamesToTag namesMap ws@W.Workspace { W.tag = currentTag } =
|
|
||||||
if enableCustomWorkspaceNames then
|
|
||||||
let currentName = M.findWithDefault "" (W.tag ws) namesMap in
|
|
||||||
ws { W.tag = printf "%s: %s" currentTag currentName }
|
|
||||||
else
|
|
||||||
ws
|
|
||||||
setWorkspaceNameToFocusedWindow workspace = do
|
setWorkspaceNameToFocusedWindow workspace = do
|
||||||
namedWindows <- mapM getClass $ W.integrate' $ W.stack workspace
|
namedWindows <- mapM getClass $ W.integrate' $ W.stack workspace
|
||||||
renamedWindows <- remapNames namedWindows
|
renamedWindows <- remapNames namedWindows
|
||||||
|
Loading…
Reference in New Issue
Block a user