-
-
Notifications
You must be signed in to change notification settings - Fork 994
Description
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.