#pragma once #include #include #include #ifndef SYSCONFDIR #define SYSCONFDIR "/etc" #endif namespace waybar { class Config { public: static const std::vector CONFIG_DIRS; static const char* CONFIG_PATH_ENV; /* Try to find any of provided names in the supported set of config directories */ static std::optional findConfigPath( const std::vector& names, const std::vector& dirs = CONFIG_DIRS); static std::vector tryExpandPath(const std::string& base, const std::string& filename); Config() = default; void load(const std::string& config); Json::Value& getConfig() { return config_; } std::vector getOutputConfigs(const std::string& name, const std::string& identifier); private: void setupConfig(Json::Value& dst, const std::string& config_file, int depth); void resolveConfigIncludes(Json::Value& config, int depth); void mergeConfig(Json::Value& a_config_, Json::Value& b_config_); static std::vector findIncludePath( const std::string& name, const std::vector& dirs = CONFIG_DIRS); std::string config_file_; Json::Value config_; }; } // namespace waybar