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:
parent
ec1026d9b9
commit
f1f9d205be
5 changed files with 133 additions and 11 deletions
|
|
@ -33,7 +33,7 @@ use calloop::{
|
|||
timer::{TimeoutAction, Timer},
|
||||
RegistrationToken,
|
||||
};
|
||||
use cosmic_comp_config::workspace::WorkspaceLayout;
|
||||
use cosmic_comp_config::{workspace::WorkspaceLayout, NumlockState};
|
||||
use cosmic_settings_config::shortcuts;
|
||||
use cosmic_settings_config::shortcuts::action::{Direction, ResizeDirection};
|
||||
use smithay::{
|
||||
|
|
@ -241,6 +241,22 @@ impl State {
|
|||
}
|
||||
self.handle_action(action, &seat, serial, time, pattern, None, true)
|
||||
}
|
||||
|
||||
// If we want to track numlock state so it can be reused on the next boot...
|
||||
if let NumlockState::LastBoot =
|
||||
self.common.config.cosmic_conf.keyboard_config.numlock_state
|
||||
{
|
||||
// .. and the state has been updated ...
|
||||
if self.common.config.dynamic_conf.numlock().last_state
|
||||
!= keyboard.modifier_state().num_lock
|
||||
{
|
||||
// ... then record the updated state.
|
||||
// The call to `numlock_mut` will generate a `PersistenceGuard`. The
|
||||
// `PersistenceGuard` will write to a file when it's dropped here.
|
||||
self.common.config.dynamic_conf.numlock_mut().last_state =
|
||||
keyboard.modifier_state().num_lock;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue