Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions man/waybar-niri-workspaces.5.scd
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ 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.

*hide-empty*: ++
typeof: bool ++
default: false ++
If set to true, workspaces will only be shown if they are nonempty (or focused).

*format*: ++
typeof: string ++
default: {value} ++
Expand Down
3 changes: 3 additions & 0 deletions src/modules/niri/workspaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,13 @@ void Workspaces::doUpdate() {
auto ipcLock = gIPC->lockData();

const auto alloutputs = config_["all-outputs"].asBool();
const auto hide_empty = config_["hide-empty"].asBool();
std::vector<Json::Value> my_workspaces;
const auto& workspaces = gIPC->workspaces();
std::copy_if(workspaces.cbegin(), workspaces.cend(), std::back_inserter(my_workspaces),
[&](const auto& ws) {
if (hide_empty && ws["active_window_id"].isNull() && !ws["is_focused"].asBool())
return false;
if (alloutputs) return true;
return ws["output"].asString() == bar_.output->name;
});
Expand Down