Contents

Description

In multi-head setup, it might be useful to have screen information of the visible workspaces combined with the workspace name, for example in a status bar. This module provides utility functions to do just that.

Synopsis

# Usage

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

import XMonad
import XMonad.Hooks.StatusBar.WorkspaceScreen

For example, to add the screen number in parentheses to each visible workspace number, you can use combineWithScreenNumber:

myWorkspaceScreenCombiner :: WorkspaceId -> String -> String
myWorkspaceScreenCombiner w sc = w <> wrap "(" ")" sc

mySB = statusBarProp "xmobar" (combineWithScreenNumber myWorkspaceScreenCombiner xmobarPP)
main = xmonad \$ withEasySB mySB defToggleStrutsKey def

This will annotate the workspace names as following:

[1(0)] 2 3 4 <5(1)> 6 7 8 9

To use the screen's name instead, checkout combineWithScreenName:

[1(eDP-1)] 2 3 4 <5(HDMI-1)> 6 7 8 9

For advanced cases, use combineWithScreen.

Combine a workspace name with a screen according to the given WorkspaceScreenCombiner.

combineWithScreenName :: (WorkspaceId -> String -> String) -> PP -> X PP Source #

Combine a workspace name with the screen name it's visible on.

Combine a workspace name with the screen number it's visible on.

Type synonym for a function that combines a workspace name with a screen.

# Limitations

For simplicity, this module assumes xmonad screen ids match screen/monitor numbers as managed by the X server (for example, as given by xrandr --listactivemonitors). Thus, it may not work well when screens show an overlapping range of the framebuffer, e.g. when using a projector. This also means that it doesn't work with XMonad.Layout.LayoutScreens. (This isn't difficult to fix, PRs welcome.)