[XMonad] Rewrite dynamic workspace naming

This commit is contained in:
Ivan Malison 2016-11-25 18:41:49 -08:00
parent f00e2cc920
commit 2a99632288
No known key found for this signature in database
GPG Key ID: 62530EFBE99DC2F8

View File

@ -269,17 +269,16 @@ getClassRemap =
fmap (fromMaybe M.empty . decode) $
windowClassFontAwesomeFile >>= B.readFile
setWorkspaceNameToFocusedWindow workspace = do
namedWindows <- mapM getClass $ W.integrate' $ W.stack workspace
renamedWindows <- remapNames namedWindows
getWSName <- getWorkspaceNames'
let newName = intercalate "|" renamedWindows
currentName = fromMaybe "" (getWSName (W.tag workspace))
when (currentName /= newName) $ setWorkspaceName (W.tag workspace) newName
getClassRemapF = (flip maybeRemap) <$> (getClassRemap)
getWSClassNames' w = mapM getClass $ W.integrate' $ W.stack w
getWSClassNames w = (io $ fmap map getClassRemapF) <*> getWSClassNames' w
currentWSName ws = (fromMaybe "") <$> (getWorkspaceNames' <*> pure (W.tag ws))
desiredWSName = (intercalate "|" <$>) . getWSClassNames
remapNames namedWindows = do
remap <- io getClassRemap
return $ map (\orig -> M.findWithDefault orig orig remap) namedWindows
setWorkspaceNameToFocusedWindow workspace = do
currentName <- currentWSName workspace
newName <- desiredWSName workspace
when (currentName /= newName) $ setWorkspaceName (W.tag workspace) newName
setWorkspaceNames =
gets windowset >>= mapM_ setWorkspaceNameToFocusedWindow . W.workspaces