LtSymbol_Module - bakkeby/dusk GitHub Wiki

The layout symbol (LtSymbol) module displays a text indicator representing the layout that is currently in use on the active workspace.

ltsymbol.png

The above shows the default symbol for the tile layout.

The symbols for predefined layouts are specified in the layouts array in config.h.

Configuration

The module is controlled by this entry in the barrules array in config.h.

{ -1, 0, 0, 0, 0, 0, BAR_ALIGN_LEFT, size_ltsymbol, draw_ltsymbol, click_ltsymbol, "layout" },

By default the layout symbol is shown on the first bar on every monitor.

Refer to the Bar Rules page for general information on rules configuration.

Clicks

Clicks on the layout symbol module will result in a ClkLtSymbol click type that can be filtered on in the button bindings.

Example bindings as per the default configuration:

{ ClkLtSymbol, ..., setlayout,   {-1} }, // toggles between current and previous layout
{ ClkLtSymbol, ..., cyclelayout, {.i = +1 } }, // cycle through the available layouts
{ ClkLtSymbol, ..., cyclelayout, {.i = -1 } }, // cycle through the available layouts (in reverse)

The module does not set an explicit argument for click handling, so the arguments passed via the button bindings are the ones that the functions will use.

Also see the Button Bindings page.

Symbol functions

Optionally predefined layouts can also specify a separate function that is used to generate the layout symbol. This would be the "symbol func" value in the layouts array.

As an example the default layout setting for the monocle layout is as follows:

static const Layout layouts[] = {
	/* symbol     arrange function, { nmaster, nstack, layout, master axis, stack axis, secondary stack axis, symbol func } */
	...
	{ "[M]",      flextile,         { -1, -1, NO_SPLIT, MONOCLE, MONOCLE, 0, NULL } }, // monocle
	...

The NULL at the end indicates that there is no separate function that provides the layout symbol so the layout will always show as [M].

If, however, this is changed to use the monoclesymbols function then the layout symbol will instead show how many clients there are on the workspace.

static const Layout layouts[] = {
	/* symbol     arrange function, { nmaster, nstack, layout, master axis, stack axis, secondary stack axis, symbol func } */
	...
	{ "[M]",      flextile,         { -1, -1, NO_SPLIT, MONOCLE, MONOCLE, 0, monoclesymbols } }, // monocle
	...

The same goes with the deck layout and the decksymbols function.

Here are the example symbol functions that come with the window manager:

static void
monoclesymbols(Workspace *ws, unsigned int n)
{
	if (n > 0)
		snprintf(ws->ltsymbol, sizeof ws->ltsymbol, "[%d]", n);
	else
		snprintf(ws->ltsymbol, sizeof ws->ltsymbol, "[M]");
}
static void
decksymbols(Workspace *ws, unsigned int n)
{
	if (n > ws->nmaster)
		snprintf(ws->ltsymbol, sizeof ws->ltsymbol, "[]%d", n);
	else
		snprintf(ws->ltsymbol, sizeof ws->ltsymbol, "[D]");
}

Flex symbols

The underlying flextile layout allows the user to change splits and arrangements on the fly.

As these are ad-hoc layouts there are no predefined symbols representing them and therefore the symbol is generated based on the split as well as the the arrangements used.

The characters used for the layout split and the arrangements can be changed if desired.

Refer to the layoutsymb and tilesymb arrays in lib/layout_flextile-deluxe.h.

The two arrays map to the layout arrangements (split) and tile arrangement enums respectively.

Colours

There are no predefined and dedicated colour schemes for the layout symbol module.

If needed a new colour scheme can be added and set as the scheme value for the module in the barrules array.

The layout symbol module supports status2d markup which could be used if custom colours or basic drawn symbols are needed.


Back to Bar > Bar Modules.

⚠️ **GitHub.com Fallback** ⚠️