[XMonad] Rewrite dynamic workspace naming
This commit is contained in:
parent
f00e2cc920
commit
2a99632288
@ -269,17 +269,16 @@ getClassRemap =
|
|||||||
fmap (fromMaybe M.empty . decode) $
|
fmap (fromMaybe M.empty . decode) $
|
||||||
windowClassFontAwesomeFile >>= B.readFile
|
windowClassFontAwesomeFile >>= B.readFile
|
||||||
|
|
||||||
setWorkspaceNameToFocusedWindow workspace = do
|
getClassRemapF = (flip maybeRemap) <$> (getClassRemap)
|
||||||
namedWindows <- mapM getClass $ W.integrate' $ W.stack workspace
|
getWSClassNames' w = mapM getClass $ W.integrate' $ W.stack w
|
||||||
renamedWindows <- remapNames namedWindows
|
getWSClassNames w = (io $ fmap map getClassRemapF) <*> getWSClassNames' w
|
||||||
getWSName <- getWorkspaceNames'
|
currentWSName ws = (fromMaybe "") <$> (getWorkspaceNames' <*> pure (W.tag ws))
|
||||||
let newName = intercalate "|" renamedWindows
|
desiredWSName = (intercalate "|" <$>) . getWSClassNames
|
||||||
currentName = fromMaybe "" (getWSName (W.tag workspace))
|
|
||||||
when (currentName /= newName) $ setWorkspaceName (W.tag workspace) newName
|
|
||||||
|
|
||||||
remapNames namedWindows = do
|
setWorkspaceNameToFocusedWindow workspace = do
|
||||||
remap <- io getClassRemap
|
currentName <- currentWSName workspace
|
||||||
return $ map (\orig -> M.findWithDefault orig orig remap) namedWindows
|
newName <- desiredWSName workspace
|
||||||
|
when (currentName /= newName) $ setWorkspaceName (W.tag workspace) newName
|
||||||
|
|
||||||
setWorkspaceNames =
|
setWorkspaceNames =
|
||||||
gets windowset >>= mapM_ setWorkspaceNameToFocusedWindow . W.workspaces
|
gets windowset >>= mapM_ setWorkspaceNameToFocusedWindow . W.workspaces
|
||||||
|
Loading…
Reference in New Issue
Block a user