Added support for hostname based module addition

This commit is contained in:
jpk
2026-03-05 09:04:21 +01:00
parent 68d4360c26
commit 5de21f4a07
4 changed files with 42 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
#include <glibmm/miscutils.h>
#include "util/hosts_check.hpp"
namespace waybar::util {
// replaces ``<>&"'`` with their encoded counterparts
bool valid_host(const Json::Value& config) {
if (config.isMember("hosts") && config["hosts"].isArray()) {
auto hostname = Glib::get_host_name();
for (const auto& host : config["hosts"]) {
if (host.asString() == hostname) {
return true;
}
}
return false;
}
return true;
}
} // namespace waybar::util