Merge pull request #108 from liskin/workspacenames

X.A.WorkspaceNames: add get(Current)WorkspaceName
This commit is contained in:
Brent Yorgey 2016-11-02 21:25:06 -04:00 committed by GitHub
commit 65bbe1a995

View File

@ -25,6 +25,8 @@ module XMonad.Actions.WorkspaceNames (
renameWorkspace,
workspaceNamesPP,
getWorkspaceNames,
getWorkspaceName,
getCurrentWorkspaceName,
setWorkspaceName,
setCurrentWorkspaceName,
@ -97,6 +99,17 @@ getWorkspaceNames = do
Nothing -> wks
Just s -> wks ++ ":" ++ s
-- | Gets the name of a workspace, if set, otherwise returns nothing.
getWorkspaceName :: WorkspaceId -> X (Maybe String)
getWorkspaceName w = do
WorkspaceNames m <- XS.get
return $ M.lookup w m
-- | Gets the name of the current workspace. See 'getWorkspaceName'
getCurrentWorkspaceName :: X (Maybe String)
getCurrentWorkspaceName = do
getWorkspaceName =<< gets (W.currentTag . windowset)
-- | Sets the name of a workspace. Empty string makes the workspace unnamed
-- again.
setWorkspaceName :: WorkspaceId -> String -> X ()