summaryrefslogtreecommitdiff
path: root/src/config/ConfigManager.cpp
diff options
context:
space:
mode:
authorJef <54236+ElJeffe@users.noreply.github.com>2022-11-13 20:33:13 +0100
committerGitHub <noreply@github.com>2022-11-13 19:33:13 +0000
commit549fdf63f6f72fadf4e1f67f42fc2a99d625b42e (patch)
treedb06da03842266c024ea8e6d6604630cdd79d8e4 /src/config/ConfigManager.cpp
parent1a14841a75b2c387b9f67b7f7c40e0b5d3e1f86b (diff)
Add bordercolor windowrule (#992)
* Add bordercolor windowrule * remove spaces form bordercolor rule + typo Co-authored-by: Jef Steelant <jef.steelant_ext@softathome.com>
Diffstat (limited to 'src/config/ConfigManager.cpp')
-rw-r--r--src/config/ConfigManager.cpp44
1 files changed, 5 insertions, 39 deletions
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp
index b38dfea5..63227479 100644
--- a/src/config/ConfigManager.cpp
+++ b/src/config/ConfigManager.cpp
@@ -312,45 +312,10 @@ void CConfigManager::configSetValueSafe(const std::string& COMMAND, const std::s
if (CONFIGENTRY->intValue != -INT64_MAX) {
try {
- if (VALUE.find("0x") == 0) {
- // Values with 0x are hex
- const auto VALUEWITHOUTHEX = VALUE.substr(2);
- CONFIGENTRY->intValue = stol(VALUEWITHOUTHEX, nullptr, 16);
- } else if (VALUE.find("rgba(") == 0 && VALUE.find(")") == VALUE.length() - 1) {
- const auto VALUEWITHOUTFUNC = VALUE.substr(5, VALUE.length() - 6);
-
- if (removeBeginEndSpacesTabs(VALUEWITHOUTFUNC).length() != 8) {
- Debug::log(WARN, "invalid length %i for rgba", VALUEWITHOUTFUNC.length());
- parseError = "rgba() expects length of 8 characters (4 bytes)";
- return;
- }
-
- const auto RGBA = std::stol(VALUEWITHOUTFUNC, nullptr, 16);
-
- // now we need to RGBA -> ARGB. The config holds ARGB only.
- CONFIGENTRY->intValue = (RGBA >> 8) + 0x1000000 * (RGBA & 0xFF);
- } else if (VALUE.find("rgb(") == 0 && VALUE.find(")") == VALUE.length() - 1) {
- const auto VALUEWITHOUTFUNC = VALUE.substr(4, VALUE.length() - 5);
-
- if (removeBeginEndSpacesTabs(VALUEWITHOUTFUNC).length() != 6) {
- Debug::log(WARN, "invalid length %i for rgb", VALUEWITHOUTFUNC.length());
- parseError = "rgb() expects length of 6 characters (3 bytes)";
- return;
- }
-
- const auto RGB = std::stol(VALUEWITHOUTFUNC, nullptr, 16);
-
- CONFIGENTRY->intValue = RGB + 0xFF000000; // 0xFF for opaque
- } else if (VALUE.find("true") == 0 || VALUE.find("on") == 0 || VALUE.find("yes") == 0) {
- CONFIGENTRY->intValue = 1;
- } else if (VALUE.find("false") == 0 || VALUE.find("off") == 0 || VALUE.find("no") == 0) {
- CONFIGENTRY->intValue = 0;
- }
- else
- CONFIGENTRY->intValue = stol(VALUE);
- } catch (...) {
+ CONFIGENTRY->intValue = configStringToInt(VALUE);
+ } catch (std::exception& e) {
Debug::log(WARN, "Error reading value of %s", COMMAND.c_str());
- parseError = "Error setting value <" + VALUE + "> for field <" + COMMAND + ">.";
+ parseError = "Error setting value <" + VALUE + "> for field <" + COMMAND + ">. " + e.what();
}
} else if (CONFIGENTRY->floatValue != -__FLT_MAX__) {
try {
@@ -717,7 +682,8 @@ bool windowRuleValid(const std::string& RULE) {
&& RULE != "windowdance"
&& RULE.find("animation") != 0
&& RULE.find("rounding") != 0
- && RULE.find("workspace") != 0);
+ && RULE.find("workspace") != 0
+ && RULE.find("bordercolor") != 0);
}
void CConfigManager::handleWindowRule(const std::string& command, const std::string& value) {