Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add 'hide-empty' option to niri workspaces module #3906

Closed
wants to merge 1 commit into from
Closed
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 @@ -41,6 +41,11 @@ Addressed by *niri/workspaces*
default: false ++
If set to true, only the active or focused workspace will be shown.

*hide-empty*: ++
typeof: bool ++
default: false ++
If set to true, empty workspaces will be hidden.

*on-update*: ++
typeof: string ++
Command to execute when the module is updated.
Expand Down
7 changes: 5 additions & 2 deletions src/modules/niri/workspaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,17 @@ void Workspaces::doUpdate() {
button.set_label(name);
}

const auto *property = alloutputs ? "is_focused" : "is_active";
if (config_["current-only"].asBool()) {
const auto *property = alloutputs ? "is_focused" : "is_active";
if (ws[property].asBool())
button.show();
else
button.hide();
} else {
button.show();
if (config_["hide-empty"].asBool() && !ws[property].asBool() && ws["active_window_id"].isNull())
button.hide();
else
button.show();
}
}

Expand Down
Loading