Add more configuaration

This commit is contained in:
Grant Moyer
2021-02-07 18:46:39 -05:00
parent 6dfa31fb17
commit 642e28166b
4 changed files with 89 additions and 18 deletions

View File

@ -6,8 +6,10 @@
#else
#include <fmt/chrono.h>
#endif
#include "ALabel.hpp"
#include "AModule.hpp"
#include "bar.hpp"
#include "util/sleeper_thread.hpp"
#include <gtkmm/label.h>
extern "C" {
#include <libevdev/libevdev.h>
@ -15,16 +17,30 @@ extern "C" {
namespace waybar::modules {
class KeyboardState : public ALabel {
class KeyboardState : public AModule {
public:
KeyboardState(const std::string&, const Json::Value&);
KeyboardState(const std::string&, const waybar::Bar&, const Json::Value&);
~KeyboardState();
auto update() -> void;
private:
const Bar& bar_;
Gtk::Box box_;
Gtk::Label numlock_label_;
Gtk::Label capslock_label_;
Gtk::Label scrolllock_label_;
std::string numlock_format_;
std::string capslock_format_;
std::string scrolllock_format_;
const std::chrono::seconds interval_;
std::string icon_locked_;
std::string icon_unlocked_;
std::string dev_path_;
int fd_;
libevdev* dev_;
util::SleeperThread thread_;
};