diff options
| author | Vaxry <43317083+vaxerski@users.noreply.github.com> | 2022-08-19 22:39:50 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-19 22:39:50 +0200 |
| commit | 223ca6e2868b5a4d59bafecfa597e9b676226c4e (patch) | |
| tree | ab31f800052cb865f4ac91016e5e4b574c63960e /src/config | |
| parent | c2a3896cc9168a12f25a144dada6ecb94fb52b59 (diff) | |
| parent | f0ad77251b28fcf48dcaf25f23e3a140d69a4735 (diff) | |
Merge pull request #548 from FlafyDev/main
add input:kb_file option to use a .xkb file.
Diffstat (limited to 'src/config')
| -rw-r--r-- | src/config/ConfigManager.cpp | 25 | ||||
| -rw-r--r-- | src/config/ConfigManager.hpp | 6 | ||||
| -rw-r--r-- | src/config/defaultConfig.hpp | 3 |
3 files changed, 11 insertions, 23 deletions
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 47f10bc5..e1108b22 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -120,6 +120,7 @@ void CConfigManager::setDefaultVars() { configValues["animations:workspaces"].intValue = 1; configValues["input:sensitivity"].floatValue = 0.f; + configValues["input:kb_file"].strValue = STRVAL_EMPTY; configValues["input:kb_layout"].strValue = "us"; configValues["input:kb_variant"].strValue = STRVAL_EMPTY; configValues["input:kb_options"].strValue = STRVAL_EMPTY; @@ -156,6 +157,7 @@ void CConfigManager::setDeviceDefaultVars(const std::string& dev) { auto& cfgValues = deviceConfigs[dev]; cfgValues["sensitivity"].floatValue = 0.f; + cfgValues["kb_file"].strValue = STRVAL_EMPTY; cfgValues["kb_layout"].strValue = "us"; cfgValues["kb_variant"].strValue = STRVAL_EMPTY; cfgValues["kb_options"].strValue = STRVAL_EMPTY; @@ -775,28 +777,13 @@ void CConfigManager::handleSubmap(const std::string& command, const std::string& void CConfigManager::handleSource(const std::string& command, const std::string& rawpath) { static const char* const ENVHOME = getenv("HOME"); - auto value = rawpath; - - if (value.length() < 2) { + if (rawpath.length() < 2) { Debug::log(ERR, "source= path garbage"); - parseError = "source path " + value + " bogus!"; + parseError = "source path " + rawpath + " bogus!"; return; } - if (value[0] == '.') { - auto currentDir = configCurrentPath.substr(0, configCurrentPath.find_last_of('/')); - - if (value[1] == '.') { - auto parentDir = currentDir.substr(0, currentDir.find_last_of('/')); - value.replace(0, 2, parentDir); - } else { - value.replace(0, 1, currentDir); - } - } - - if (value[0] == '~') { - value.replace(0, 1, std::string(ENVHOME)); - } + auto value = absolutePath(rawpath, configCurrentPath); if (!std::filesystem::exists(value)) { Debug::log(ERR, "source= file doesnt exist"); @@ -1380,4 +1367,4 @@ SAnimationPropertyConfig* CConfigManager::getAnimationPropertyConfig(const std:: void CConfigManager::addParseError(const std::string& err) { if (parseError == "") parseError = err; -}
\ No newline at end of file +} diff --git a/src/config/ConfigManager.hpp b/src/config/ConfigManager.hpp index 87cbd956..72eb58f6 100644 --- a/src/config/ConfigManager.hpp +++ b/src/config/ConfigManager.hpp @@ -106,6 +106,8 @@ public: SAnimationPropertyConfig* getAnimationPropertyConfig(const std::string&); + std::string configCurrentPath; + private: std::deque<std::string> configPaths; // stores all the config paths std::unordered_map<std::string, time_t> configModifyTimes; // stores modify times @@ -115,8 +117,6 @@ private: std::unordered_map<std::string, SAnimationPropertyConfig> animationConfig; // stores all the animations with their set values - std::string configCurrentPath; - std::string currentCategory = ""; // For storing the category of the current item std::string parseError = ""; // For storing a parse error to display later @@ -159,4 +159,4 @@ private: void handleBlurLS(const std::string&, const std::string&); }; -inline std::unique_ptr<CConfigManager> g_pConfigManager;
\ No newline at end of file +inline std::unique_ptr<CConfigManager> g_pConfigManager; diff --git a/src/config/defaultConfig.hpp b/src/config/defaultConfig.hpp index 75ec925f..9ecdbbb0 100644 --- a/src/config/defaultConfig.hpp +++ b/src/config/defaultConfig.hpp @@ -20,6 +20,7 @@ autogenerated=1 # remove this line to get rid of the warning on top. monitor=,preferred,auto,1 input { + kb_file= kb_layout= kb_variant= kb_model= @@ -122,4 +123,4 @@ bind=ALT,0,movetoworkspace,10 bind=SUPER,mouse_down,workspace,e+1 bind=SUPER,mouse_up,workspace,e-1 -)#";
\ No newline at end of file +)#"; |
