Tray::update() already had logic to hide the module when all child items were passive, but it was only re-run on item add/remove — never on a status change. When the last visible item transitioned to Passive, the item hid itself but the now-empty module remained visible. Connect Tray to each item's Gtk::EventBox signal_show/signal_hide so update() runs on every visibility transition, and simplify update() to check child->get_visible() directly instead of inspecting the `passive` CSS class. The Tray-level `show-passive-items` read becomes redundant since Item already honours it when deciding its own visibility; remove it along with the now-unused Tray::show_passive_ member. Fixes: #3721
30 lines
627 B
C++
30 lines
627 B
C++
#pragma once
|
|
|
|
#include <fmt/format.h>
|
|
|
|
#include "AModule.hpp"
|
|
#include "bar.hpp"
|
|
#include "modules/sni/host.hpp"
|
|
#include "modules/sni/watcher.hpp"
|
|
#include "util/json.hpp"
|
|
|
|
namespace waybar::modules::SNI {
|
|
|
|
class Tray : public AModule {
|
|
public:
|
|
Tray(const std::string&, const Bar&, const Json::Value&);
|
|
virtual ~Tray() = default;
|
|
auto update() -> void override;
|
|
|
|
private:
|
|
void onAdd(std::unique_ptr<Item>& item);
|
|
void onRemove(std::unique_ptr<Item>& item);
|
|
|
|
static inline std::size_t nb_hosts_ = 0;
|
|
Gtk::Box box_;
|
|
SNI::Watcher::singleton watcher_;
|
|
SNI::Host host_;
|
|
};
|
|
|
|
} // namespace waybar::modules::SNI
|