fix: only update if hyprland is done initializing

We check whether the most hz monitor is non-null, as a measure to
whether hyprland is intialized. This is nessecary as plugins loaded with
`plugin =` otherwise cause a ton of weird crashes.
This commit is contained in:
Virt 2024-11-04 20:34:17 +01:00
commit 1ae25556a1
4 changed files with 11 additions and 8 deletions

View file

@ -1,10 +1,17 @@
#include "../globals.hpp"
#include "../cursor.hpp"
#include "src/render/Renderer.hpp"
#include "config.hpp"
#include <hyprland/src/plugins/PluginAPI.hpp>
#include <hyprlang.hpp>
#include <stdexcept>
#include <variant>
bool isEnabled() {
static auto* const* PENABLED = (Hyprlang::INT* const*) getConfig(CONFIG_ENABLED);
return **PENABLED && g_pHyprRenderer->m_pMostHzMonitor && g_pDynamicCursors; // make sure the compositor is properly initialized
}
Hyprlang::CConfigValue toHyprlang(std::variant<std::string, float, int> value) {
if (std::holds_alternative<std::string>(value))