diff options
| -rw-r--r-- | Cargo.lock | 4 | ||||
| -rw-r--r-- | src/handlers/mod.rs | 16 | ||||
| -rw-r--r-- | src/input.rs | 11 |
3 files changed, 28 insertions, 3 deletions
@@ -2716,7 +2716,7 @@ checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" [[package]] name = "smithay" version = "0.3.0" -source = "git+https://github.com/Smithay/smithay.git#8854dee7c2f49e9077f10d484b0de9a8e81c587c" +source = "git+https://github.com/Smithay/smithay.git#4a1b3ea4a1832089bac29fa4f76d57cd24745bde" dependencies = [ "appendlist", "bitflags 2.4.2", @@ -2788,7 +2788,7 @@ dependencies = [ [[package]] name = "smithay-drm-extras" version = "0.1.0" -source = "git+https://github.com/Smithay/smithay.git#8854dee7c2f49e9077f10d484b0de9a8e81c587c" +source = "git+https://github.com/Smithay/smithay.git#4a1b3ea4a1832089bac29fa4f76d57cd24745bde" dependencies = [ "drm", "edid-rs", diff --git a/src/handlers/mod.rs b/src/handlers/mod.rs index be8bab55..d44d9e8c 100644 --- a/src/handlers/mod.rs +++ b/src/handlers/mod.rs @@ -11,8 +11,9 @@ use std::thread; use smithay::backend::allocator::dmabuf::Dmabuf; use smithay::desktop::{PopupKind, PopupManager}; use smithay::input::pointer::{CursorIcon, CursorImageStatus, PointerHandle}; -use smithay::input::{Seat, SeatHandler, SeatState}; +use smithay::input::{keyboard, Seat, SeatHandler, SeatState}; use smithay::output::Output; +use smithay::reexports::input; use smithay::reexports::wayland_server::protocol::wl_data_source::WlDataSource; use smithay::reexports::wayland_server::protocol::wl_output::WlOutput; use smithay::reexports::wayland_server::protocol::wl_surface::WlSurface; @@ -73,6 +74,19 @@ impl SeatHandler for State { set_data_device_focus(dh, seat, client.clone()); set_primary_focus(dh, seat, client); } + + fn led_state_changed(&mut self, _seat: &Seat<Self>, led_state: keyboard::LedState) { + let keyboards = self + .niri + .devices + .iter() + .filter(|device| device.has_capability(input::DeviceCapability::Keyboard)) + .cloned(); + + for mut keyboard in keyboards { + keyboard.led_update(led_state.into()); + } + } } delegate_seat!(State); delegate_cursor_shape!(State); diff --git a/src/input.rs b/src/input.rs index 23ba6958..b9b91545 100644 --- a/src/input.rs +++ b/src/input.rs @@ -127,6 +127,17 @@ impl State { } } + if device.has_capability(input::DeviceCapability::Keyboard) { + if let Some(led_state) = self + .niri + .seat + .get_keyboard() + .map(|keyboard| keyboard.led_state()) + { + device.led_update(led_state.into()); + } + } + apply_libinput_settings(&self.niri.config.borrow().input, device); } InputEvent::DeviceRemoved { device } => { |
