Merge pull request #4133 from Roc25/persistent-only

Add persistent-only setting for hyprland/workspaces
This commit is contained in:
Alexis Rouillard
2025-06-22 08:50:33 +01:00
committed by GitHub
4 changed files with 12 additions and 0 deletions

View File

@ -37,6 +37,7 @@ class Workspaces : public AModule, public EventHandler {
auto showSpecial() const -> bool { return m_showSpecial; } auto showSpecial() const -> bool { return m_showSpecial; }
auto activeOnly() const -> bool { return m_activeOnly; } auto activeOnly() const -> bool { return m_activeOnly; }
auto specialVisibleOnly() const -> bool { return m_specialVisibleOnly; } auto specialVisibleOnly() const -> bool { return m_specialVisibleOnly; }
auto persistentOnly() const -> bool { return m_persistentOnly; }
auto moveToMonitor() const -> bool { return m_moveToMonitor; } auto moveToMonitor() const -> bool { return m_moveToMonitor; }
auto getBarOutput() const -> std::string { return m_bar.output->name; } auto getBarOutput() const -> std::string { return m_bar.output->name; }
@ -122,6 +123,7 @@ class Workspaces : public AModule, public EventHandler {
bool m_showSpecial = false; bool m_showSpecial = false;
bool m_activeOnly = false; bool m_activeOnly = false;
bool m_specialVisibleOnly = false; bool m_specialVisibleOnly = false;
bool m_persistentOnly = false;
bool m_moveToMonitor = false; bool m_moveToMonitor = false;
Json::Value m_persistentWorkspaceConfig; Json::Value m_persistentWorkspaceConfig;

View File

@ -48,6 +48,11 @@ Addressed by *hyprland/workspaces*
default: false ++ default: false ++
If this and show-special are to true, special workspaces will be shown only if visible. If this and show-special are to true, special workspaces will be shown only if visible.
*persistent-only*: ++
typeof: bool ++
default: false ++
If set to true, only persistent workspaces will be shown on bar.
*all-outputs*: ++ *all-outputs*: ++
typeof: bool ++ typeof: bool ++
default: false ++ default: false ++

View File

@ -173,6 +173,10 @@ std::string &Workspace::selectIcon(std::map<std::string, std::string> &icons_map
} }
void Workspace::update(const std::string &format, const std::string &icon) { void Workspace::update(const std::string &format, const std::string &icon) {
if (this->m_workspaceManager.persistentOnly() && !this->isPersistent()) {
m_button.hide();
return;
}
// clang-format off // clang-format off
if (this->m_workspaceManager.activeOnly() && \ if (this->m_workspaceManager.activeOnly() && \
!this->isActive() && \ !this->isActive() && \

View File

@ -600,6 +600,7 @@ auto Workspaces::parseConfig(const Json::Value &config) -> void {
populateBoolConfig(config, "all-outputs", m_allOutputs); populateBoolConfig(config, "all-outputs", m_allOutputs);
populateBoolConfig(config, "show-special", m_showSpecial); populateBoolConfig(config, "show-special", m_showSpecial);
populateBoolConfig(config, "special-visible-only", m_specialVisibleOnly); populateBoolConfig(config, "special-visible-only", m_specialVisibleOnly);
populateBoolConfig(config, "persistent-only", m_persistentOnly);
populateBoolConfig(config, "active-only", m_activeOnly); populateBoolConfig(config, "active-only", m_activeOnly);
populateBoolConfig(config, "move-to-monitor", m_moveToMonitor); populateBoolConfig(config, "move-to-monitor", m_moveToMonitor);