xmonad-contrib-bluetilebranch-0.8.1: Third party extensions for xmonadSource codeContentsIndex
Utility functions for simulating independent sets of workspaces on each screen (like dwm's workspace model), using internal tags to distinguish workspaces associated with each screen.
type VirtualWorkspace = WorkspaceId
type PhysicalWorkspace = WorkspaceId
workspaces' :: XConfig l -> [VirtualWorkspace]
withScreens :: ScreenId -> [VirtualWorkspace] -> [PhysicalWorkspace]
onCurrentScreen :: (VirtualWorkspace -> WindowSet -> a) -> PhysicalWorkspace -> WindowSet -> a
countScreens :: (MonadIO m, Integral i) => m i
marshall :: ScreenId -> VirtualWorkspace -> PhysicalWorkspace
unmarshall :: PhysicalWorkspace -> (ScreenId, VirtualWorkspace)

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

 import XMonad.Layout.IndependentScreens

You can define your workspaces by calling withScreens:

 myConfig = defaultConfig { workspaces = withScreens 2 ["web", "email", "irc"] }

This will create "physical" workspaces with distinct internal names for each (screen, virtual workspace) pair.

Then edit any keybindings that use the list of workspaces or refer to specific workspace names. In the default configuration, only the keybindings for changing workspace do this:

 [((m .|. modMask, k), windows $ f i)
     | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
     , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]

This should change to

 [((m .|. modMask, k), windows $ onCurrentScreen f i)
     | (i, k) <- zip (workspaces' conf) [xK_1 .. xK_9]
     , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]

In particular, the analogue of XMonad.workspaces is workspaces', and you can use onCurrentScreen to convert functions of virtual workspaces to functions of physical workspaces, which work by marshalling the virtual workspace name and the currently focused screen into a physical workspace name.

type VirtualWorkspace = WorkspaceIdSource
type PhysicalWorkspace = WorkspaceIdSource
workspaces' :: XConfig l -> [VirtualWorkspace]Source
:: ScreenIdThe number of screens to make workspaces for
-> [VirtualWorkspace]The desired virtual workspace names
-> [PhysicalWorkspace]A list of all internal physical workspace names
onCurrentScreen :: (VirtualWorkspace -> WindowSet -> a) -> PhysicalWorkspace -> WindowSet -> aSource
countScreens :: (MonadIO m, Integral i) => m iSource

In case you don't know statically how many screens there will be, you can call this in main before starting xmonad. For example, part of my config reads

 main = do
   nScreens <- countScreens
   xmonad $ defaultConfig {
     workspaces = withScreens nScreens (workspaces defaultConfig),
marshall :: ScreenId -> VirtualWorkspace -> PhysicalWorkspaceSource
unmarshall :: PhysicalWorkspace -> (ScreenId, VirtualWorkspace)Source
You shouldn't need to use marshall and unmarshall very much. They simply convert between the physical and virtual worlds. For example, you might want to use them as part of a status bar configuration. The function snd . unmarshall would discard the screen information from an otherwise unsightly workspace name.
Produced by Haddock version 2.4.2