Make udev_deleter not linux-only and fix freebsd build

This commit is contained in:
schmop 2025-10-31 13:54:41 +01:00
parent 4e25871655
commit ce1da5a178
3 changed files with 6 additions and 5 deletions

View File

@ -5,9 +5,7 @@
#include <filesystem>
#if defined(__linux__)
#include <sys/inotify.h>
#include "util/udev_deleter.hpp"
#endif
#include <sys/poll.h>
#include <algorithm>
@ -18,6 +16,7 @@
#include "ALabel.hpp"
#include "bar.hpp"
#include "util/sleeper_thread.hpp"
#include "util/udev_deleter.hpp"
namespace waybar::modules {

View File

@ -7,9 +7,9 @@
#if defined(__FreeBSD__)
#include <sys/sysctl.h>
#endif
#include <spdlog/spdlog.h>
#include <libudev.h>
#include <poll.h>
#include <spdlog/spdlog.h>
#include <sys/signalfd.h>
waybar::modules::Battery::Battery(const std::string& id, const Bar& bar, const Json::Value& config)
@ -23,7 +23,8 @@ waybar::modules::Battery::Battery(const std::string& id, const Bar& bar, const J
if (udev_ == nullptr) {
throw std::runtime_error("udev_new failed");
}
mon_ = std::unique_ptr<udev_monitor, util::UdevMonitorDeleter>(udev_monitor_new_from_netlink(udev_.get(), "kernel"));
mon_ = std::unique_ptr<udev_monitor, util::UdevMonitorDeleter>(
udev_monitor_new_from_netlink(udev_.get(), "kernel"));
if (mon_ == nullptr) {
throw std::runtime_error("udev monitor new failed");
}

View File

@ -1,5 +1,4 @@
#include "util/backlight_backend.hpp"
#include "util/udev_deleter.hpp"
#include <fmt/core.h>
#include <spdlog/spdlog.h>
@ -9,6 +8,8 @@
#include <optional>
#include <utility>
#include "util/udev_deleter.hpp"
namespace {
class FileDescriptor {
public: