From f7b9d8c1238db93325ed1f50681fbc3f9a98ccc9 Mon Sep 17 00:00:00 2001 From: Zuodong Yu Date: Sun, 7 Jun 2026 17:35:37 +0800 Subject: [PATCH] modules/niri: add {total} format token to workspaces --- man/waybar-niri-workspaces.5.scd | 2 ++ src/modules/niri/workspaces.cpp | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/man/waybar-niri-workspaces.5.scd b/man/waybar-niri-workspaces.5.scd index 4be85eb3..80cc7eb5 100644 --- a/man/waybar-niri-workspaces.5.scd +++ b/man/waybar-niri-workspaces.5.scd @@ -63,6 +63,8 @@ as defined by niri. *{output}*: Output where the workspace is located. +*{total}*: The total number of workspaces. + # ICONS Additional to workspace name matching, the following *format-icons* can be set. diff --git a/src/modules/niri/workspaces.cpp b/src/modules/niri/workspaces.cpp index 97d15215..ce0d2376 100644 --- a/src/modules/niri/workspaces.cpp +++ b/src/modules/niri/workspaces.cpp @@ -100,7 +100,8 @@ void Workspaces::doUpdate() { name = fmt::format(fmt::runtime(format), fmt::arg("icon", getIcon(name, ws)), fmt::arg("value", name), fmt::arg("name", ws["name"].asString()), fmt::arg("index", ws["idx"].asUInt()), - fmt::arg("output", ws["output"].asString())); + fmt::arg("output", ws["output"].asString()), + fmt::arg("total", my_workspaces.size())); } if (!config_["disable-markup"].asBool()) { static_cast(button.get_children()[0])->set_markup(name);