Workspace_Module - bakkeby/dusk GitHub Wiki
The Workspace module shows icons for workspaces that are associated with the monitor the bar is on.
The module is controlled by this entry in the barrules
array in
config.h.
{ -1, 0, 0, 0, 5, 0, BAR_ALIGN_LEFT, size_workspaces, draw_workspaces, click_workspaces, "workspaces" },
By default the workspace module appears on the first bar on all monitors.
Refer to the Bar Rules page for general information on rules configuration.
The colour scheme used for workspace icons is configured as part of the workspace rules:
static const WorkspaceRule wsrules[] = {
/* ------------------------------- schemes -------------------------------
default, visible, selected, occupied, */
{ ... SchemeWsNorm, SchemeWsVisible, SchemeWsSel, SchemeWsOcc, ...
{ ... SchemeWsNorm, SchemeWsVisible, SchemeWsSel, SchemeWsOcc, ...
{ ... SchemeWsNorm, SchemeWsVisible, SchemeWsSel, SchemeWsOcc, ...
{ ... SchemeWsNorm, SchemeWsVisible, SchemeWsSel, SchemeWsOcc, ...
{ ... SchemeWsNorm, SchemeWsVisible, SchemeWsSel, SchemeWsOcc, ...
{ ... SchemeWsNorm, SchemeWsVisible, SchemeWsSel, SchemeWsOcc, ...
{ ... SchemeWsNorm, SchemeWsVisible, SchemeWsSel, SchemeWsOcc, ...
{ ... SchemeWsNorm, SchemeWsVisible, SchemeWsSel, SchemeWsOcc, ...
{ ... SchemeWsNorm, SchemeWsVisible, SchemeWsSel, SchemeWsOcc, ...
};
A workspace icon be presented in five different colour schemes depending on context. These are, in order of prescedence, as follows:
Colour Scheme | Context |
---|---|
SchemeWsSel | Used when the workspace is selected (active) |
SchemeWsVisible | Used when the workspace is visible (i.e. selected, but not active) |
SchemeUrg | Used when a client on the workspace has the urgency bit set |
SchemeWsOcc | Used when the workspace is occupied by clients |
SchemeWsNorm | The default workspace icon colour scheme |
The SchemeWsVisible
colour scheme is used when viewing multiple workspaces simultaneously on one
monitor and the scheme is used for the workspaces that currently do not have focus.
The colour schemes used (besides the urgent scheme) are defined as part of the workspace rules. As per the default configuration all workspace icons use the same colour schemes, but changes can be made here if it is desireable to have different colours per workspace icon.
Also refer to the Xresources page.
The icons for each workspace is configured as part of the workspace rules:
static const WorkspaceRule wsrules[] = {
/* ------ icons ------
def, vac, occ, */
{ ... "1", "", "[1]", },
{ ... "2", "", "[2]", },
{ ... "3", "", "[3]", },
{ ... "4", "", "[4]", },
{ ... "5", "", "[5]", },
{ ... "6", "", "[6]", },
{ ... "7", "", "[7]", },
{ ... "8", "", "[8]", },
{ ... "9", "", "[9]", },
};
The def
(ault), vac
(ant) and occ
(upied) strings directly control the icons that are shown in
the bar module.
The workspace name
is specifically used as a reference to the workspace when it comes to key
bindings. Optionally the name can be shown in the bar via the AltWorkspaceIcons
functionality.
The def
icon is shown by default when a workspace is not occupied by any clients.
This can be set to an empty string if empty workspaces are not to be shown in the bar. This behaviour will be similar to that of the hide vacant tags patch for dwm.
The occ
icon is shown when a workspace is occupied by clients.
The vac
icon is used in the special case where a workspace that is not occupied by any clients is
selected and the def
icon is an empty string. One may think of it as an icon for selected vacant
workspaces.
Example configuration:
------ icons ------
def, vac, occ,
"", "a", "A",
"", "b", "B",
"", "c", "C",
"", "d", "D",
"", "e", "E",
"", "f", "F",
"", "g", "G",
"", "h", "H",
"", "i", "I",
Here vacant workspaces are not shown by default, but if they are selected then they will show
characters a
through i
and if the workspace has clients then the character will be in upper
case.
If workspace icons are set to NULL
then they will fall back to using the workspace name for
display purposes.
The workspace module has several indicators defined in config.h.
[IndicatorWsOcc] = INDICATOR_NONE,
[IndicatorWsSel] = INDICATOR_NONE,
[IndicatorWsVis] = INDICATOR_NONE,
[IndicatorWsNorm] = INDICATOR_NONE,
[IndicatorPinnedWs] = INDICATOR_NONE,
IndicatorWsOcc
is an indicator highlighting that the workspace has clients on it. This can
be used in addition to or instead of occupied workspace icons.
IndicatorWsSel
is an indicator highlighting which workspace is the selected one. This can be
used in addition to or instead of the selected workspace colour scheme.
IndicatorWsVis
is an indicator highlighting which workspaces are visible, but not selected.
This can be used in addition to or instead of the visible workspace colour scheme.
IndicatorWsNorm
is an indicator highlighting which workspaces are not visible.
IndicatorPinnedWs
is an indicator highlighting that the workspace is pinned to a monitor,
which means that the workspace will not be moved between monitors when activated.
Refer to the Bar Indicators page for options.
Also see the togglepinnedws function.
Clicks on the workspace module will result in a ClkWorkspaceBar
click type that can be filtered
on in the button bindings.
Example bindings as per the default configuration:
{ ClkWorkspaceBar, ..., viewws, {0} }, // view the workspace by clicking on workspace icon
{ ClkWorkspaceBar, ..., movews, {0} }, // sends (moves) the currently focused client to given workspace
{ ClkWorkspaceBar, ..., swapws, {0} }, // swaps all clients on current workspace with that of the given workspace
{ ClkWorkspaceBar, ..., enablews, {0} }, // enables the workspace in addition to other workspaces
{ ClkWorkspaceBar, ..., viewwsdir, {.i = +2 } }, // view the next workspace right of current workspace that has clients (on the current monitor)
{ ClkWorkspaceBar, ..., viewwsdir, {.i = -2 } }, // view the next workspace left of current workspace that has clients (on the current monitor)
{ ClkWorkspaceBar, ..., togglepinnedws, {0} }, // toggles the pinning of a workspace to the current monitor
When the argument for the button bindings is {0}
then the bar module will set the argument based
on which of the workspaces the user clicked on. If the argument is explicitly set, as in the case
for the viewwsdir function above, then that argument takes precedence.
This means that functions handling clicks on the workspace module must be able to handle workspace references.
Also see the Button Bindings page.
If the WorkspacePreview functionality is enabled then hovering over occupied workspace icons will reveal a preview image of the given workspace.
If the WorkspaceLabels functionality is enabled then the workspace icon will be accompanied with a label indicating the primary client window on that workspace.
Back to Bar > Bar Modules.