From ea10c8fe65257d6d392388b1eda93b6bf2876361 Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Sat, 21 Dec 2024 14:48:43 +0100 Subject: [PATCH] niri/workspaces: Allow restricting the module to an output To be able to show the workspaces for a given output only, which may be different from the output the bar is displayed on, allow restricting the niri/workspaces module to a single output. The default - when the `output` option is unset - remains the same as before. Signed-off-by: Gergely Nagy --- man/waybar-niri-workspaces.5.scd | 4 ++++ src/modules/niri/workspaces.cpp | 2 ++ 2 files changed, 6 insertions(+) diff --git a/man/waybar-niri-workspaces.5.scd b/man/waybar-niri-workspaces.5.scd index 0c0249ca3..d9e4c1850 100644 --- a/man/waybar-niri-workspaces.5.scd +++ b/man/waybar-niri-workspaces.5.scd @@ -17,6 +17,10 @@ Addressed by *niri/workspaces* default: false ++ If set to false, workspaces will only be shown on the output they are on. If set to true all workspaces will be shown on every output. +*output*: ++ + typeof: string ++ + If set, only show workspaces for the output set. + *format*: ++ typeof: string ++ default: {value} ++ diff --git a/src/modules/niri/workspaces.cpp b/src/modules/niri/workspaces.cpp index d2fcad5d9..9d10f7aef 100644 --- a/src/modules/niri/workspaces.cpp +++ b/src/modules/niri/workspaces.cpp @@ -37,6 +37,8 @@ void Workspaces::doUpdate() { std::copy_if(workspaces.cbegin(), workspaces.cend(), std::back_inserter(my_workspaces), [&](const auto &ws) { if (alloutputs) return true; + if (config_["output"].isString()) + return config_["output"].asString() == ws["output"].asString(); return ws["output"].asString() == bar_.output->name; });