From 8555456050d93a2e77d2315f0f120e155668f3c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Silva?= Date: Wed, 1 Nov 2023 22:04:19 +0000 Subject: [PATCH] hyprland/workspaces: fix crash on monitor off/on --- src/modules/hyprland/workspaces.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/modules/hyprland/workspaces.cpp b/src/modules/hyprland/workspaces.cpp index e2b3da50..91b6242e 100644 --- a/src/modules/hyprland/workspaces.cpp +++ b/src/modules/hyprland/workspaces.cpp @@ -38,6 +38,7 @@ Workspaces::Workspaces(const std::string &id, const Bar &bar, const Json::Value : AModule(config, "workspaces", id, false, false), bar_(bar), box_(bar.vertical ? Gtk::ORIENTATION_VERTICAL : Gtk::ORIENTATION_HORIZONTAL, 0) { + modulesReady = true; parse_config(config); box_.set_name("workspaces"); @@ -46,9 +47,12 @@ Workspaces::Workspaces(const std::string &id, const Bar &bar, const Json::Value } event_box_.add(box_); - register_ipc(); + if (!gIPC.get()) { + gIPC = std::make_unique(); + } init(); + register_ipc(); } auto Workspaces::parse_config(const Json::Value &config) -> void { @@ -127,12 +131,6 @@ auto Workspaces::parse_config(const Json::Value &config) -> void { } auto Workspaces::register_ipc() -> void { - modulesReady = true; - - if (!gIPC) { - gIPC = std::make_unique(); - } - gIPC->registerForIPC("workspace", this); gIPC->registerForIPC("createworkspace", this); gIPC->registerForIPC("destroyworkspace", this);