From b225987d6c3b0b962f8bc67164966c6fdc9b3f74 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Mon, 27 Nov 2023 11:08:24 +0000 Subject: [PATCH] hyprwinwrap: check for header ver match --- hyprwinwrap/main.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hyprwinwrap/main.cpp b/hyprwinwrap/main.cpp index 236d6bf..8d6926a 100644 --- a/hyprwinwrap/main.cpp +++ b/hyprwinwrap/main.cpp @@ -123,6 +123,14 @@ void onConfigReloaded() { APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) { PHANDLE = handle; + const std::string HASH = __hyprland_api_get_hash(); + + if (HASH != GIT_COMMIT_HASH) { + HyprlandAPI::addNotification(PHANDLE, "[hyprwinwrap] Failure in initialization: Version mismatch (headers ver is not equal to running hyprland ver)", + CColor{1.0, 0.2, 0.2, 1.0}, 5000); + throw std::runtime_error("[hww] Version mismatch"); + } + HyprlandAPI::registerCallbackDynamic(PHANDLE, "openWindow", [&](void* self, SCallbackInfo& info, std::any data) { onNewWindow(std::any_cast(data)); }); HyprlandAPI::registerCallbackDynamic(PHANDLE, "closeWindow", [&](void* self, SCallbackInfo& info, std::any data) { onCloseWindow(std::any_cast(data)); }); HyprlandAPI::registerCallbackDynamic(PHANDLE, "render", [&](void* self, SCallbackInfo& info, std::any data) { onRenderStage(std::any_cast(data)); });