mirror of
				https://github.com/rad4day/Waybar.git
				synced 2025-10-31 07:52:42 +01:00 
			
		
		
		
	feat(keyboard): improve keyboard response time
Use libinput event for keyboard state updates. The state will update when CAPS_LOCK, NUM_LOCK or SCROLL_LOCK has been released, `interval` will have no effect after this change.
This commit is contained in:
		| @@ -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 findKeyboards() -> void; | ||||
|  | ||||
|   Gtk::Box box_; | ||||
|   Gtk::Label numlock_label_; | ||||
|   Gtk::Label capslock_label_; | ||||
| @@ -34,6 +39,8 @@ class KeyboardState : public AModule { | ||||
|  | ||||
|   int fd_; | ||||
|   libevdev* dev_; | ||||
|   struct libinput* libinput_; | ||||
|   std::unordered_map<std::string, struct libinput_device*> libinput_devices_; | ||||
|  | ||||
|   util::SleeperThread thread_; | ||||
| }; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 asas1asas200
					asas1asas200