mirror of
https://github.com/hyprwm/hyprland-wiki.git
synced 2026-01-03 10:30:14 +01:00
Updated plugin hash checking (#1262)
This is needed for hyprwm/Hyprland#12110
This commit is contained in:
parent
5319c65de2
commit
af6c5f39e1
1 changed files with 3 additions and 2 deletions
|
|
@ -79,11 +79,12 @@ Skipping over some example handlers, we have two important functions:
|
|||
APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
|
||||
PHANDLE = handle;
|
||||
|
||||
const std::string HASH = __hyprland_api_get_hash();
|
||||
const std::string COMPOSITOR_HASH = __hyprland_api_get_hash();
|
||||
const std::string CLIENT_HASH = __hyprland_api_get_client_hash();
|
||||
|
||||
// ALWAYS add this to your plugins. It will prevent random crashes coming from
|
||||
// mismatched header versions.
|
||||
if (HASH != GIT_COMMIT_HASH) {
|
||||
if (COMPOSITOR_HASH != CLIENT_HASH) {
|
||||
HyprlandAPI::addNotification(PHANDLE, "[MyPlugin] Mismatched headers! Can't proceed.",
|
||||
CHyprColor{1.0, 0.2, 0.2, 1.0}, 5000);
|
||||
throw std::runtime_error("[MyPlugin] Version mismatch");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue