1
0
mirror of https://github.com/xmonad/xmonad-contrib.git synced 2025-07-30 11:41:51 -07:00

X.A.WorkspaceNames: add get(Current)WorkspaceName

This commit is contained in:
Tomas Janousek
2016-01-27 18:43:52 +01:00
parent ae7fd21e29
commit 0a74e3479e

@@ -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 ()