[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) $ 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