feat(keyboard): add caps lock remapping options
This commit is contained in:
parent
7216ac91f6
commit
c38e87092d
2 changed files with 17 additions and 0 deletions
|
|
@ -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<crate::pages::Message> {
|
|||
|
||||
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<crate::pages::Message> {
|
|||
&*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)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue