Hyprland IPC improvements, fix tsan warning, WindowCount shouldn't create a separate IPC

This commit is contained in:
zjeffer
2025-08-12 19:39:36 +02:00
parent 41de8964f1
commit 5079884b78
8 changed files with 38 additions and 46 deletions

View File

@ -17,9 +17,13 @@ class EventHandler {
virtual ~EventHandler() = default;
};
/// If you want to use the Hyprland IPC, simply use IPC::inst() to get the singleton instance.
/// Do not create multiple instances.
class IPC {
protected:
IPC(); // use IPC::inst() instead.
public:
IPC();
~IPC();
static IPC& inst();
@ -41,10 +45,7 @@ class IPC {
std::mutex callbackMutex_;
util::JsonParser parser_;
std::list<std::pair<std::string, EventHandler*>> callbacks_;
int socketfd_; // the hyprland socket file descriptor
bool running_ = true;
int socketfd_; // the hyprland socket file descriptor
bool running_ = true; // the ipcThread will stop running when this is false
};
inline bool modulesReady = false;
inline std::unique_ptr<IPC> gIPC;
}; // namespace waybar::modules::hyprland