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

Copyright | (c) David Roundy <droundy@darcs.net>
License | BSD3-style (see LICENSE)
Maintainer | none
Stability | unstable
Portability | unportable
Safe Haskell | Safe-Inferred
Language | Haskell2010

XMonad.Actions.DynamicWorkspaces

Contents

- Usage

Description

Provides bindings to add and delete workspaces.

Synopsis

- addWorkspace :: String -> X ()
- addWorkspacePrompt :: XPConfig -> X ()
- appendWorkspace :: String -> X ()
- appendWorkspacePrompt :: XPConfig -> X ()
- addWorkspaceAt :: (WindowSpace -> [WindowSpace] -> [WindowSpace]) -> String -> X ()
- removeWorkspace :: X ()
- removeWorkspaceByTag :: String -> X ()
- removeEmptyWorkspace :: X ()
- removeEmptyWorkspaceByTag :: String -> X ()
- removeEmptyWorkspaceAfter :: X () -> X ()
- removeEmptyWorkspaceAfterExcept :: [String] -> X () -> X ()
- addHiddenWorkspace :: String -> X ()
- addHiddenWorkspaceAt :: (WindowSpace -> [WindowSpace] -> [WindowSpace]) -> String -> X ()
- withWorkspace :: XPConfig -> (String -> X ()) -> X ()
- selectWorkspace :: XPConfig -> X ()
- renameWorkspace :: XPConfig -> X ()
- renameWorkspaceByName :: String -> X ()
- toNthWorkspace :: (String -> X ()) -> Int -> X ()
- withNthWorkspace :: (String -> WindowSet -> WindowSet) -> Int -> X ()
- setWorkspaceIndex :: WorkspaceIndex -> X ()
- withWorkspaceIndex :: (String -> WindowSet -> WindowSet) -> WorkspaceIndex -> X ()
- type WorkspaceIndex = Int

# Usage

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

    import XMonad.Actions.DynamicWorkspaces
    import XMonad.Actions.CopyWindow(copy)

Then add keybindings like the following:

      , ((modm .|. shiftMask, xK_BackSpace), removeWorkspace)
      , ((modm .|. shiftMask, xK_v      ), selectWorkspace def)
      , ((modm, xK_m                    ), withWorkspace def (windows . W.shift))
      , ((modm .|. shiftMask, xK_m      ), withWorkspace def (windows . copy))
      , ((modm .|. shiftMask, xK_r      ), renameWorkspace def)

    -- mod-[1..9]       %! Switch to workspace N in the list of workspaces
    -- mod-shift-[1..9] %! Move client to workspace N in the list of workspaces
       ++
       zip (zip (repeat (modm)) [xK_1..xK_9]) (map (withNthWorkspace W.greedyView) [0..])
       ++
       zip (zip (repeat (modm .|. shiftMask)) [xK_1..xK_9]) (map (withNthWorkspace W.shift) [0..])

Alternatively, you can associate indexes (which don't depend of the workspace list order) to workspaces by using following keybindings:

    -- mod-[1..9]         %! Switch to workspace of index N
    -- mod-control-[1..9] %! Set index N to the current workspace
       ++
       zip (zip (repeat (modm)) [xK_1..xK_9]) (map (withWorkspaceIndex W.greedyView) [1..])
       ++
       zip (zip (repeat (modm .|. controlMask)) [xK_1..xK_9]) (map (setWorkspaceIndex) [1..])

For detailed instructions on editing your key bindings, see XMonad.Doc.Extending. See also the documentation for XMonad.Actions.CopyWindow, `windows`, `shift`, and `XPConfig`.

addWorkspace :: String -> X () #

Add a new workspace with the given name, or do nothing if a workspace with the given name already exists; then switch to the newly created workspace.

addWorkspacePrompt :: XPConfig -> X () #

Prompt for the name of a new workspace, add it if it does not already exist, and switch to it.

appendWorkspace :: String -> X () #

Same as addWorkspace, but adds the workspace to the end of the list of workspaces

appendWorkspacePrompt :: XPConfig -> X () #

Prompt for the name of a new workspace, appending it to the end of the list of workspaces if it does not already exist, and switch to it.

addWorkspaceAt :: (WindowSpace -> [WindowSpace] -> [WindowSpace]) -> String -> X () #

Adds a new workspace with the given name to the current list of workspaces. This function allows the user to pass a function that inserts an element into a list at an arbitrary spot.

removeWorkspace :: X () #

Remove the current workspace.

removeWorkspaceByTag :: String -> X () #

Remove workspace with specific tag.

removeEmptyWorkspace :: X () #

Remove the current workspace if it contains no windows.

removeEmptyWorkspaceByTag :: String -> X () #

Remove workspace with specific tag if it contains no windows.

removeEmptyWorkspaceAfter :: X () -> X () #

Remove the current workspace after an operation if it is empty and hidden. Can be used to remove a workspace if it is empty when leaving it. The operation may only change workspace once, otherwise the workspace will not be removed.

removeEmptyWorkspaceAfterExcept :: [String] -> X () -> X () #

Like `removeEmptyWorkspaceAfter` but use a list of sticky workspaces, whose entries will never be removed.

addHiddenWorkspace :: String -> X () #

Add a new hidden workspace with the given name, or do nothing if a workspace with the given name already exists.

addHiddenWorkspaceAt :: (WindowSpace -> [WindowSpace] -> [WindowSpace]) -> String -> X () #

Add a new hidden workspace with the given name, or do nothing if a workspace with the given name already exists. Takes a function to insert the workspace at an arbitrary spot in the list.

withWorkspace :: XPConfig -> (String -> X ()) -> X () #

selectWorkspace :: XPConfig -> X () #

renameWorkspace :: XPConfig -> X () #

renameWorkspaceByName :: String -> X () #

toNthWorkspace :: (String -> X ()) -> Int -> X () #

withNthWorkspace :: (String -> WindowSet -> WindowSet) -> Int -> X () #

setWorkspaceIndex :: WorkspaceIndex -> X () #

Set the index of the current workspace.

withWorkspaceIndex :: (String -> WindowSet -> WindowSet) -> WorkspaceIndex -> X () #

type WorkspaceIndex = Int #

The workspace index is mapped to a workspace tag by the user and can be updated.