Merge pull request #1661 from asas1asas200/zeng-feat-improve_keyboard

This commit is contained in:
Alex
2022-10-20 10:50:35 +02:00
committed by GitHub
6 changed files with 173 additions and 57 deletions

View File

@ -3,12 +3,15 @@
#include <fmt/chrono.h>
#include <gtkmm/label.h>
#include <unordered_map>
#include "AModule.hpp"
#include "bar.hpp"
#include "util/sleeper_thread.hpp"
extern "C" {
#include <libevdev/libevdev.h>
#include <libinput.h>
}
namespace waybar::modules {
@ -20,6 +23,8 @@ class KeyboardState : public AModule {
auto update() -> void;
private:
auto tryAddDevice(const std::string&) -> void;
Gtk::Box box_;
Gtk::Label numlock_label_;
Gtk::Label capslock_label_;
@ -31,11 +36,12 @@ class KeyboardState : public AModule {
const std::chrono::seconds interval_;
std::string icon_locked_;
std::string icon_unlocked_;
std::string devices_path_;
int fd_;
libevdev* dev_;
struct libinput* libinput_;
std::unordered_map<std::string, struct libinput_device*> libinput_devices_;
util::SleeperThread thread_;
util::SleeperThread libinput_thread_, hotplug_thread_;
};
} // namespace waybar::modules