mirror of
https://github.com/Trensa-Organization/hy3.git
synced 2025-03-15 18:53:40 +01:00
Add hyprland version compatibility check
This commit is contained in:
parent
35e66dd10a
commit
92244e7285
3 changed files with 22 additions and 1 deletions
|
@ -22,6 +22,12 @@ add_library(hy3 SHARED
|
||||||
src/SelectionHook.cpp
|
src/SelectionHook.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
option(HY3_NO_VERSION_CHECK "Disable hyprland version check" FALSE)
|
||||||
|
|
||||||
|
if (HY3_NO_VERSION_CHECK)
|
||||||
|
target_compile_definitions(hy3 PRIVATE -DHY3_NO_VERSION_CHECK=TRUE)
|
||||||
|
endif()
|
||||||
|
|
||||||
target_include_directories(hy3 PRIVATE ${DEPS_INCLUDE_DIRS})
|
target_include_directories(hy3 PRIVATE ${DEPS_INCLUDE_DIRS})
|
||||||
|
|
||||||
install(TARGETS hy3 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
install(TARGETS hy3 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
rm -rf build
|
rm -rf build
|
||||||
cmake -DCMAKE_BUILD_TYPE=Debug -B build
|
|
||||||
bear -- cmake --build build
|
bear -- cmake --build build
|
||||||
|
cmake -DCMAKE_BUILD_TYPE=Debug -DHY3_NO_VERSION_CHECK=TRUE -B build
|
||||||
sed -i 's/-std=gnu++23/-std=gnu++2b/g' compile_commands.json
|
sed -i 's/-std=gnu++23/-std=gnu++2b/g' compile_commands.json
|
||||||
|
|
15
src/main.cpp
15
src/main.cpp
|
@ -1,7 +1,9 @@
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
#include <stdexcept>
|
||||||
|
|
||||||
#include <hyprland/src/Compositor.hpp>
|
#include <hyprland/src/Compositor.hpp>
|
||||||
#include <hyprland/src/plugins/PluginAPI.hpp>
|
#include <hyprland/src/plugins/PluginAPI.hpp>
|
||||||
|
#include <hyprland/src/version.h>
|
||||||
|
|
||||||
#include "SelectionHook.hpp"
|
#include "SelectionHook.hpp"
|
||||||
#include "dispatchers.hpp"
|
#include "dispatchers.hpp"
|
||||||
|
@ -12,6 +14,19 @@ APICALL EXPORT std::string PLUGIN_API_VERSION() { return HYPRLAND_API_VERSION; }
|
||||||
APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
|
APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
|
||||||
PHANDLE = handle;
|
PHANDLE = handle;
|
||||||
|
|
||||||
|
#ifndef HY3_NO_VERSION_CHECK
|
||||||
|
if (GIT_COMMIT_HASH != std::string(__hyprland_api_get_hash())) {
|
||||||
|
HyprlandAPI::addNotification(
|
||||||
|
PHANDLE,
|
||||||
|
"[hy3] Hy3 was compiled for a different version of hyprland; refusing to start.",
|
||||||
|
CColor {1.0, 0.2, 0.2, 1.0},
|
||||||
|
10000
|
||||||
|
);
|
||||||
|
|
||||||
|
throw std::runtime_error("[hy3] target hyprland version mismatch");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
selection_hook::init();
|
selection_hook::init();
|
||||||
|
|
||||||
#define CONF(NAME, TYPE, VALUE) \
|
#define CONF(NAME, TYPE, VALUE) \
|
||||||
|
|
Loading…
Add table
Reference in a new issue