xmonad-contrib-0.11.1: Third party extensions for xmonad

Portability | unportable
Stability | experimental
Maintainer | <byorgey@gmail.com>
Safe Haskell | None

XMonad.Actions.DynamicWorkspaceOrder

Contents

- Usage

Description

Remember a dynamically updateable ordering on workspaces, together with tools for using this ordering with XMonad.Actions.CycleWS and XMonad.Hooks.DynamicLog.

Synopsis

- getWsCompareByOrder :: X WorkspaceCompare
- getSortByOrder :: X WorkspaceSort
- swapWith :: Direction1D -> WSType -> X ()
- moveTo :: Direction1D -> WSType -> X ()
- moveToGreedy :: Direction1D -> WSType -> X ()
- shiftTo :: Direction1D -> WSType -> X ()
- withNthWorkspace :: (String -> WindowSet -> WindowSet) -> Int -> X ()

# Usage

You can use this module by importing it into your ~/.xmonad/xmonad.hs file:

     import qualified XMonad.Actions.DynamicWorkspaceOrder as DO

Then add keybindings to swap the order of workspaces (these examples use XMonad.Util.EZConfig emacs-style keybindings):

            , ("M-C-<R>",   DO.swapWith Next NonEmptyWS)
            , ("M-C-<L>",   DO.swapWith Prev NonEmptyWS)

See XMonad.Actions.CycleWS for information on the possible arguments to `swapWith`.

However, by itself this will do nothing; `swapWith` does not change the actual workspaces in any way. It simply keeps track of an auxiliary ordering on workspaces. Anything which cares about the order of workspaces must be updated to use the auxiliary ordering.

To change the order in which workspaces are displayed by XMonad.Hooks.DynamicLog, use `getSortByOrder` in your `ppSort` field, for example:

       ... dynamicLogWithPP $ byorgeyPP {
         ...
         , ppSort = DO.getSortByOrder
         ...
       }

To use workspace cycling commands like those from XMonad.Actions.CycleWS, use the versions of `moveTo`, `moveToGreedy`, and `shiftTo` exported by this module. For example:

         , ("M-S-<R>",   DO.shiftTo Next HiddenNonEmptyWS)
         , ("M-S-<L>",   DO.shiftTo Prev HiddenNonEmptyWS)
         , ("M-<R>",     DO.moveTo Next HiddenNonEmptyWS)
         , ("M-<L>",     DO.moveTo Prev HiddenNonEmptyWS)

For slight variations on these, use the source for examples and tweak as desired.

getWsCompareByOrder :: X WorkspaceCompare

A comparison function which orders workspaces according to the stored dynamic ordering.

getSortByOrder :: X WorkspaceSort

Sort workspaces according to the stored dynamic ordering.

swapWith :: Direction1D -> WSType -> X ()

Swap the current workspace with another workspace in the stored dynamic order.

moveTo :: Direction1D -> WSType -> X ()

View the next workspace of the given type in the given direction, where "next" is determined using the dynamic workspace order.

moveToGreedy :: Direction1D -> WSType -> X ()

Same as `moveTo`, but using `greedyView` instead of `view`.

shiftTo :: Direction1D -> WSType -> X ()

Shift the currently focused window to the next workspace of the given type in the given direction, using the dynamic workspace order.

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

Do something with the nth workspace in the dynamic order. The callback is given the workspace's tag as well as the `WindowSet` of the workspace itself.