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

@ -203,11 +203,12 @@ pub fn create_seat(
// So instead of doing the right thing (and initialize these capabilities as matching
// devices appear), we have to surrender to reality and just always expose a keyboard and pointer.
let conf = config.xkb_config();
if let Err(err) = seat.add_keyboard(
seat.add_keyboard(
xkb_config_to_wl(&conf),
(conf.repeat_delay as i32).abs(),
(conf.repeat_rate as i32).abs(),
) {
)
.or_else(|err| {
warn!(
?err,
"Failed to load provided xkb config. Trying default...",
@ -217,8 +218,8 @@ pub fn create_seat(
(conf.repeat_delay as i32).abs(),
(conf.repeat_rate as i32).abs(),
)
.expect("Failed to load xkb configuration files");
}
})
.expect("Failed to load xkb configuration files");
seat.add_pointer();
seat.add_touch();