Basic keyboard state module

This commit is contained in:
Grant Moyer
2021-02-07 15:05:11 -05:00
parent c91cc2218b
commit 6dfa31fb17
7 changed files with 122 additions and 0 deletions

View File

@ -38,6 +38,9 @@
#ifdef HAVE_LIBUDEV
#include "modules/backlight.hpp"
#endif
#ifdef HAVE_LIBEVDEV
#include "modules/keyboard_state.hpp"
#endif
#ifdef HAVE_LIBPULSE
#include "modules/pulseaudio.hpp"
#endif

View File

@ -0,0 +1,31 @@
#pragma once
#include <fmt/format.h>
#if FMT_VERSION < 60000
#include <fmt/time.h>
#else
#include <fmt/chrono.h>
#endif
#include "ALabel.hpp"
#include "util/sleeper_thread.hpp"
extern "C" {
#include <libevdev/libevdev.h>
}
namespace waybar::modules {
class KeyboardState : public ALabel {
public:
KeyboardState(const std::string&, const Json::Value&);
~KeyboardState();
auto update() -> void;
private:
std::string dev_path_;
int fd_;
libevdev* dev_;
util::SleeperThread thread_;
};
} // namespace waybar::modules