diff --git a/cosmic-settings/src/pages/input/keyboard/mod.rs b/cosmic-settings/src/pages/input/keyboard/mod.rs index bc7142e..c679ad6 100644 --- a/cosmic-settings/src/pages/input/keyboard/mod.rs +++ b/cosmic-settings/src/pages/input/keyboard/mod.rs @@ -40,6 +40,13 @@ static ALTERNATE_CHARACTER_OPTIONS: &[(&str, &str)] = &[ // ("Print Screen", "lv3"), XXX ]; +static CAPS_LOCK_OPTIONS: &[(&str, &str)] = &[ + ("Escape", "caps:escape"), + ("Swap with Escape", "caps:swapescape"), + ("Backspace", "caps:backspace"), + ("Super", "caps:super"), +]; + const STR_ORDER: &str = "`str` is always comparable"; #[derive(Clone, Debug)] @@ -118,6 +125,7 @@ enum Context { pub enum SpecialKey { AlternateCharacters, Compose, + CapsLock, } impl SpecialKey { @@ -125,6 +133,7 @@ impl SpecialKey { match self { Self::Compose => "Compose".to_string(), Self::AlternateCharacters => "Alternate Characters".to_string(), + Self::CapsLock => "Caps Lock".to_string(), } } @@ -132,6 +141,7 @@ impl SpecialKey { match self { Self::Compose => "compose:", Self::AlternateCharacters => "lv3:", + Self::CapsLock => "caps:", } } } @@ -555,6 +565,7 @@ impl Page { let options = match special_key { SpecialKey::Compose => COMPOSE_OPTIONS, SpecialKey::AlternateCharacters => ALTERNATE_CHARACTER_OPTIONS, + SpecialKey::CapsLock => CAPS_LOCK_OPTIONS, }; let prefix = special_key.prefix(); let current = self @@ -645,6 +656,7 @@ fn special_character_entry() -> Section { let alternate = descriptions.insert(fl!("keyboard-special-char", "alternate")); let compose = descriptions.insert(fl!("keyboard-special-char", "compose")); + let caps = descriptions.insert(fl!("keyboard-special-char", "caps")); Section::default() .title(fl!("keyboard-special-char")) @@ -662,6 +674,10 @@ fn special_character_entry() -> Section { &*descriptions[compose], Message::OpenSpecialCharacterContext(SpecialKey::Compose), )) + .add(crate::widget::go_next_item( + &*descriptions[caps], + Message::OpenSpecialCharacterContext(SpecialKey::CapsLock), + )) .apply(cosmic::Element::from) .map(crate::pages::Message::Keyboard) }) diff --git a/i18n/en/cosmic_settings.ftl b/i18n/en/cosmic_settings.ftl index e9f0dbe..f009e7b 100644 --- a/i18n/en/cosmic_settings.ftl +++ b/i18n/en/cosmic_settings.ftl @@ -471,6 +471,7 @@ keyboard-sources = Input Sources keyboard-special-char = Special Character Entry .alternate = Alternate characters key .compose = Compose key + .caps = Caps Lock key keyboard-typing-assist = Typing .repeat-rate = Repeat rate