From 4141dfdd1f83571831a8c49b4c4b575bd964dc19 Mon Sep 17 00:00:00 2001 From: Constantin Piber <59023762+cpiber@users.noreply.github.com> Date: Tue, 19 Nov 2024 22:45:50 +0100 Subject: [PATCH] chase https://github.com/hyprwm/Hyprland/commit/67cee4300 (#246) --- borders-plus-plus/main.cpp | 4 ++-- hyprbars/barDeco.cpp | 5 +++-- hyprbars/main.cpp | 11 ++++++++--- hyprtrails/main.cpp | 4 ++-- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/borders-plus-plus/main.cpp b/borders-plus-plus/main.cpp index 40e20c7..c1d18f6 100644 --- a/borders-plus-plus/main.cpp +++ b/borders-plus-plus/main.cpp @@ -37,7 +37,7 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) { HyprlandAPI::addConfigValue(PHANDLE, "plugin:borders-plus-plus:natural_rounding", Hyprlang::INT{1}); for (size_t i = 0; i < 9; ++i) { - HyprlandAPI::addConfigValue(PHANDLE, "plugin:borders-plus-plus:col.border_" + std::to_string(i + 1), Hyprlang::INT{configStringToInt("rgba(000000ee)")}); + HyprlandAPI::addConfigValue(PHANDLE, "plugin:borders-plus-plus:col.border_" + std::to_string(i + 1), Hyprlang::INT{*configStringToInt("rgba(000000ee)")}); HyprlandAPI::addConfigValue(PHANDLE, "plugin:borders-plus-plus:border_size_" + std::to_string(i + 1), Hyprlang::INT{-1}); } @@ -60,4 +60,4 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) { APICALL EXPORT void PLUGIN_EXIT() { ; -} \ No newline at end of file +} diff --git a/hyprbars/barDeco.cpp b/hyprbars/barDeco.cpp index ce44ba5..76e4d26 100644 --- a/hyprbars/barDeco.cpp +++ b/hyprbars/barDeco.cpp @@ -2,6 +2,7 @@ #include #include +#include #include #include "globals.hpp" @@ -567,7 +568,7 @@ void CHyprBar::applyRule(const SWindowRule& r) { if (r.szRule == "plugin:hyprbars:nobar") m_bHidden = true; else if (r.szRule.starts_with("plugin:hyprbars:bar_color")) - m_bForcedBarColor = CColor(configStringToInt(arg)); + m_bForcedBarColor = CColor(configStringToInt(arg).value_or(0)); else if (r.szRule.starts_with("plugin:hyprbars:title_color")) - m_bForcedTitleColor = CColor(configStringToInt(arg)); + m_bForcedTitleColor = CColor(configStringToInt(arg).value_or(0)); } diff --git a/hyprbars/main.cpp b/hyprbars/main.cpp index 7d58476..c322dd2 100644 --- a/hyprbars/main.cpp +++ b/hyprbars/main.cpp @@ -74,7 +74,12 @@ Hyprlang::CParseResult onNewButton(const char* K, const char* V) { return result; } - g_pGlobalState->buttons.push_back(SHyprButton{vars[3], configStringToInt(vars[0]), size, vars[2]}); + auto X = configStringToInt(vars[0]); + if (!X) { + result.setError("var2 is not a valid number"); + return result; + } + g_pGlobalState->buttons.push_back(SHyprButton{vars[3], *X, size, vars[2]}); for (auto& b : g_pGlobalState->bars) { b->m_bButtonsDirty = true; @@ -101,9 +106,9 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) { static auto P3 = HyprlandAPI::registerCallbackDynamic(PHANDLE, "windowUpdateRules", [&](void* self, SCallbackInfo& info, std::any data) { onUpdateWindowRules(std::any_cast(data)); }); - HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprbars:bar_color", Hyprlang::INT{configStringToInt("rgba(33333388)")}); + HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprbars:bar_color", Hyprlang::INT{*configStringToInt("rgba(33333388)")}); HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprbars:bar_height", Hyprlang::INT{15}); - HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprbars:col.text", Hyprlang::INT{configStringToInt("rgba(ffffffff)")}); + HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprbars:col.text", Hyprlang::INT{*configStringToInt("rgba(ffffffff)")}); HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprbars:bar_text_size", Hyprlang::INT{10}); HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprbars:bar_title_enabled", Hyprlang::INT{1}); HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprbars:bar_text_font", Hyprlang::STRING{"Sans"}); diff --git a/hyprtrails/main.cpp b/hyprtrails/main.cpp index d07269b..2d6f4b9 100644 --- a/hyprtrails/main.cpp +++ b/hyprtrails/main.cpp @@ -111,7 +111,7 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) { HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprtrails:points_per_step", Hyprlang::INT{2}); HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprtrails:history_points", Hyprlang::INT{20}); HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprtrails:history_step", Hyprlang::INT{2}); - HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprtrails:color", Hyprlang::INT{configStringToInt("rgba(ffaa00ff)")}); + HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprtrails:color", Hyprlang::INT{*configStringToInt("rgba(ffaa00ff)")}); static auto P = HyprlandAPI::registerCallbackDynamic(PHANDLE, "openWindow", [&](void* self, SCallbackInfo& info, std::any data) { onNewWindow(self, data); }); @@ -135,4 +135,4 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) { APICALL EXPORT void PLUGIN_EXIT() { wl_event_source_remove(g_pGlobalState->tick); -} \ No newline at end of file +}