Merge pull request #4907 from jaypikay/master

hostname dependend module
This commit is contained in:
Alexis Rouillard
2026-07-03 23:12:46 +02:00
committed by GitHub
4 changed files with 32 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
#include "util/hosts_check.hpp"
#include <glibmm/miscutils.h>
#include <json/config.h>
namespace waybar::util {
bool valid_host(const Json::Value& config) {
if (config.isMember("hosts") && config["hosts"].isArray()) {
const auto hostname = Glib::get_host_name();
if (!std::ranges::any_of(config["hosts"].begin(), config["hosts"].end(),
[&](const auto& h) { return h.asString() == hostname; }))
return false;
}
return true;
}
} // namespace waybar::util