mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
feat(keybaord): enable hotplug support
Use inotify listening devices path changes to implement hotplug support. The new hotplug thread is also an event loop, so the interval value has no effect. The evdev is now open on demand. Fix libinput_interface object life-time.
This commit is contained in:
@ -23,7 +23,7 @@ class KeyboardState : public AModule {
|
||||
auto update() -> void;
|
||||
|
||||
private:
|
||||
auto findKeyboards() -> void;
|
||||
auto tryAddDevice(const std::string&) -> void;
|
||||
|
||||
Gtk::Box box_;
|
||||
Gtk::Label numlock_label_;
|
||||
@ -36,13 +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
|
||||
|
Reference in New Issue
Block a user