Skip to content

Workspace alphanumerical names #520

@thamma

Description

@thamma

Again, I'm fairly certain that this behaviour is unintended. I'm running i3wm 4.13 with polybar 3.0.5 on Arch Linux 4.9 7-1.

Reproduction

The whole issue relates to the strip-wsnumbers = true setting. I3wm supports workspaces containing the index to be sorted by and the display name. For instance "1:A", "2:B" will be displayed as "A" and "B" and will be sorted as expected.

I create workspaces named "5:foo", "foobar", "6:7" and "2147483648:1" to demonstrate several issues separately. Then I launch polybar. The same behaviour is reproduced if I launch polybar first.

Expected behaviour

With said option turned on, I expect a workspace named "foo", a workspace named "7" and "1" to be displayed. I expect the workspace "foo" to be sorted before "7" and both to be sorted before "1" as the workspaces are supposed to be sorted by the number before the colon. The sorting of the displayed workspace "foobar" is accepted to be arbitrary.

actual behaviour

In the first two cases the workspace names become "5" and "6", respectively. The workspace foobar is displayed as "-1". In the last case, the workspace is displayed as "-2147483648". The workspace names seemingly don't support alphanumerical strings but instead return the matching workspace index as integer.
The provided signed integer overflow especially is UB in C++11.

I've done some debugging and have found that the variable ws_name contains the expected string in src/modules/i3.cpp:150. However I assume that the workspace names internally are represented as signed integers, explaining the overflow and the rejecting behaviour when using a plain string as workspace name.

This issue might also be due to the fact that only numeric workspace names are supported, however that seems rather unlikely.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions