xmonad-contrib-0.17.0.9: Community-maintained extensions for xmonad
Copyright(c) Yecine Megdiche <yecine.megdiche@gmail.com>
LicenseBSD3-style (see LICENSE)
MaintainerYecine Megdiche <yecine.megdiche@gmail.com>
Stabilityunstable
Portabilityunportable
Safe HaskellSafe-Inferred
LanguageHaskell2010

XMonad.Hooks.StatusBar.WorkspaceScreen

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
import XMonad.Hooks.StatusBar.PP
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.

combineWithScreen :: X WorkspaceScreenCombiner -> PP -> X PP Source #

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.

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

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

type WorkspaceScreenCombiner = WorkspaceId -> WindowScreen -> String Source #

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.)