mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-29 22:26:00 +01:00
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>
This commit is contained in:
parent
c061946a94
commit
1a6f961de2
2 changed files with 27 additions and 10 deletions
|
@ -2015,20 +2015,36 @@ SConfigValue* CConfigManager::getConfigValuePtr(const std::string& val) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SConfigValue* CConfigManager::getConfigValuePtrSafe(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);
|
||||||
|
|
||||||
if (IT == configValues.end()) {
|
const auto DEVICECONF = deviceConfigs.find(DEVICE);
|
||||||
// maybe plugin
|
if (DEVICECONF == deviceConfigs.end())
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
const auto IT = DEVICECONF->second.find(CONFIGVAR);
|
||||||
|
|
||||||
|
if (IT == DEVICECONF->second.end())
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
return &IT->second;
|
||||||
|
} else if (val.starts_with("plugin:")) {
|
||||||
for (auto& [pl, pMap] : pluginConfigs) {
|
for (auto& [pl, pMap] : pluginConfigs) {
|
||||||
const auto PLIT = pMap->find(val);
|
const auto IT = pMap->find(val);
|
||||||
|
|
||||||
if (PLIT != pMap->end())
|
if (IT != pMap->end())
|
||||||
return &PLIT->second;
|
return &IT->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const auto IT = configValues.find(val);
|
||||||
|
|
||||||
|
if (IT == configValues.end())
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
return &(IT->second);
|
return &(IT->second);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1039,8 +1039,8 @@ std::string dispatchGetOption(std::string request, HyprCtl::eHyprCtlOutputFormat
|
||||||
return "no such option";
|
return "no such option";
|
||||||
|
|
||||||
if (format == HyprCtl::eHyprCtlOutputFormat::FORMAT_NORMAL)
|
if (format == HyprCtl::eHyprCtlOutputFormat::FORMAT_NORMAL)
|
||||||
return getFormat("option {}\n\tint: {}\n\tfloat: {:.5f}\n\tstr: \"{}\"\n\tdata: {:x}", curitem, PCFGOPT->intValue, PCFGOPT->floatValue, PCFGOPT->strValue,
|
return getFormat("option {}\n\tint: {}\n\tfloat: {:.5f}\n\tstr: \"{}\"\n\tdata: {:x}\n\tset: {}", curitem, PCFGOPT->intValue, PCFGOPT->floatValue, PCFGOPT->strValue,
|
||||||
(uintptr_t)PCFGOPT->data.get());
|
(uintptr_t)PCFGOPT->data.get(), PCFGOPT->set);
|
||||||
else {
|
else {
|
||||||
return getFormat(
|
return getFormat(
|
||||||
R"#(
|
R"#(
|
||||||
|
@ -1049,10 +1049,11 @@ std::string dispatchGetOption(std::string request, HyprCtl::eHyprCtlOutputFormat
|
||||||
"int": {},
|
"int": {},
|
||||||
"float": {:.5f},
|
"float": {:.5f},
|
||||||
"str": "{}",
|
"str": "{}",
|
||||||
"data": "0x{:x}"
|
"data": "0x{:x}",
|
||||||
|
"set": {}
|
||||||
}}
|
}}
|
||||||
)#",
|
)#",
|
||||||
curitem, PCFGOPT->intValue, PCFGOPT->floatValue, PCFGOPT->strValue, (uintptr_t)PCFGOPT->data.get());
|
curitem, PCFGOPT->intValue, PCFGOPT->floatValue, PCFGOPT->strValue, (uintptr_t)PCFGOPT->data.get(), PCFGOPT->set);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue