feat(niri/workspaces): add window icons via window-rewrite

Adds format-window-separator, window-rewrite and window-rewrite-default
options plus the {windows} format replacement to the niri/workspaces
module (rebased onto master; coexists with ignore-workspaces).
This commit is contained in:
Abhijeet
2026-07-04 01:42:23 +02:00
committed by Alexays
parent 7ffee464b3
commit 9e10a9aec9
4 changed files with 211 additions and 12 deletions
+36 -11
View File
@@ -97,6 +97,21 @@ If none of the sorting options are enabled, workspaces keep their output/index o
default: [] ++
Regexes to match against workspaces names and index's. If there's a match, the workspace will not be shown.
*format-window-separator*: ++
typeof: string ++
default: " " ++
Separator used between window representations generated by *window-rewrite*.
*window-rewrite*: ++
typeof: object ++
default: {} ++
Rules to map window app_id and/or title to a specific string representation (e.g., an icon). Keys are regular expressions matching `app_id<regex>` and/or `title<regex>`. Values are the replacement strings, which can contain `{app_id}` and `{title}` placeholders.
*window-rewrite-default*: ++
typeof: string ++
default: "?" ++
The default representation for windows that don't match any rule in *window-rewrite*.
# FORMAT REPLACEMENTS
*{value}*: Name of the workspace, or index for unnamed workspaces,
@@ -112,6 +127,8 @@ as defined by niri.
*{total}*: The total number of workspaces.
*{windows}*: Concatenated representation of windows in the workspace, using *window-rewrite* rules and *format-window-separator*.
# ICONS
Additional to workspace name matching, the following *format-icons* can be set.
@@ -126,18 +143,26 @@ Additional to workspace name matching, the following *format-icons* can be set.
```
"niri/workspaces": {
"format": "{icon}",
"format-icons": {
// Named workspaces
// (you need to configure them in niri)
"browser": "",
"discord": "",
"chat": "<b></b>",
"format": "{icon} {windows}",
"format-window-separator": "|",
"window-rewrite-default": "",
"window-rewrite": {
"app_id<firefox>": "",
"app_id<foot>": "",
"app_id<org.gnome.Nautilus> title<.*Downloads.*>": "",
"app_id<org.gnome.Nautilus>": ""
},
"format-icons": {
// Named workspaces
// (you need to configure them in niri)
"browser": "",
"discord": "",
"chat": "<b></b>",
// Icons by state
"active": "",
"default": ""
}
// Icons by state
"active": "",
"default": ""
}
}
```