Skip to main content

drmkit_input/
leds.rs

1// SPDX-FileCopyrightText: (c) 2026 Joel Winarske
2// SPDX-License-Identifier: MIT
3
4//! The lock lights.
5
6/// The lock state, as the keyboard's lights would show it.
7///
8/// Two sides use this and neither owns it: xkb tracks the latch, and the
9/// device carries the light. Keeping them together is the caller's job --
10/// read [`Keyboard::leds`](crate::Keyboard::leds) after a key, and when it
11/// differs from last time push it to [`Seat::set_leds`](crate::Seat::set_leds).
12#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
13#[non_exhaustive]
14pub struct Leds {
15    /// Caps Lock.
16    pub caps_lock: bool,
17    /// Num Lock.
18    pub num_lock: bool,
19    /// Scroll Lock.
20    ///
21    /// Dead on most layouts: xkb's default compat has no mod-mapping for
22    /// `<SCLK>`, so nothing sets it and
23    /// [`Keyboard::set_leds`](crate::Keyboard::set_leds) cannot make it true.
24    pub scroll_lock: bool,
25}