i3bar: implement custom workspace numbers config

Implement the configuration option within the bar config directive for
custom workspace numbers with the directive `strip_workspace_numbers
yes`.

This directive strips the workspace name of the number prefix and
delimiter. When the workspace name consists only of the number, it will
default to show the number.

For example:

* "2:5" -> "5"
* "4:$" -> "$"
* "8" -> "8"

This allows customization of i3bar for alternate ordering of workspaces
which has a legitimate use for alternate keyboard layouts such as
Dvorak.

fixes #1131
This commit is contained in:
Tony Crisci
2014-05-05 13:56:47 -04:00
committed by Michael Stapelberg
parent e2f47ef466
commit e707e0a5fa
12 changed files with 81 additions and 6 deletions

View File

@ -418,7 +418,7 @@ void handle_button(xcb_button_press_event_t *event) {
* buffer, then we copy character by character. */
int num_quotes = 0;
size_t namelen = 0;
const char *utf8_name = i3string_as_utf8(cur_ws->name);
const char *utf8_name = cur_ws->canonical_name;
for (const char *walk = utf8_name; *walk != '\0'; walk++) {
if (*walk == '"')
num_quotes++;