X-Git-Url: https://git.sur5r.net/?p=i3%2Fi3;a=blobdiff_plain;f=i3bar%2Fsrc%2Fworkspaces.c;fp=i3bar%2Fsrc%2Fworkspaces.c;h=7285d1503eb3cf57a3ad2213d4c3659164b40260;hp=233249893ecf10fc96e3d598d9cee64779b0837b;hb=1847938d4eeba98260cc79ca45a11a134274c2ea;hpb=c54f5008395b10c046f380cc3069ff779e5d2877 diff --git a/i3bar/src/workspaces.c b/i3bar/src/workspaces.c index 23324989..7285d150 100644 --- a/i3bar/src/workspaces.c +++ b/i3bar/src/workspaces.c @@ -106,8 +106,8 @@ static int workspaces_string_cb(void *params_, const unsigned char *val, size_t const char *ws_name = (const char *)val; params->workspaces_walk->canonical_name = sstrndup(ws_name, len); - if (config.strip_ws_numbers && params->workspaces_walk->num >= 0) { - /* Special case: strip off the workspace number */ + if ((config.strip_ws_numbers || config.strip_ws_name) && params->workspaces_walk->num >= 0) { + /* Special case: strip off the workspace number/name */ static char ws_num[10]; snprintf(ws_num, sizeof(ws_num), "%d", params->workspaces_walk->num); @@ -119,11 +119,14 @@ static int workspaces_string_cb(void *params_, const unsigned char *val, size_t if (offset && ws_name[offset] == ':') offset += 1; - /* Offset may be equal to length, in which case display the number */ - params->workspaces_walk->name = (offset < len - ? i3string_from_markup_with_length(ws_name + offset, len - offset) - : i3string_from_markup(ws_num)); - + if (config.strip_ws_numbers) { + /* Offset may be equal to length, in which case display the number */ + params->workspaces_walk->name = (offset < len + ? i3string_from_markup_with_length(ws_name + offset, len - offset) + : i3string_from_markup(ws_num)); + } else { + params->workspaces_walk->name = i3string_from_markup(ws_num); + } } else { /* Default case: just save the name */ params->workspaces_walk->name = i3string_from_markup_with_length(ws_name, len);