diff --git a/include/modules/hyprland/windowcount.hpp b/include/modules/hyprland/windowcount.hpp index 1b89d1a3..195e6a34 100644 --- a/include/modules/hyprland/windowcount.hpp +++ b/include/modules/hyprland/windowcount.hpp @@ -38,4 +38,4 @@ class WindowCount : public waybar::AAppIconLabel, public EventHandler { Workspace workspace_; }; -} // namespace waybar::modules::hyprland \ No newline at end of file +} // namespace waybar::modules::hyprland diff --git a/src/modules/hyprland/windowcount.cpp b/src/modules/hyprland/windowcount.cpp index 001cdf6c..68f7c3b4 100644 --- a/src/modules/hyprland/windowcount.cpp +++ b/src/modules/hyprland/windowcount.cpp @@ -46,16 +46,19 @@ auto WindowCount::update() -> void { std::lock_guard lg(mutex_); std::string format = config_["format"].asString(); - std::string formatFullscreen = config_["format-fullscreen"].asString(); + std::string formatEmpty = config_["format-empty"].asString(); std::string formatWindowed = config_["format-windowed"].asString(); + std::string formatFullscreen = config_["format-fullscreen"].asString(); setClass("empty", workspace_.windows == 0); setClass("fullscreen", workspace_.hasfullscreen); - if (workspace_.hasfullscreen && !formatFullscreen.empty()) { - label_.set_markup(fmt::format(fmt::runtime(formatFullscreen), workspace_.windows)); + if (workspace_.windows == 0 && !formatEmpty.empty()) { + label_.set_markup(fmt::format(fmt::runtime(formatEmpty), workspace_.windows)); } else if (!workspace_.hasfullscreen && !formatWindowed.empty()) { label_.set_markup(fmt::format(fmt::runtime(formatWindowed), workspace_.windows)); + } else if (workspace_.hasfullscreen && !formatFullscreen.empty()) { + label_.set_markup(fmt::format(fmt::runtime(formatFullscreen), workspace_.windows)); } else if (!format.empty()) { label_.set_markup(fmt::format(fmt::runtime(format), workspace_.windows)); } else { @@ -136,4 +139,4 @@ void WindowCount::setClass(const std::string& classname, bool enable) { } } -} // namespace waybar::modules::hyprland \ No newline at end of file +} // namespace waybar::modules::hyprland