Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

niri/workspaces: Annoyances and ambiguities with pure-digit named Niri workspaces #3991

Open
jmickelin opened this issue Mar 20, 2025 · 0 comments
Labels
bug Something isn't working custom

Comments

@jmickelin
Copy link

There are some pain points when using the niri/workspaces module with named (non-dynamic) workspaces. These become particularly apparent when using digit-only workspace names, e.g. like this:

~/.config/niri/config.kdl

[...]

workspace "1"
workspace "2"
workspace "3"
[...]
workspace "9"

1. There is no way to supply separate formats for named and unnamed workspaces

I would like to differentiate these static workspaces, by displaying a different label on them in the bar. For example, I would like the named ones to say just their names, 1, 2, ..., and the dynamic ones following this list to say (10), (11) and so on.

The module has a single format field for specifying the label, with these replacements:

  • {value} for the name, if it exists, and otherwise the index
  • {name} for the name (or the empty string)
  • {index} for the index (that is, idx, representing the position of the workspace in the list)

As far as I can tell, there is no obvious way to achieve what I want. Checking other Waybar modules, the idiomatic way is to have separate format- fields for each purpose, with the plain format one as fallback.

I suggest adding format-named and format-unnamed. Perhaps even additional ones for workspaces that exist but have no windows: format-named-empty and format-unnamed-empty with format-empty as fallback.

2. Ambugity in the CSS selector

The module provides only a single selector #workspaces button#niri-workspace-<name> used for matching both types of workspaces. name works the same way as value above, matching the name of the workspace, if it is set, or idx otherwise.

While a bit obscure, it makes it impossible to refer to the first workspace (with idx 1) if there is a different workspace who is explicitly named to the string "1" to the right of it.

In analogy with the format replacements, I suggest adding new CSS ID selectors called #niri-workspaces-name-<name> and #niri-workspaces-idx-<idx>. This would technically introduce ambiguity, since #niri-workspaces-* would match those with a name "name-whatever", so adding an explicit #niri-workspaces-value-<value> and deprecating the old one might be a good idea.

3. Differentiating between named and unnamed workspaces in CSS is tedious

While writing CSS rules for all of your named workspaces is technically possible, it's tedious and error prone to refer to all of them by name. It also does not account for workspaces that the user gives an ad-hoc name to with the set-workspace-name command, unless the name is known up-front.

Adding a class .named for named workspaces (and :not() used for the converse) would be extremely useful.

@github-actions github-actions bot added bug Something isn't working custom labels Mar 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working custom
Projects
None yet
Development

No branches or pull requests

1 participant