fix(shortcuts): disable default keybind when modified
This commit is contained in:
parent
f16244b400
commit
bc70106fe5
1 changed files with 9 additions and 5 deletions
|
|
@ -11,7 +11,7 @@ use cosmic_settings_page as page;
|
||||||
use slab::Slab;
|
use slab::Slab;
|
||||||
use slotmap::Key;
|
use slotmap::Key;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::io;
|
use std::{io, mem};
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
|
|
@ -534,9 +534,8 @@ impl Model {
|
||||||
if let Some(new_binding) = apply_binding {
|
if let Some(new_binding) = apply_binding {
|
||||||
if let Some(model) = self.shortcut_models.get_mut(short_id) {
|
if let Some(model) = self.shortcut_models.get_mut(short_id) {
|
||||||
if let Some(shortcut) = model.bindings.get_mut(id) {
|
if let Some(shortcut) = model.bindings.get_mut(id) {
|
||||||
let prev_binding = shortcut.binding.clone();
|
let prev_binding = mem::replace(&mut shortcut.binding, new_binding.clone());
|
||||||
|
|
||||||
shortcut.binding = new_binding.clone();
|
|
||||||
shortcut.is_saved = true;
|
shortcut.is_saved = true;
|
||||||
shortcut.input.clear();
|
shortcut.input.clear();
|
||||||
|
|
||||||
|
|
@ -545,7 +544,12 @@ impl Model {
|
||||||
}
|
}
|
||||||
|
|
||||||
let action = model.action.clone();
|
let action = model.action.clone();
|
||||||
self.config_remove(&prev_binding);
|
|
||||||
|
if shortcut.is_default {
|
||||||
|
self.config_add(Action::Disable, prev_binding);
|
||||||
|
} else {
|
||||||
|
self.config_remove(&prev_binding);
|
||||||
|
}
|
||||||
self.config_add(action, new_binding);
|
self.config_add(action, new_binding);
|
||||||
return cosmic::widget::text_input::focus(
|
return cosmic::widget::text_input::focus(
|
||||||
self.add_keybindings_button_id.clone(),
|
self.add_keybindings_button_id.clone(),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue