fix: keyboard repeat delay and rate sliders

This commit is contained in:
Hojjat 2026-03-17 16:27:52 -06:00 committed by Ashley Wulber
parent cf7fc32adf
commit 5c20aa9a75

View file

@ -802,50 +802,52 @@ fn keyboard_typing_assist() -> Section<crate::pages::Message> {
settings::section() settings::section()
.title(&section.title) .title(&section.title)
.add( .add(
settings::flex_item(&descriptions[repeat_delay], { settings::item::builder(&descriptions[repeat_delay])
// Delay .flex_control({
let delay_slider = cosmic::widget::slider( // Delay
KB_REPEAT_DELAY_MIN..=KB_REPEAT_DELAY_MAX, let delay_slider = cosmic::widget::slider(
page.xkb.repeat_delay, KB_REPEAT_DELAY_MIN..=KB_REPEAT_DELAY_MAX,
Message::SetRepeatKeysDelay, page.xkb.repeat_delay,
) Message::SetRepeatKeysDelay,
.width(Length::Fill) )
.breakpoints(&[KB_REPEAT_DELAY_DEFAULT]) .width(Length::Fill)
.step(50_u32) .breakpoints(&[KB_REPEAT_DELAY_DEFAULT])
.apply(widget::container) .step(50_u32)
.max_width(250); .apply(widget::container)
.max_width(250);
row::with_capacity(3) row::with_capacity(3)
.align_y(Alignment::Center) .align_y(Alignment::Center)
.spacing(theme::spacing().space_s) .spacing(theme::spacing().space_s)
.push(widget::text::body(&descriptions[short])) .push(widget::text::body(&descriptions[short]))
.push(delay_slider) .push(delay_slider)
.push(widget::text::body(&descriptions[long])) .push(widget::text::body(&descriptions[long]))
}) })
.align_items(Alignment::Center), .align_items(Alignment::Center),
) )
.add( .add(
settings::flex_item(&descriptions[repeat_rate], { settings::item::builder(&descriptions[repeat_rate])
// Repeat rate .flex_control({
let rate_slider = cosmic::widget::slider( // Repeat rate
KB_REPEAT_RATE_MIN..=KB_REPEAT_RATE_MAX, let rate_slider = cosmic::widget::slider(
page.xkb.repeat_rate, KB_REPEAT_RATE_MIN..=KB_REPEAT_RATE_MAX,
Message::SetRepeatKeysRate, page.xkb.repeat_rate,
) Message::SetRepeatKeysRate,
.width(Length::Fill) )
.breakpoints(&[KB_REPEAT_RATE_DEFAULT]) .width(Length::Fill)
.step(5_u32) .breakpoints(&[KB_REPEAT_RATE_DEFAULT])
.apply(widget::container) .step(5_u32)
.max_width(250); .apply(widget::container)
.max_width(250);
row::with_capacity(3) row::with_capacity(3)
.align_y(Alignment::Center) .align_y(Alignment::Center)
.spacing(theme::spacing().space_s) .spacing(theme::spacing().space_s)
.push(widget::text::body(&descriptions[slow])) .push(widget::text::body(&descriptions[slow]))
.push(rate_slider) .push(rate_slider)
.push(widget::text::body(&descriptions[fast])) .push(widget::text::body(&descriptions[fast]))
}) })
.align_items(Alignment::Center), .align_items(Alignment::Center),
) )
.apply(cosmic::Element::from) .apply(cosmic::Element::from)
.map(crate::pages::Message::Keyboard) .map(crate::pages::Message::Keyboard)