From 8c64a4bad710fb18e9b84812bd680a89d1e93661 Mon Sep 17 00:00:00 2001 From: Vaxry <43317083+vaxerski@users.noreply.github.com> Date: Tue, 11 Jun 2024 17:17:45 +0200 Subject: core: move to hyprutils for utils (#6385) * core: move to hyprutils for utils Nix: add hyprutils dep * Meson: add hyprutils dep * flake.lock: update --------- Co-authored-by: Mihai Fufezan --- src/config/ConfigManager.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'src/config/ConfigManager.cpp') diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index e10522d9..6bb24e46 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -3,7 +3,7 @@ #include "../render/decorations/CHyprGroupBarDecoration.hpp" #include "config/ConfigDataValues.hpp" -#include "helpers/VarList.hpp" +#include "helpers/varlist/VarList.hpp" #include "../protocols/LayerShell.hpp" #include @@ -13,6 +13,7 @@ #include #include #include +#include #include #include @@ -20,7 +21,8 @@ #include #include #include -#include +#include +using namespace Hyprutils::String; extern "C" char** environ; @@ -2087,8 +2089,8 @@ bool layerRuleValid(const std::string& RULE) { } std::optional CConfigManager::handleWindowRule(const std::string& command, const std::string& value) { - const auto RULE = removeBeginEndSpacesTabs(value.substr(0, value.find_first_of(','))); - const auto VALUE = removeBeginEndSpacesTabs(value.substr(value.find_first_of(',') + 1)); + const auto RULE = trim(value.substr(0, value.find_first_of(','))); + const auto VALUE = trim(value.substr(value.find_first_of(',') + 1)); // check rule and value if (RULE.empty() || VALUE.empty()) @@ -2114,8 +2116,8 @@ std::optional CConfigManager::handleWindowRule(const std::string& c } std::optional CConfigManager::handleLayerRule(const std::string& command, const std::string& value) { - const auto RULE = removeBeginEndSpacesTabs(value.substr(0, value.find_first_of(','))); - const auto VALUE = removeBeginEndSpacesTabs(value.substr(value.find_first_of(',') + 1)); + const auto RULE = trim(value.substr(0, value.find_first_of(','))); + const auto VALUE = trim(value.substr(value.find_first_of(',') + 1)); // check rule and value if (RULE.empty() || VALUE.empty()) @@ -2142,7 +2144,7 @@ std::optional CConfigManager::handleLayerRule(const std::string& co } std::optional CConfigManager::handleWindowRuleV2(const std::string& command, const std::string& value) { - const auto RULE = removeBeginEndSpacesTabs(value.substr(0, value.find_first_of(','))); + const auto RULE = trim(value.substr(0, value.find_first_of(','))); const auto VALUE = value.substr(value.find_first_of(',') + 1); if (!windowRuleValid(RULE) && RULE != "unset") { @@ -2219,7 +2221,7 @@ std::optional CConfigManager::handleWindowRuleV2(const std::string& result = result.substr(0, min - pos); - result = removeBeginEndSpacesTabs(result); + result = trim(result); if (!result.empty() && result.back() == ',') result.pop_back(); @@ -2341,7 +2343,7 @@ void CConfigManager::updateBlurredLS(const std::string& name, const bool forceBl std::optional CConfigManager::handleBlurLS(const std::string& command, const std::string& value) { if (value.starts_with("remove,")) { - const auto TOREMOVE = removeBeginEndSpacesTabs(value.substr(7)); + const auto TOREMOVE = trim(value.substr(7)); if (std::erase_if(m_dBlurLSNamespaces, [&](const auto& other) { return other == TOREMOVE; })) updateBlurredLS(TOREMOVE, false); return {}; @@ -2358,7 +2360,7 @@ std::optional CConfigManager::handleWorkspaceRules(const std::strin const auto FIRST_DELIM = value.find_first_of(','); std::string name = ""; - auto first_ident = removeBeginEndSpacesTabs(value.substr(0, FIRST_DELIM)); + auto first_ident = trim(value.substr(0, FIRST_DELIM)); int id = getWorkspaceIDFromString(first_ident, name); auto rules = value.substr(FIRST_DELIM + 1); -- cgit v1.2.3