Skip to content

Commit

Permalink
Option to hide non-visible special workspaces
Browse files Browse the repository at this point in the history
  • Loading branch information
alttabber committed Mar 23, 2024
1 parent c0d3b6f commit f3896c0
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/modules/hyprland/workspaces.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ class Workspaces : public AModule, public EventHandler {
auto allOutputs() const -> bool { return m_allOutputs; }
auto showSpecial() const -> bool { return m_showSpecial; }
auto activeOnly() const -> bool { return m_activeOnly; }
auto specialVisibleOnly() const -> bool { return m_specialVisibleOnly; }
auto moveToMonitor() const -> bool { return m_moveToMonitor; }

auto getBarOutput() const -> std::string { return m_bar.output->name; }
Expand Down Expand Up @@ -184,6 +185,7 @@ class Workspaces : public AModule, public EventHandler {
bool m_allOutputs = false;
bool m_showSpecial = false;
bool m_activeOnly = false;
bool m_specialVisibleOnly = false;

Check warning on line 188 in include/modules/hyprland/workspaces.hpp

View workflow job for this annotation

GitHub Actions / build

include/modules/hyprland/workspaces.hpp:188:8 [readability-identifier-naming]

invalid case style for private member 'm_specialVisibleOnly'
bool m_moveToMonitor = false;

Check warning on line 189 in include/modules/hyprland/workspaces.hpp

View workflow job for this annotation

GitHub Actions / build

include/modules/hyprland/workspaces.hpp:189:8 [readability-identifier-naming]

invalid case style for private member 'm_moveToMonitor'
Json::Value m_persistentWorkspaceConfig;

Expand Down
5 changes: 5 additions & 0 deletions man/waybar-hyprland-workspaces.5.scd
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ Addressed by *hyprland/workspaces*
default: false ++
If set to true, special workspaces will be shown.

*special-visible-only*: ++
typeof: bool ++
default: false ++
If this and show-special are to true, special workspaces will be shown only if visible.

*all-outputs*: ++
typeof: bool ++
default: false ++
Expand Down
12 changes: 12 additions & 0 deletions src/modules/hyprland/workspaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ auto Workspaces::parseConfig(const Json::Value &config) -> void {
m_showSpecial = configShowSpecial.asBool();
}

auto configSpecialVisibleOnly = config_["special-visible-only"];
if (configShowSpecial.isBool()) {
m_specialVisibleOnly = configShowSpecial.asBool();
}

auto configActiveOnly = config_["active-only"];
if (configActiveOnly.isBool()) {
m_activeOnly = configActiveOnly.asBool();
Expand Down Expand Up @@ -886,6 +891,13 @@ void Workspace::update(const std::string &format, const std::string &icon) {
m_button.hide();
return;
}
if (this->isSpecial() && \
this->m_workspaceManager.specialVisibleOnly() && \
!this->isVisible()) {
m_button.hide();
return;
}

m_button.show();

auto styleContext = m_button.get_style_context();
Expand Down

0 comments on commit f3896c0

Please sign in to comment.