2024-02-17 19:30:11 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "../helpers/Log.hpp"
|
|
|
|
|
|
|
|
|
|
#include <hyprlang.hpp>
|
|
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
|
|
class CConfigManager {
|
|
|
|
|
public:
|
2024-02-29 17:19:33 +01:00
|
|
|
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();
|
2025-01-27 13:24:13 +00:00
|
|
|
|
|
|
|
|
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;
|