StackerIcons - bakkeby/dusk GitHub Wiki

The StackerIcons functionality complements the stacker utilities by adding keyboard shortcut hints in the window titles.

When enabled the stackericons array in the configuration controls what hints are shown.

static const StackerIcon stackericons[] = {
	{ "[j]", {.i = INC(+1) } },
	{ "[k]", {.i = INC(-1) } },
	{ "[s]", {.i = PREVSEL } },
	{ "[w]", {.i = 1 } },
	{ "[e]", {.i = 2 } },
	{ "[a]", {.i = 3 } },
	{ "[z]", {.i = LASTTILED } },
};

In principle this should mirror the the bindings in the STACKKEYS macro, but hints like INC(+1) can be omitted if so desired.

The functionality should work just fine with traditional stacker bindings, although in practice the benefit may be more apparent with a master stacker setup.

At the face of it the configuration may look self-explanatory; the text on the left is the keyboard shortcut hint that is added to the window title while the thing in the braces on the right is the same argument that is listed in the STACKKEYS macro.

There is a bit more to this than that though.

By default stacker hints are treated the same way as window title icons are if the WinTitleIcons functionality is enabled. This means that there will be a gap between the stacker hint and the window title that is controlled via the iconspacing configuration item.

If window title icons are present then the stacker hint will by default be placed to the right of the window icon.

It is possible to change the position of the stacker hint by adding a third value to the list, e.g.

static const StackerIcon stackericons[] = {
	{ "[j]", {.i = INC(+1) }, StackerTitlePrefix },
	{ "[k]", {.i = INC(-1) }, StackerTitlePrefix },
	{ "[s]", {.i = PREVSEL }, StackerTitlePrefix },
	{ "[w]", {.i = 1 }, StackerTitlePrefix },
	{ "[e]", {.i = 2 }, StackerTitlePrefix },
	{ "[a]", {.i = 3 }, StackerTitlePrefix },
	{ "[z]", {.i = LASTTILED }, StackerTitlePrefix },
};

This comes from the StackerIcon struct that has that third field (which when omitted will default to 0).

typedef struct {
	char *icon;
	Arg arg;
	int pos; /* indicates that the icon is to be added as a prefix (0) or suffix (1) */
} StackerIcon;

The position options are:

Position Description
StackerRightOfWindowIcon Hint is treated as a window icon (placed to the right of the window icon if present)
StackerLeftOfWindowIcon Hint is treated as a window icon (placed to the left of the window icon if present)
StackerTitlePrefix Hint is added at the start of the window title (prefix)
StackerTitleSuffix Hint is added at the end of the window title (suffix)
StackerTitleEllipsis Hint is added at the end of the window title (but overwrites ellipsis if truncated)

The disadvantage of having the hint as a suffix is that if the window title is too long then it will be cut off and the hint will not be visible. As an alternative to this the ellipsis option which behaves the same as the suffix, but will still be printed on top of the ellipsis if the title is truncated / cut off. This can cause some graphical artefacts where a character may be partially overwritten.

Stacker hints will only show for the active workspace.

Something worth noting is that status2d markup can be used to decorate the stacker icons.

This could be used, for example, to add a distinct colour for the key:

static const StackerIcon stackericons[] = {
	{ "[^c#dd9090^j^d^] ", {.i = INC(+1) } },
	{ "[^c#dd9090^k^d^] ", {.i = INC(-1) } },
	{ "[^c#dd9090^s^d^] ", {.i = PREVSEL } },
	{ "[^c#dd9090^w^d^] ", {.i = 1 } },
	{ "[^c#dd9090^e^d^] ", {.i = 2 } },
	{ "[^c#dd9090^a^d^] ", {.i = 3 } },
	{ "[^c#dd9090^z^d^] ", {.i = LASTTILED } },
};

stackericons.png

Back to Functionality.

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