xmonad-contrib-0.18.0: Community-maintained extensions for xmonad

Copyright | (c) Tomas Janousek <tomi@nomi.cz>
License | BSD3-style (see LICENSE)
Maintainer | Tomas Janousek <tomi@nomi.cz>
Stability | experimental
Portability | unportable
Safe Haskell | None
Language | Haskell2010

XMonad.Actions.WorkspaceNames

Contents

- Usage
- Workspace naming
- Workspace swapping
- Workspace prompt
- StatusBar, EwmhDesktops integration

Description

Provides bindings to rename workspaces, show these names in a status bar and swap workspaces along with their names. These names survive restart. Together with XMonad.Layout.WorkspaceDir this provides for a fully dynamic topic space workflow.

Synopsis

- renameWorkspace :: XPConfig -> X ()
- getWorkspaceNames' :: X (WorkspaceId -> Maybe String)
- getWorkspaceNames :: String -> X (String -> WindowSpace -> String)
- getWorkspaceName :: WorkspaceId -> X (Maybe String)
- getCurrentWorkspaceName :: X (Maybe String)
- setWorkspaceName :: WorkspaceId -> String -> X ()
- setCurrentWorkspaceName :: String -> X ()
- swapTo :: Direction1D -> X ()
- swapTo' :: Direction1D -> WSType -> X ()
- swapWithCurrent :: WorkspaceId -> X ()
- workspaceNamePrompt :: XPConfig -> (WorkspaceId -> X ()) -> X ()
- workspaceNamesPP :: PP -> X PP
- workspaceNamesEwmh :: forall (l :: Type -> Type). XConfig l -> XConfig l

# Usage

You can use this module with the following in your `xmonad.hs` file:

    import XMonad.Actions.WorkspaceNames

Then add keybindings like the following:

      , ((modm .|. shiftMask, xK_r      ), renameWorkspace def)

and apply workspaceNamesPP to your pretty-printer:

    myPP = workspaceNamesPP xmobarPP

Check XMonad.Hooks.StatusBar for more information on how to incorprate this into your status bar.

To expose workspace names to pagers and other EWMH clients, integrate this with XMonad.Hooks.EwmhDesktops:

    main = xmonad $ … . workspaceNamesEwmh . ewmh . … $ def{…}

We also provide a modification of XMonad.Actions.SwapWorkspaces's functionality, which may be used this way:

      , ((modMask .|. shiftMask, xK_Left  ), swapTo Prev)
      , ((modMask .|. shiftMask, xK_Right ), swapTo Next)

    [((modm .|. controlMask, k), swapWithCurrent i)
        | (i, k) <- zip workspaces [xK_1 ..]]

For detailed instructions on editing your key bindings, see the tutorial.

# Workspace naming

renameWorkspace :: XPConfig -> X () #

Prompt for a new name for the current workspace and set it.

getWorkspaceNames' :: X (WorkspaceId -> Maybe String) #

Returns a lookup function that maps workspace tags to workspace names.

getWorkspaceNames :: String -> X (String -> WindowSpace -> String) #

Returns a function for `ppRename` that appends `sep` and the workspace name, if set.

getWorkspaceName :: WorkspaceId -> X (Maybe String) #

Gets the name of a workspace, if set, otherwise returns nothing.

getCurrentWorkspaceName :: X (Maybe String) #

Gets the name of the current workspace. See `getWorkspaceName`

setWorkspaceName :: WorkspaceId -> String -> X () #

Sets the name of a workspace. Empty string makes the workspace unnamed again.

setCurrentWorkspaceName :: String -> X () #

Sets the name of the current workspace. See `setWorkspaceName`.

# Workspace swapping

swapTo :: Direction1D -> X () #

See `swapTo`. This is the same with names.

swapTo' :: Direction1D -> WSType -> X () #

Swap with the previous or next workspace of the given type.

swapWithCurrent :: WorkspaceId -> X () #

See `swapWithCurrent`. This is almost the same with names.

# Workspace prompt

workspaceNamePrompt :: XPConfig -> (WorkspaceId -> X ()) -> X () #

Same behavior than `workspacePrompt` excepted it acts on the workspace name provided by this module.

# StatusBar, EwmhDesktops integration

workspaceNamesPP :: PP -> X PP #

Modify `PP`'s pretty-printing format to show workspace names as well.

workspaceNamesEwmh :: forall (l :: Type -> Type). XConfig l -> XConfig l #

Tell XMonad.Hooks.EwmhDesktops to append workspace names to desktop names.