diff --git a/XMonad/Actions/WorkspaceNames.hs b/XMonad/Actions/WorkspaceNames.hs index fbea92e0..0e719d7e 100644 --- a/XMonad/Actions/WorkspaceNames.hs +++ b/XMonad/Actions/WorkspaceNames.hs @@ -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 ()