all: chase hyprland

This commit is contained in:
Vaxry 2025-10-23 20:54:45 +01:00
parent f1b4524442
commit 81f6d14265
No known key found for this signature in database
GPG Key ID: 665806380871D640
9 changed files with 86 additions and 72 deletions

View File

@ -27,8 +27,9 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
PHANDLE = handle;
const std::string HASH = __hyprland_api_get_hash();
const std::string CLIENT_HASH = __hyprland_api_get_client_hash();
if (HASH != GIT_COMMIT_HASH) {
if (HASH != CLIENT_HASH) {
HyprlandAPI::addNotification(PHANDLE, "[borders-plus-plus] Failure in initialization: Version mismatch (headers ver is not equal to running hyprland ver)",
CHyprColor{1.0, 0.2, 0.2, 1.0}, 5000);
throw std::runtime_error("[bpp] Version mismatch");

View File

@ -107,8 +107,9 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
PHANDLE = handle;
const std::string HASH = __hyprland_api_get_hash();
const std::string CLIENT_HASH = __hyprland_api_get_client_hash();
if (HASH != GIT_COMMIT_HASH) {
if (HASH != CLIENT_HASH) {
HyprlandAPI::addNotification(PHANDLE, "[csgo-vulkan-fix] Failure in initialization: Version mismatch (headers ver is not equal to running hyprland ver)",
CHyprColor{1.0, 0.2, 0.2, 1.0}, 5000);
throw std::runtime_error("[vkfix] Version mismatch");
@ -129,7 +130,9 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
g_appConfigs.emplace_back(SAppConfig{.szClass = *PCLASS, .res = Vector2D{(int)**RESX, (int)**RESY}});
});
HyprlandAPI::addConfigKeyword(PHANDLE, "vkfix-app", [](const char* l, const char* r) -> Hyprlang::CParseResult {
HyprlandAPI::addConfigKeyword(
PHANDLE, "vkfix-app",
[](const char* l, const char* r) -> Hyprlang::CParseResult {
const std::string str = r;
CConstVarList data(str, 0, ',', true);
@ -151,7 +154,8 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
}
return result;
}, Hyprlang::SHandlerOptions{});
},
Hyprlang::SHandlerOptions{});
auto FNS = HyprlandAPI::findFunctionsByName(PHANDLE, "sendPointerMotion");
for (auto& fn : FNS) {

View File

@ -113,8 +113,9 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
PHANDLE = handle;
const std::string HASH = __hyprland_api_get_hash();
const std::string CLIENT_HASH = __hyprland_api_get_client_hash();
if (HASH != GIT_COMMIT_HASH) {
if (HASH != CLIENT_HASH) {
HyprlandAPI::addNotification(PHANDLE, "[hyprbars] Failure in initialization: Version mismatch (headers ver is not equal to running hyprland ver)",
CHyprColor{1.0, 0.2, 0.2, 1.0}, 5000);
throw std::runtime_error("[hb] Version mismatch");

View File

@ -183,8 +183,9 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
PHANDLE = handle;
const std::string HASH = __hyprland_api_get_hash();
const std::string CLIENT_HASH = __hyprland_api_get_client_hash();
if (HASH != GIT_COMMIT_HASH) {
if (HASH != CLIENT_HASH) {
failNotif("Version mismatch (headers ver is not equal to running hyprland ver)");
throw std::runtime_error("[he] Version mismatch");
}

View File

@ -111,8 +111,9 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
PHANDLE = handle;
const std::string HASH = __hyprland_api_get_hash();
const std::string CLIENT_HASH = __hyprland_api_get_client_hash();
if (HASH != GIT_COMMIT_HASH) {
if (HASH != CLIENT_HASH) {
HyprlandAPI::addNotification(PHANDLE, "[hyprwinwrap] Failure in initialization: Version mismatch (headers ver is not equal to running hyprland ver)",
CHyprColor{1.0, 0.2, 0.2, 1.0}, 5000);
throw std::runtime_error("[hww] Version mismatch");

View File

@ -32,8 +32,9 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
PHANDLE = handle;
const std::string HASH = __hyprland_api_get_hash();
const std::string CLIENT_HASH = __hyprland_api_get_client_hash();
if (HASH != GIT_COMMIT_HASH) {
if (HASH != CLIENT_HASH) {
HyprlandAPI::addNotification(PHANDLE, "[hyprscrolling] Failure in initialization: Version mismatch (headers ver is not equal to running hyprland ver)",
CHyprColor{1.0, 0.2, 0.2, 1.0}, 5000);
throw std::runtime_error("[hs] Version mismatch");
@ -50,7 +51,8 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprscrolling:explicit_column_widths", Hyprlang::STRING{"0.333, 0.5, 0.667, 1.0"});
HyprlandAPI::addLayout(PHANDLE, "scrolling", g_pScrollingLayout.get());
if (success) HyprlandAPI::addNotification(PHANDLE, "[hyprscrolling] Initialized successfully!", CHyprColor{0.2, 1.0, 0.2, 1.0}, 5000);
if (success)
HyprlandAPI::addNotification(PHANDLE, "[hyprscrolling] Initialized successfully!", CHyprColor{0.2, 1.0, 0.2, 1.0}, 5000);
else {
HyprlandAPI::addNotification(PHANDLE, "[hyprscrolling] Failure in initialization: failed to register dispatchers", CHyprColor{1.0, 0.2, 0.2, 1.0}, 5000);
throw std::runtime_error("[hs] Dispatchers failed");

View File

@ -101,8 +101,9 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
PHANDLE = handle;
const std::string HASH = __hyprland_api_get_hash();
const std::string CLIENT_HASH = __hyprland_api_get_client_hash();
if (HASH != GIT_COMMIT_HASH) {
if (HASH != CLIENT_HASH) {
HyprlandAPI::addNotification(PHANDLE, "[ht] Failure in initialization: Version mismatch (headers ver is not equal to running hyprland ver)", CHyprColor{1.0, 0.2, 0.2, 1.0},
5000);
throw std::runtime_error("[ht] Version mismatch");

View File

@ -59,10 +59,18 @@ void onNewWindow(PHLWINDOW pWindow) {
float sx = 100.f, sy = 100.f, px = 0.f, py = 0.f;
try { sx = std::stof(*PSIZEX); } catch (...) {}
try { sy = std::stof(*PSIZEY); } catch (...) {}
try { px = std::stof(*PPOSX); } catch (...) {}
try { py = std::stof(*PPOSY); } catch (...) {}
try {
sx = std::stof(*PSIZEX);
} catch (...) {}
try {
sy = std::stof(*PSIZEY);
} catch (...) {}
try {
px = std::stof(*PPOSX);
} catch (...) {}
try {
py = std::stof(*PPOSY);
} catch (...) {}
sx = std::clamp(sx, 1.f, 100.f);
sy = std::clamp(sy, 1.f, 100.f);
@ -81,15 +89,9 @@ void onNewWindow(PHLWINDOW pWindow) {
const Vector2D monitorSize = PMONITOR->m_size;
const Vector2D monitorPos = PMONITOR->m_position;
const Vector2D newSize = {
static_cast<int>(monitorSize.x * (sx / 100.f)),
static_cast<int>(monitorSize.y * (sy / 100.f))
};
const Vector2D newSize = {static_cast<int>(monitorSize.x * (sx / 100.f)), static_cast<int>(monitorSize.y * (sy / 100.f))};
const Vector2D newPos = {
static_cast<int>(monitorPos.x + (monitorSize.x * (px / 100.f))),
static_cast<int>(monitorPos.y + (monitorSize.y * (py / 100.f)))
};
const Vector2D newPos = {static_cast<int>(monitorPos.x + (monitorSize.x * (px / 100.f))), static_cast<int>(monitorPos.y + (monitorSize.y * (py / 100.f)))};
pWindow->m_realSize->setValueAndWarp(newSize);
pWindow->m_realPosition->setValueAndWarp(newPos);
@ -186,8 +188,9 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
PHANDLE = handle;
const std::string HASH = __hyprland_api_get_hash();
const std::string CLIENT_HASH = __hyprland_api_get_client_hash();
if (HASH != GIT_COMMIT_HASH) {
if (HASH != CLIENT_HASH) {
HyprlandAPI::addNotification(PHANDLE, "[hyprwinwrap] Failure in initialization: Version mismatch (headers ver is not equal to running hyprland ver)",
CHyprColor{1.0, 0.2, 0.2, 1.0}, 5000);
throw std::runtime_error("[hww] Version mismatch");
@ -236,4 +239,3 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
APICALL EXPORT void PLUGIN_EXIT() {
;
}

View File

@ -117,8 +117,9 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
PHANDLE = handle;
const std::string HASH = __hyprland_api_get_hash();
const std::string CLIENT_HASH = __hyprland_api_get_client_hash();
if (HASH != GIT_COMMIT_HASH) {
if (HASH != CLIENT_HASH) {
HyprlandAPI::addNotification(PHANDLE, "[xtra-dispatchers] Failure in initialization: Version mismatch (headers ver is not equal to running hyprland ver)",
CHyprColor{1.0, 0.2, 0.2, 1.0}, 5000);
throw std::runtime_error("[xtd] Version mismatch");