Make numlock state on boot configurable

Make numlock state on boot configurable

This will expose 3 settings for numlock behavior:
1. Numlock is off on boot (this is the current default behavior)
2. Numlock is on on boot
3. Numlock will restore the state from the last boot

Fixes #369

* Address comments:

Get keyboard after create_seat called rather than returning from
create_seat.
Use constants rather than magic numbers for keypress.
Only save updated modifier state after keypresses are handled/skipped.

* Remove unused import, fold other into existing use block.
This commit is contained in:
Paul Daniel Faria 2025-02-12 05:35:22 -08:00 committed by GitHub
parent ec1026d9b9
commit f1f9d205be
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 133 additions and 11 deletions

View file

@ -7,6 +7,20 @@ use std::collections::HashMap;
pub mod input;
pub mod workspace;
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct KeyboardConfig {
/// Boot state for numlock
pub numlock_state: NumlockState,
}
#[derive(Copy, Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub enum NumlockState {
BootOn,
#[default]
BootOff,
LastBoot,
}
#[derive(Clone, Debug, PartialEq, CosmicConfigEntry)]
#[version = 1]
pub struct CosmicCompConfig {
@ -15,6 +29,7 @@ pub struct CosmicCompConfig {
pub input_touchpad: input::InputConfig,
pub input_devices: HashMap<String, input::InputConfig>,
pub xkb_config: XkbConfig,
pub keyboard_config: KeyboardConfig,
/// Autotiling enabled
pub autotile: bool,
/// Determines the behavior of the autotile variable
@ -53,6 +68,7 @@ impl Default for CosmicCompConfig {
},
input_devices: Default::default(),
xkb_config: Default::default(),
keyboard_config: Default::default(),
autotile: Default::default(),
autotile_behavior: Default::default(),
active_hint: true,