summaryrefslogtreecommitdiff
path: root/src/config/ConfigManager.cpp
diff options
context:
space:
mode:
authorPhilip Damianik <39028343+pdamianik@users.noreply.github.com>2023-09-09 13:25:17 +0200
committerGitHub <noreply@github.com>2023-09-09 12:25:17 +0100
commit1a6f961de2eff84e4725255f09d33395c4a52fcc (patch)
tree34fe9464a0ccd43c31338e32a27856637d6d6970 /src/config/ConfigManager.cpp
parentc061946a94921d083507d8effd8d3fb8f05c9fc1 (diff)
hyprctl: Make device configs queryable (#3226)
* Make device configs queryable Signed-off-by: pdamianik <39028343+pdamianik@users.noreply.github.com> * Add set property to getoption output --------- Signed-off-by: pdamianik <39028343+pdamianik@users.noreply.github.com>
Diffstat (limited to 'src/config/ConfigManager.cpp')
-rw-r--r--src/config/ConfigManager.cpp28
1 files changed, 22 insertions, 6 deletions
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp
index b9aedd13..8370eeec 100644
--- a/src/config/ConfigManager.cpp
+++ b/src/config/ConfigManager.cpp
@@ -2015,20 +2015,36 @@ SConfigValue* CConfigManager::getConfigValuePtr(const std::string& val) {
}
SConfigValue* CConfigManager::getConfigValuePtrSafe(const std::string& val) {
- const auto IT = configValues.find(val);
+ if (val.starts_with("device:")) {
+ const auto DEVICE = val.substr(7, val.find_last_of(':') - 7);
+ const auto CONFIGVAR = val.substr(val.find_last_of(':') + 1);
+
+ const auto DEVICECONF = deviceConfigs.find(DEVICE);
+ if (DEVICECONF == deviceConfigs.end())
+ return nullptr;
+
+ const auto IT = DEVICECONF->second.find(CONFIGVAR);
+
+ if (IT == DEVICECONF->second.end())
+ return nullptr;
- if (IT == configValues.end()) {
- // maybe plugin
+ return &IT->second;
+ } else if (val.starts_with("plugin:")) {
for (auto& [pl, pMap] : pluginConfigs) {
- const auto PLIT = pMap->find(val);
+ const auto IT = pMap->find(val);
- if (PLIT != pMap->end())
- return &PLIT->second;
+ if (IT != pMap->end())
+ return &IT->second;
}
return nullptr;
}
+ const auto IT = configValues.find(val);
+
+ if (IT == configValues.end())
+ return nullptr;
+
return &(IT->second);
}