hypridle/src/config/ConfigManager.hpp

41 lines
971 B
C++
Raw Normal View History

2024-02-17 19:30:11 +00:00
#pragma once
#include "../helpers/Log.hpp"
#include <hyprlang.hpp>
#include <set>
2024-02-17 19:30:11 +00:00
#include <vector>
#include <memory>
class CConfigManager {
public:
CConfigManager(std::string configPath);
2024-02-17 19:30:11 +00:00
void init();
struct STimeoutRule {
uint64_t timeout = 0;
std::string onTimeout = "";
std::string onResume = "";
};
std::vector<STimeoutRule> getRules();
std::optional<std::string> handleSource(const std::string&, const std::string&);
std::string configCurrentPath;
std::set<std::string> alreadyIncludedSourceFiles;
template <typename T>
Hyprlang::CSimpleConfigValue<T> getValue(const std::string& name) {
return Hyprlang::CSimpleConfigValue<T>(&m_config, name.c_str());
}
2024-02-17 19:30:11 +00:00
private:
Hyprlang::CConfig m_config;
std::vector<STimeoutRule> m_vRules;
Hyprlang::CParseResult postParse();
};
2024-02-17 22:13:06 +00:00
inline std::unique_ptr<CConfigManager> g_pConfigManager;