summaryrefslogtreecommitdiff
path: root/src/config/ConfigManager.cpp
diff options
context:
space:
mode:
authorVaxry <43317083+vaxerski@users.noreply.github.com>2024-06-11 17:17:45 +0200
committerGitHub <noreply@github.com>2024-06-11 17:17:45 +0200
commit8c64a4bad710fb18e9b84812bd680a89d1e93661 (patch)
tree2439b8408abd8e14f6af35ef9cfbeb7c51429f99 /src/config/ConfigManager.cpp
parent1f46296ea05f9a8e6020ab694b531c91a1abdfa6 (diff)
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 <mihai@fufexan.net>
Diffstat (limited to 'src/config/ConfigManager.cpp')
-rw-r--r--src/config/ConfigManager.cpp22
1 files changed, 12 insertions, 10 deletions
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 <cstdint>
@@ -13,6 +13,7 @@
#include <sys/types.h>
#include <unistd.h>
#include <glob.h>
+#include <xkbcommon/xkbcommon.h>
#include <algorithm>
#include <fstream>
@@ -20,7 +21,8 @@
#include <sstream>
#include <ranges>
#include <unordered_set>
-#include <xkbcommon/xkbcommon.h>
+#include <hyprutils/string/String.hpp>
+using namespace Hyprutils::String;
extern "C" char** environ;
@@ -2087,8 +2089,8 @@ bool layerRuleValid(const std::string& RULE) {
}
std::optional<std::string> 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<std::string> CConfigManager::handleWindowRule(const std::string& c
}
std::optional<std::string> 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<std::string> CConfigManager::handleLayerRule(const std::string& co
}
std::optional<std::string> 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<std::string> 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<std::string> 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<std::string> 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);