hyprland/workspaces: fix crash on monitor off/on

This commit is contained in:
André Silva 2023-11-01 22:04:19 +00:00
parent 22dc87934a
commit 8555456050
No known key found for this signature in database
GPG Key ID: 7C34FA12A023DC55
1 changed files with 5 additions and 7 deletions

View File

@ -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<IPC>();
}
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<IPC>();
}
gIPC->registerForIPC("workspace", this);
gIPC->registerForIPC("createworkspace", this);
gIPC->registerForIPC("destroyworkspace", this);