mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-29 18:45:58 +01:00
fallback on unset device config var
This commit is contained in:
parent
d010ca2049
commit
92890d492a
2 changed files with 13 additions and 0 deletions
|
@ -180,6 +180,8 @@ void CConfigManager::configSetValueSafe(const std::string& COMMAND, const std::s
|
|||
CONFIGENTRY = &configValues.at(COMMAND);
|
||||
}
|
||||
|
||||
CONFIGENTRY->set = true;
|
||||
|
||||
if (CONFIGENTRY->intValue != -1) {
|
||||
try {
|
||||
if (VALUE.find("0x") == 0) {
|
||||
|
@ -910,6 +912,15 @@ SConfigValue CConfigManager::getConfigValueSafeDevice(const std::string& dev, co
|
|||
|
||||
SConfigValue copy = it->second[val];
|
||||
|
||||
// fallback if not set explicitly
|
||||
if (!copy.set) {
|
||||
for (auto& cv : configValues) {
|
||||
if (cv.first.find(val) == cv.first.length() - val.length()) {
|
||||
copy = cv.second;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,8 @@ struct SConfigValue {
|
|||
int64_t intValue = -1;
|
||||
float floatValue = -1;
|
||||
std::string strValue = "";
|
||||
|
||||
bool set = false; // used for device configs
|
||||
};
|
||||
|
||||
struct SMonitorRule {
|
||||
|
|
Loading…
Reference in a new issue