diff --git a/app/src/pages/desktop/appearance.rs b/app/src/pages/desktop/appearance.rs index 057e9bcf..16d64a46 100644 --- a/app/src/pages/desktop/appearance.rs +++ b/app/src/pages/desktop/appearance.rs @@ -10,7 +10,7 @@ use cosmic::cosmic_theme::palette::{FromColor, Hsv, Srgb, Srgba}; use cosmic::cosmic_theme::{CornerRadii, Theme, ThemeBuilder, ThemeMode}; use cosmic::iced::wayland::actions::window::SctkWindowSettings; use cosmic::iced::window; -use cosmic::iced_core::{alignment, layout, Alignment, Color, Length}; +use cosmic::iced_core::{alignment, layout, Color, Length}; use cosmic::iced_sctk::commands::window::{close_window, get_window}; use cosmic::iced_widget::scrollable; use cosmic::widget::icon::{from_name, icon}; @@ -33,6 +33,11 @@ use super::wallpaper::widgets::color_image; pub static COLOR_PICKER_DIALOG_ID: Lazy = Lazy::new(window::Id::unique); +crate::cache_dynamic_lazy! { + static HEX: String = fl!("hex"); + static RGB: String = fl!("rgb"); +} + enum NamedColorPicker { CustomAccent, ApplicationBackground, @@ -116,38 +121,38 @@ impl From<(Option, ThemeMode, Option, ThemeBuilder)> for Page { }, roundness: theme_builder.corner_radii.into(), custom_accent: ColorPickerModel::new( - fl!("hex"), - fl!("rgb"), + &*HEX, + &*RGB, None, custom_accent.map(Color::from), ), application_background: ColorPickerModel::new( - fl!("hex"), - fl!("rgb"), + &*HEX, + &*RGB, Some(theme.background.base.into()), theme_builder.bg_color.map(Color::from), ), container_background: ColorPickerModel::new( - fl!("hex"), - fl!("rgb"), + &*HEX, + &*RGB, None, theme_builder.primary_container_bg.map(Color::from), ), interface_text: ColorPickerModel::new( - fl!("hex"), - fl!("rgb"), + &*HEX, + &*RGB, Some(theme.background.on.into()), theme_builder.text_tint.map(Color::from), ), control_component: ColorPickerModel::new( - fl!("hex"), - fl!("rgb"), + &*HEX, + &*RGB, Some(theme.palette.neutral_5.into()), theme_builder.neutral_tint.map(Color::from), ), accent_window_hint: ColorPickerModel::new( - fl!("hex"), - fl!("rgb"), + &*HEX, + &*RGB, None, theme_builder.window_hint.map(Color::from), ), @@ -295,7 +300,7 @@ impl Page { *self = Self::from((self.theme_mode_config.clone(), self.theme_mode)); let theme_builder = self.theme_builder.clone(); - Command::perform(async {}, |_| { + Command::perform(async {}, |()| { crate::Message::SetTheme(cosmic::theme::Theme::custom(Arc::new( // TODO set the values of the theme builder theme_builder.build(), @@ -307,7 +312,6 @@ impl Page { if let Some(config) = self.theme_mode_config.as_ref() { _ = config.set::("auto_switch", enabled); } - if !enabled {} Command::none() } Message::AccentWindowHint(u) => { @@ -414,7 +418,7 @@ impl Page { let cmd = match &u { ColorPickerUpdate::AppliedColor | ColorPickerUpdate::Reset => { theme_builder_needs_update = true; - Command::perform(async {}, |_| crate::app::Message::CloseContextDrawer) + Command::perform(async {}, |()| crate::app::Message::CloseContextDrawer) } ColorPickerUpdate::ActionFinished => { theme_builder_needs_update = true; @@ -424,9 +428,9 @@ impl Page { Command::none() } ColorPickerUpdate::Cancel => { - Command::perform(async {}, |_| crate::app::Message::CloseContextDrawer) + Command::perform(async {}, |()| crate::app::Message::CloseContextDrawer) } - ColorPickerUpdate::ToggleColorPicker => Command::perform(async {}, |_| { + ColorPickerUpdate::ToggleColorPicker => Command::perform(async {}, |()| { crate::app::Message::OpenContextDrawer(fl!("container-background").into()) }), _ => Command::none(), @@ -586,7 +590,7 @@ impl Page { Message::Entered => { *self = Self::default(); let theme_builder = self.theme_builder.clone(); - Command::perform(async {}, |_| { + Command::perform(async {}, |()| { crate::Message::SetTheme(cosmic::theme::Theme::custom(Arc::new( // TODO set the values of the theme builder theme_builder.build(), @@ -595,7 +599,7 @@ impl Page { // Load the current theme builders and mode // Set the theme for the application to match the current mode instead of the system theme? } - Message::Left => Command::perform(async {}, |_| { + Message::Left => Command::perform(async {}, |()| { app::Message::SetTheme(cosmic::theme::system_preference()) }), Message::PaletteAccent(c) => { @@ -626,7 +630,7 @@ impl Page { } *self = Self::from((self.theme_mode_config.clone(), self.theme_mode)); - Command::perform(async {}, |_| { + Command::perform(async {}, |()| { crate::Message::SetTheme(cosmic::theme::Theme::custom(Arc::new(new_theme))) }) } @@ -683,7 +687,7 @@ impl Page { ) } Message::ImportFile(f) => { - let Some(f) = f.uris().get(0) else { + let Some(f) = f.uris().first() else { return Command::none(); }; if f.scheme() != "file" { @@ -710,7 +714,7 @@ impl Page { ) } Message::ExportFile(f) => { - let Some(f) = f.uris().get(0) else { + let Some(f) = f.uris().first() else { return Command::none(); }; if f.scheme() != "file" { @@ -770,7 +774,7 @@ impl Page { } *self = Self::from((self.theme_mode_config.clone(), self.theme_mode)); - Command::perform(async {}, |_| { + Command::perform(async {}, |()| { crate::Message::SetTheme(cosmic::theme::Theme::custom(Arc::new(new_theme))) }) } @@ -806,7 +810,7 @@ impl Page { ); _ = self.accent_window_hint.update::( ColorPickerUpdate::ActiveColor(Hsv::from_color(window_hint)), - ) + ); }; Command::none() } @@ -854,7 +858,7 @@ impl Page { let theme_builder = self.theme_builder.clone(); ret = Command::batch(vec![ ret, - Command::perform(async {}, |_| { + Command::perform(async {}, |()| { crate::Message::SetTheme(cosmic::theme::Theme::custom(Arc::new( theme_builder.build(), ))) @@ -964,7 +968,7 @@ impl page::Page for Page { } fn on_leave(&mut self) -> Command { - Command::perform(async {}, |_| { + Command::perform(async {}, |()| { crate::pages::Message::Appearance(Message::Left) }) } @@ -999,29 +1003,29 @@ pub fn mode_and_colors() -> Section { .title(fl!("mode-and-colors")) .descriptions(vec![ // 0 - fl!("auto-switch"), - fl!("auto-switch", "desc"), + fl!("auto-switch").into(), + fl!("auto-switch", "desc").into(), //2 - fl!("accent-color"), + fl!("accent-color").into(), //3 - fl!("app-background"), + fl!("app-background").into(), //4 - fl!("container-background"), - fl!("container-background", "desc"), - fl!("container-background", "desc-detail"), - fl!("container-background", "reset"), + fl!("container-background").into(), + fl!("container-background", "desc").into(), + fl!("container-background", "desc-detail").into(), + fl!("container-background", "reset").into(), // 8 - fl!("text-tint"), - fl!("text-tint", "desc"), + fl!("text-tint").into(), + fl!("text-tint", "desc").into(), // 10 - fl!("control-tint"), - fl!("control-tint", "desc"), + fl!("control-tint").into(), + fl!("control-tint", "desc").into(), // 12 - fl!("window-hint-accent-toggle"), - fl!("window-hint-accent"), + fl!("window-hint-accent-toggle").into(), + fl!("window-hint-accent").into(), // 14 - fl!("dark"), - fl!("light"), + fl!("dark").into(), + fl!("light").into(), ]) .view::(|_binder, page, section| { let descriptions = §ion.descriptions; @@ -1044,7 +1048,7 @@ pub fn mode_and_colors() -> Section { .padding([8, 0]) .selected(page.theme_mode.is_dark) .on_press(Message::DarkMode(true)), - text(&descriptions[14]) + text(&*descriptions[14]) ] .spacing(8) .width(Length::FillPortion(1)) @@ -1059,7 +1063,7 @@ pub fn mode_and_colors() -> Section { .selected(!page.theme_mode.is_dark) .padding([8, 0]) .on_press(Message::DarkMode(false)), - text(&descriptions[15]) + text(&*descriptions[15]) ] .spacing(8) .width(Length::FillPortion(1)) @@ -1073,13 +1077,13 @@ pub fn mode_and_colors() -> Section { .align_x(cosmic::iced_core::alignment::Horizontal::Center), ) .add( - settings::item::builder(&descriptions[0]) - .description(&descriptions[1]) + settings::item::builder(&*descriptions[0]) + .description(&*descriptions[1]) .toggler(page.theme_mode.auto_switch, Message::Autoswitch), ) .add( cosmic::iced::widget::column![ - text(&descriptions[2]), + text(&*descriptions[2]), scrollable( cosmic::iced::widget::row![ color_button( @@ -1175,7 +1179,7 @@ pub fn mode_and_colors() -> Section { .spacing(8), ) .add( - settings::item::builder(&descriptions[3]).control( + settings::item::builder(&*descriptions[3]).control( page.application_background .picker_button(Message::ApplicationBackground, Some(24)) .width(Length::Fixed(48.0)) @@ -1183,8 +1187,8 @@ pub fn mode_and_colors() -> Section { ), ) .add( - settings::item::builder(&descriptions[4]) - .description(&descriptions[5]) + settings::item::builder(&*descriptions[4]) + .description(&*descriptions[5]) .control( if let Some(c) = page.container_background.get_applied_color() { container(color_button( @@ -1208,8 +1212,8 @@ pub fn mode_and_colors() -> Section { ), ) .add( - settings::item::builder(&descriptions[8]) - .description(&descriptions[9]) + settings::item::builder(&*descriptions[8]) + .description(&*descriptions[9]) .control( page.interface_text .picker_button(Message::InterfaceText, Some(24)) @@ -1218,8 +1222,8 @@ pub fn mode_and_colors() -> Section { ), ) .add( - settings::item::builder(&descriptions[10]) - .description(&descriptions[11]) + settings::item::builder(&*descriptions[10]) + .description(&*descriptions[11]) .control( page.control_component .picker_button(Message::ControlComponent, Some(24)) @@ -1228,12 +1232,12 @@ pub fn mode_and_colors() -> Section { ), ) .add( - settings::item::builder(&descriptions[12]) + settings::item::builder(&*descriptions[12]) .toggler(page.no_custom_window_hint, Message::UseDefaultWindowHint), ); if !page.no_custom_window_hint { section = section.add( - settings::item::builder(&descriptions[13]).control( + settings::item::builder(&*descriptions[13]).control( page.accent_window_hint .picker_button(Message::AccentWindowHint, Some(24)) .width(Length::Fixed(48.0)) @@ -1252,11 +1256,11 @@ pub fn style() -> Section { Section::default() .title(fl!("style")) .descriptions(vec![ - fl!("style", "round"), - fl!("style", "slightly-round"), - fl!("style", "square"), - fl!("frosted"), - fl!("frosted", "desc"), + fl!("style", "round").into(), + fl!("style", "slightly-round").into(), + fl!("style", "square").into(), + fl!("frosted").into(), + fl!("frosted", "desc").into(), ]) .view::(|_binder, page, section| { let descriptions = §ion.descriptions; @@ -1282,7 +1286,7 @@ pub fn style() -> Section { .style(button::Style::Image) .padding(8) .on_press(Message::Roundness(Roundness::Round)), - text(&descriptions[0]) + text(&*descriptions[0]) ] .spacing(8) .width(Length::FillPortion(1)) @@ -1304,7 +1308,7 @@ pub fn style() -> Section { .style(button::Style::Image) .padding(8) .on_press(Message::Roundness(Roundness::SlightlyRound)), - text(&descriptions[1]) + text(&*descriptions[1]) ] .spacing(8) .width(Length::FillPortion(1)) @@ -1327,7 +1331,7 @@ pub fn style() -> Section { .style(button::Style::Image) .padding(8) .on_press(Message::Roundness(Roundness::Square)), - text(&descriptions[2]) + text(&*descriptions[2]) ] .spacing(8) .align_items(cosmic::iced_core::Alignment::Center) @@ -1341,8 +1345,8 @@ pub fn style() -> Section { .align_x(cosmic::iced_core::alignment::Horizontal::Center), ) .add( - settings::item::builder(&descriptions[3]) - .description(&descriptions[4]) + settings::item::builder(&*descriptions[3]) + .description(&*descriptions[4]) .toggler(page.theme_builder.is_frosted, Message::Frosted), ) .apply(Element::from) @@ -1355,20 +1359,20 @@ pub fn window_management() -> Section { Section::default() .title(fl!("window-management")) .descriptions(vec![ - fl!("window-management", "active-hint"), - fl!("window-management", "gaps"), + fl!("window-management", "active-hint").into(), + fl!("window-management", "gaps").into(), ]) .view::(|_binder, page, section| { let descriptions = §ion.descriptions; settings::view_section(§ion.title) - .add(settings::item::builder(&descriptions[0]).control( + .add(settings::item::builder(&*descriptions[0]).control( cosmic::widget::spin_button( page.theme_builder.active_hint.to_string(), Message::WindowHintSize, ), )) - .add(settings::item::builder(&descriptions[1]).control( + .add(settings::item::builder(&*descriptions[1]).control( cosmic::widget::spin_button( page.theme_builder.gaps.1.to_string(), Message::GapSize, @@ -1382,12 +1386,12 @@ pub fn window_management() -> Section { #[allow(clippy::too_many_lines)] pub fn reset_button() -> Section { Section::default() - .descriptions(vec![fl!("reset-default")]) + .descriptions(vec![fl!("reset-default").into()]) .view::(|_binder, page, section| { let spacing = &page.theme_builder.spacing; let descriptions = §ion.descriptions; if page.can_reset { - cosmic::iced::widget::row![button(text(&descriptions[0])) + cosmic::iced::widget::row![button(text(&*descriptions[0])) .on_press(Message::Reset) .padding([spacing.space_xxs, spacing.space_xs])] .apply(Element::from) diff --git a/app/src/pages/desktop/dock/mod.rs b/app/src/pages/desktop/dock/mod.rs index 47b64fdc..0ccd9343 100644 --- a/app/src/pages/desktop/dock/mod.rs +++ b/app/src/pages/desktop/dock/mod.rs @@ -126,7 +126,7 @@ impl Default for Page { pub(crate) fn enable() -> Section { Section::default() - .descriptions(vec![fl!("dock")]) + .descriptions(vec![fl!("dock").into()]) .view::(|_binder, page, section| { let descriptions = §ion.descriptions; let Some(container_config) = page.inner.container_config.as_ref() else { @@ -134,7 +134,7 @@ pub(crate) fn enable() -> Section { }; settings::view_section(§ion.title) .add(settings::item( - &descriptions[0], + &*descriptions[0], toggler( None, container_config diff --git a/app/src/pages/desktop/options.rs b/app/src/pages/desktop/options.rs index afb3ebbf..c6ad51a4 100644 --- a/app/src/pages/desktop/options.rs +++ b/app/src/pages/desktop/options.rs @@ -48,24 +48,24 @@ pub fn super_key_action() -> Section { Section::default() .title(fl!("super-key-action")) .descriptions(vec![ - fl!("super-key-action", "launcher"), - fl!("super-key-action", "workspaces"), - fl!("super-key-action", "applications"), + fl!("super-key-action", "launcher").into(), + fl!("super-key-action", "workspaces").into(), + fl!("super-key-action", "applications").into(), ]) .view::(|_binder, _page, section| { let descriptions = §ion.descriptions; settings::view_section(§ion.title) .add(settings::item( - &descriptions[0], + &*descriptions[0], horizontal_space(Length::Fill), )) .add(settings::item( - &descriptions[1], + &*descriptions[1], horizontal_space(Length::Fill), )) .add(settings::item( - &descriptions[2], + &*descriptions[2], horizontal_space(Length::Fill), )) .into() @@ -76,8 +76,8 @@ pub fn window_controls() -> Section { Section::default() .title(fl!("window-controls")) .descriptions(vec![ - fl!("window-controls", "minimize"), - fl!("window-controls", "maximize"), + fl!("window-controls", "minimize").into(), + fl!("window-controls", "maximize").into(), ]) .view::(|binder, _page, section| { let desktop = binder @@ -87,7 +87,7 @@ pub fn window_controls() -> Section { settings::view_section(§ion.title) .add(settings::item( - &descriptions[0], + &*descriptions[0], toggler( None, desktop.show_minimize_button, @@ -95,7 +95,7 @@ pub fn window_controls() -> Section { ), )) .add(settings::item( - &descriptions[1], + &*descriptions[1], toggler( None, desktop.show_maximize_button, diff --git a/app/src/pages/desktop/panel/applets_inner.rs b/app/src/pages/desktop/panel/applets_inner.rs index 1c1b19aa..2ff07aa3 100644 --- a/app/src/pages/desktop/panel/applets_inner.rs +++ b/app/src/pages/desktop/panel/applets_inner.rs @@ -434,13 +434,7 @@ impl Page { list.retain(|id| id != &to_remove); self.save(); } - Message::DetailStart(_) => { - // TODO ask design team - } - Message::DetailCenter(_) => { - // TODO ask design team - } - Message::DetailEnd(_) => { + Message::DetailStart(_) | Message::DetailCenter(_) | Message::DetailEnd(_) => { // TODO ask design team } Message::Cancel => { diff --git a/app/src/pages/desktop/panel/inner.rs b/app/src/pages/desktop/panel/inner.rs index e4283328..eb1eb96a 100644 --- a/app/src/pages/desktop/panel/inner.rs +++ b/app/src/pages/desktop/panel/inner.rs @@ -32,8 +32,8 @@ pub struct PageInner { impl Default for PageInner { fn default() -> Self { Self { - config_helper: Default::default(), - panel_config: Default::default(), + config_helper: Option::default(), + panel_config: Option::default(), outputs: vec![fl!("all")], anchors: vec![ Anchor(PanelAnchor::Left).to_string(), @@ -46,8 +46,8 @@ impl Default for PageInner { Appearance::Light.to_string(), Appearance::Dark.to_string(), ], - container_config: Default::default(), - outputs_map: Default::default(), + container_config: Option::default(), + outputs_map: HashMap::default(), } } } @@ -78,9 +78,9 @@ pub(crate) fn behavior_and_position< Section::default() .title(fl!("panel-behavior-and-position")) .descriptions(vec![ - p.autohide_label(), - fl!("panel-behavior-and-position", "position"), - fl!("panel-behavior-and-position", "display"), + p.autohide_label().into(), + fl!("panel-behavior-and-position", "position").into(), + fl!("panel-behavior-and-position", "display").into(), ]) .view::

(move |_binder, page, section| { let descriptions = §ion.descriptions; @@ -90,13 +90,13 @@ pub(crate) fn behavior_and_position< }; settings::view_section(§ion.title) .add(settings::item( - &descriptions[0], + &*descriptions[0], toggler(None, panel_config.autohide.is_some(), |value| { Message::AutoHidePanel(value) }), )) .add(settings::item( - &descriptions[1], + &*descriptions[1], dropdown( page.anchors.as_slice(), Some(panel_config.anchor as usize), @@ -104,7 +104,7 @@ pub(crate) fn behavior_and_position< ), )) .add(settings::item( - &descriptions[2], + &*descriptions[2], dropdown( page.outputs.as_slice(), match &panel_config.output { @@ -130,11 +130,11 @@ pub(crate) fn style< Section::default() .title(fl!("panel-style")) .descriptions(vec![ - p.gap_label(), - p.extend_label(), - fl!("panel-style", "appearance"), - fl!("panel-style", "size"), - fl!("panel-style", "background-opacity"), + p.gap_label().into(), + p.extend_label().into(), + fl!("panel-style", "appearance").into(), + fl!("panel-style", "size").into(), + fl!("panel-style", "background-opacity").into(), ]) .view::

(move |_binder, page, section| { let descriptions = §ion.descriptions; @@ -144,19 +144,19 @@ pub(crate) fn style< }; settings::view_section(§ion.title) .add(settings::item( - &descriptions[0], + &*descriptions[0], toggler(None, panel_config.anchor_gap, |value| { Message::AnchorGap(value) }), )) .add(settings::item( - &descriptions[1], + &*descriptions[1], toggler(None, panel_config.expand_to_edges, |value| { Message::ExtendToEdge(value) }), )) .add(settings::item( - &descriptions[2], + &*descriptions[2], dropdown( inner.backgrounds.as_slice(), match panel_config.background { @@ -169,7 +169,7 @@ pub(crate) fn style< ), )) .add(settings::item( - &descriptions[3], + &*descriptions[3], // TODO custom discrete slider variant row::with_children(vec![ text(fl!("small")).into(), @@ -202,7 +202,7 @@ pub(crate) fn style< .spacing(12), )) .add(settings::item( - &descriptions[4], + &*descriptions[4], row::with_children(vec![ text(fl!("number", HashMap::from_iter(vec![("number", 0)]))).into(), slider(0..=100, (panel_config.opacity * 100.0) as i32, |v| { @@ -223,7 +223,7 @@ pub(crate) fn configuration + PanelPage>( ) -> Section { Section::default() .title(fl!("panel-applets")) - .descriptions(vec![p.configure_applets_label()]) + .descriptions(vec![p.configure_applets_label().into()]) .view::

(move |binder, page, section| { let mut settings = settings::view_section(§ion.title); let descriptions = §ion.descriptions; @@ -238,7 +238,7 @@ pub(crate) fn configuration + PanelPage>( ]); settings.add( - settings::item::builder(&descriptions[0]) + settings::item::builder(&*descriptions[0]) .control(control) .spacing(16) .apply(container) @@ -265,8 +265,8 @@ pub(crate) fn add_panel< Section::default() .title(fl!("panel-missing")) .descriptions(vec![ - fl!("panel-missing", "desc"), - fl!("panel-missing", "fix"), + fl!("panel-missing", "desc").into(), + fl!("panel-missing", "fix").into(), ]) .view::

(move |_binder, _page, section| { // _descriptions = §ion.descriptions; @@ -349,7 +349,7 @@ impl PageInner { #[allow(clippy::too_many_lines)] pub fn update(&mut self, message: Message) { let helper = self.config_helper.as_ref().unwrap(); - let Some(mut panel_config) = self.panel_config.as_mut() else { + let Some(panel_config) = self.panel_config.as_mut() else { return; }; @@ -384,7 +384,7 @@ impl PageInner { if i == 0 { panel_config.output = CosmicPanelOuput::All; } else { - panel_config.output = CosmicPanelOuput::Name(self.outputs[i].clone()) + panel_config.output = CosmicPanelOuput::Name(self.outputs[i].clone()); } } Message::AnchorGap(enabled) => { diff --git a/app/src/pages/desktop/wallpaper/mod.rs b/app/src/pages/desktop/wallpaper/mod.rs index 129ccbea..dab62dcd 100644 --- a/app/src/pages/desktop/wallpaper/mod.rs +++ b/app/src/pages/desktop/wallpaper/mod.rs @@ -46,7 +46,6 @@ use cosmic_settings_wallpaper::{self as wallpaper, Entry, ScalingMode}; use image::imageops::FilterType::Lanczos3; use image::{ImageBuffer, Rgba}; use slotmap::{DefaultKey, SecondaryMap, SlotMap}; -use static_init::dynamic; const ZOOM: usize = 0; const FIT: usize = 1; @@ -1056,26 +1055,21 @@ pub async fn change_folder(current_folder: PathBuf) -> Context { update } -#[dynamic] -static WALLPAPER_SAME: String = fl!("wallpaper", "same"); - -#[dynamic] -static WALLPAPER_FIT: String = fl!("wallpaper", "fit"); - -#[dynamic] -static WALLPAPER_SLIDE: String = fl!("wallpaper", "slide"); - -#[dynamic] -static WALLPAPER_CHANGE: String = fl!("wallpaper", "change"); +crate::cache_dynamic_lazy! { + static WALLPAPER_SAME: String = fl!("wallpaper", "same"); + static WALLPAPER_FIT: String = fl!("wallpaper", "fit"); + static WALLPAPER_SLIDE: String = fl!("wallpaper", "slide"); + static WALLPAPER_CHANGE: String = fl!("wallpaper", "change"); +} #[allow(clippy::too_many_lines)] pub fn settings() -> Section { Section::default() .descriptions(vec![ - WALLPAPER_SAME.clone(), - WALLPAPER_FIT.clone(), - WALLPAPER_SLIDE.clone(), - WALLPAPER_CHANGE.clone(), + WALLPAPER_SAME.as_str().into(), + WALLPAPER_FIT.as_str().into(), + WALLPAPER_SLIDE.as_str().into(), + WALLPAPER_CHANGE.as_str().into(), ]) .view::(|_binder, page, _section| { let mut children = Vec::with_capacity(3); diff --git a/app/src/pages/desktop/workspaces.rs b/app/src/pages/desktop/workspaces.rs index 1d2bd5e4..ea78ebab 100644 --- a/app/src/pages/desktop/workspaces.rs +++ b/app/src/pages/desktop/workspaces.rs @@ -133,21 +133,21 @@ fn multi_behavior() -> Section { Section::default() .title(fl!("workspaces-multi-behavior")) .descriptions(vec![ - fl!("workspaces-multi-behavior", "span"), - fl!("workspaces-multi-behavior", "separate"), + fl!("workspaces-multi-behavior", "span").into(), + fl!("workspaces-multi-behavior", "separate").into(), ]) .view::(|_binder, page, section| { let descriptions = §ion.descriptions; settings::view_section(§ion.title) .add(settings::item_row(vec![radio( - &descriptions[0], + &*descriptions[0], WorkspaceMode::Global, Some(page.comp_workspace_config.workspace_mode), Message::SetWorkspaceMode, ) .into()])) .add(settings::item_row(vec![radio( - &descriptions[1], + &*descriptions[1], WorkspaceMode::OutputBound, Some(page.comp_workspace_config.workspace_mode), Message::SetWorkspaceMode, @@ -162,18 +162,18 @@ fn overview_thumbnails() -> Section { Section::default() .title(fl!("workspaces-overview-thumbnails")) .descriptions(vec![ - fl!("workspaces-overview-thumbnails", "show-number"), - fl!("workspaces-overview-thumbnails", "show-name"), + fl!("workspaces-overview-thumbnails", "show-number").into(), + fl!("workspaces-overview-thumbnails", "show-name").into(), ]) .view::(|_binder, page, section| { let descriptions = §ion.descriptions; settings::view_section(§ion.title) .add( - settings::item::builder(&descriptions[0]) + settings::item::builder(&*descriptions[0]) .toggler(page.show_workspace_number, Message::SetShowNumber), ) .add( - settings::item::builder(&descriptions[1]) + settings::item::builder(&*descriptions[1]) .toggler(page.show_workspace_name, Message::SetShowName), ) .apply(Element::from) diff --git a/app/src/pages/display/mod.rs b/app/src/pages/display/mod.rs index 53a77c77..c9c254c3 100644 --- a/app/src/pages/display/mod.rs +++ b/app/src/pages/display/mod.rs @@ -10,7 +10,6 @@ use apply::Apply; use arrangement::Arrangement; use cosmic::iced::Length; use cosmic::iced_widget::scrollable::{Direction, Properties, RelativeOffset}; -use cosmic::prelude::CollectionWidget; use cosmic::widget::{ column, container, dropdown, list_column, segmented_button, toggler, view_switcher, }; @@ -174,14 +173,14 @@ impl page::Page for Page { sections.insert( Section::default() .descriptions(vec![ - text::GRAPHICS_MODE.clone(), - text::GRAPHICS_MODE_COMPUTE_DESC.clone(), - text::GRAPHICS_MODE_HYBRID_DESC.clone(), - text::GRAPHICS_MODE_INTEGRATED_DESC.clone(), - text::GRAPHICS_MODE_NVIDIA_DESC.clone(), - text::NIGHT_LIGHT.clone(), - text::NIGHT_LIGHT_AUTO.clone(), - text::NIGHT_LIGHT_DESCRIPTION.clone(), + text::GRAPHICS_MODE.as_str().into(), + text::GRAPHICS_MODE_COMPUTE_DESC.as_str().into(), + text::GRAPHICS_MODE_HYBRID_DESC.as_str().into(), + text::GRAPHICS_MODE_INTEGRATED_DESC.as_str().into(), + text::GRAPHICS_MODE_NVIDIA_DESC.as_str().into(), + text::NIGHT_LIGHT.as_str().into(), + text::NIGHT_LIGHT_AUTO.as_str().into(), + text::NIGHT_LIGHT_DESCRIPTION.as_str().into(), ]) .view::(|_binder, page, _section| page.graphics_mode_view()), ), @@ -190,8 +189,8 @@ impl page::Page for Page { Section::default() .title(&*text::DISPLAY_ARRANGEMENT) .descriptions(vec![ - text::DISPLAY_ARRANGEMENT.clone(), - text::DISPLAY_ARRANGEMENT_DESC.clone(), + text::DISPLAY_ARRANGEMENT.as_str().into(), + text::DISPLAY_ARRANGEMENT_DESC.as_str().into(), ]) // Show section when there is more than 1 display .show_while::(|page| page.list.outputs.len() > 1) @@ -200,13 +199,13 @@ impl page::Page for Page { // Display configuration sections.insert( Section::default() - .descriptions(vec![ - text::DISPLAY.clone(), - text::DISPLAY_REFRESH_RATE.clone(), - text::DISPLAY_SCALE.clone(), - text::ORIENTATION.clone(), - text::ORIENTATION_LANDSCAPE.clone(), - text::ORIENTATION_PORTRAIT.clone(), + .descriptions([ + text::DISPLAY.as_str().into(), + text::DISPLAY_REFRESH_RATE.as_str().into(), + text::DISPLAY_SCALE.as_str().into(), + text::ORIENTATION.as_str().into(), + text::ORIENTATION_LANDSCAPE.as_str().into(), + text::ORIENTATION_PORTRAIT.as_str().into(), ]) .view::(|_binder, page, _section| page.display_view()), ), @@ -416,11 +415,6 @@ impl Page { let active_output = &self.list.outputs[active_id]; - let display_meta = list_column().add(cosmic::widget::settings::item( - &*text::DISPLAY_ENABLE, - toggler(None, active_output.enabled, Message::DisplayToggle), - )); - let display_options = list_column() .add(cosmic::widget::settings::item( &*text::DISPLAY_RESOLUTION, @@ -462,14 +456,21 @@ impl Page { ), )); - column() - .spacing(theme.cosmic().space_m()) - .push_maybe(if self.list.outputs.len() > 1 { - Some(view_switcher::horizontal(&self.display_tabs).on_activate(Message::Display)) - } else { - None - }) - .push(display_meta) + let mut content = column().spacing(theme.cosmic().space_m()); + + if self.list.outputs.len() > 1 { + let display_switcher = + view_switcher::horizontal(&self.display_tabs).on_activate(Message::Display); + + let display_enable = list_column().add(cosmic::widget::settings::item( + &*text::DISPLAY_ENABLE, + toggler(None, active_output.enabled, Message::DisplayToggle), + )); + + content = content.push(display_switcher).push(display_enable); + } + + content .push(cosmic::widget::text::heading(&*text::DISPLAY_OPTIONS)) .push(display_options) .apply(Element::from) diff --git a/app/src/pages/input/keyboard/mod.rs b/app/src/pages/input/keyboard/mod.rs index 2ddac4a7..92af9603 100644 --- a/app/src/pages/input/keyboard/mod.rs +++ b/app/src/pages/input/keyboard/mod.rs @@ -265,8 +265,8 @@ fn special_character_entry() -> Section { Section::default() .title(fl!("keyboard-special-char")) .descriptions(vec![ - fl!("keyboard-special-char", "alternate"), - fl!("keyboard-special-char", "compose"), + fl!("keyboard-special-char", "alternate").into(), + fl!("keyboard-special-char", "compose").into(), ]) .view::(|_binder, _page, section| { let descriptions = §ion.descriptions; @@ -274,11 +274,11 @@ fn special_character_entry() -> Section { // TODO dialogs settings::view_section(§ion.title) .add(go_next_item( - &descriptions[0], + &*descriptions[0], Message::OpenSpecialCharacterDialog(SpecialKey::AlternateCharacters), )) .add(go_next_item( - &descriptions[1], + &*descriptions[1], Message::OpenSpecialCharacterDialog(SpecialKey::Compose), )) .apply(cosmic::Element::from) @@ -289,7 +289,7 @@ fn special_character_entry() -> Section { fn keyboard_shortcuts() -> Section { Section::default() .title(fl!("keyboard-shortcuts")) - .descriptions(vec![fl!("keyboard-shortcuts", "desc")]) + .descriptions(vec![fl!("keyboard-shortcuts", "desc").into()]) .view::(|binder, _page, section| { let descriptions = §ion.descriptions; @@ -300,7 +300,7 @@ fn keyboard_shortcuts() -> Section { .find(|(_, v)| v.id == "keyboard-shortcuts") { section = section.add(go_next_item( - &descriptions[0], + &*descriptions[0], crate::pages::Message::Page(shortcuts_entity), )); } diff --git a/app/src/pages/input/keyboard/shortcuts.rs b/app/src/pages/input/keyboard/shortcuts.rs index fa3260cb..196cb125 100644 --- a/app/src/pages/input/keyboard/shortcuts.rs +++ b/app/src/pages/input/keyboard/shortcuts.rs @@ -29,13 +29,7 @@ impl page::AutoBind for Page {} fn shortcuts() -> Section { Section::default() .descriptions(vec![]) - .view::(|binder, _page, section| { - let _descriptions = §ion.descriptions; - - let _input = binder - .page::() - .expect("input page not found"); - + .view::(|_binder, _page, section| { // TODO need something more custom /* settings::view_section(§ion.title) diff --git a/app/src/pages/input/mod.rs b/app/src/pages/input/mod.rs index a064c424..34bc7c3c 100644 --- a/app/src/pages/input/mod.rs +++ b/app/src/pages/input/mod.rs @@ -6,7 +6,9 @@ use cosmic::{ iced_widget::core::layout, }; use cosmic_comp_config::{ - input::{AccelProfile, InputConfig}, + input::{ + AccelConfig, AccelProfile, InputConfig, ScrollConfig, ScrollMethod, TapButtonMap, TapConfig, + }, XkbConfig, }; use cosmic_settings_page as page; @@ -17,19 +19,32 @@ pub mod keyboard; mod mouse; mod touchpad; +crate::cache_dynamic_lazy! { + static ACCELERATION_DESC: String = fl!("acceleration-desc"); + static DISABLE_WHILE_TYPING: String = fl!("disable-while-typing"); + static PRIMARY_BUTTON: String = fl!("primary-button"); + static SCROLLING_NATURAL_DESC: String = fl!("scrolling", "natural-desc"); + static SCROLLING_NATURAL: String = fl!("scrolling", "natural"); + static SCROLLING_SPEED: String = fl!("scrolling", "speed"); +} + #[derive(Clone, Debug)] pub enum Message { - SetAcceleration(bool, bool), - SetNaturalScroll(bool, bool), - SetScrollFactor(f64, bool), - SetDoubleClickSpeed(u32, bool), - SetMouseSpeed(f64, bool), - PrimaryButtonSelected(cosmic::widget::segmented_button::Entity, bool), + CloseSpecialCharacterDialog, // seperate close message, to make sure another isn't closed? + DisableWhileTyping(bool, bool), ExpandInputSourcePopover(Option), OpenSpecialCharacterDialog(keyboard::SpecialKey), - CloseSpecialCharacterDialog, + PinchToZoom(bool), + PrimaryButtonSelected(cosmic::widget::segmented_button::Entity, bool), + SetAcceleration(bool, bool), + SetDoubleClickSpeed(u32, bool), + SetMouseSpeed(f64, bool), + SetNaturalScroll(bool, bool), + SetScrollFactor(f64, bool), + SetScrollMethod(Option, bool), SpecialCharacterSelect(Option<&'static str>), + TapToClick(bool), } pub struct Page { @@ -55,8 +70,8 @@ fn get_config( config: &cosmic_config::Config, key: &str, ) -> T { - config.get(key).unwrap_or_else(|err| { - error!(?err, "Failed to read config '{}'", key); + config.get(key).unwrap_or_else(|why| { + error!(?why, "Failed to read config '{}'", key); T::default() }) } @@ -69,19 +84,11 @@ impl Default for Page { let xkb = get_config(&config, "xkb_config"); let mut primary_button = mouse::default_primary_button(); - let idx = if input_default.left_handed.unwrap_or(false) { - 1 - } else { - 0 - }; + let idx = input_default.left_handed.unwrap_or(false) as u16; primary_button.activate_position(idx); let mut touchpad_primary_button = mouse::default_primary_button(); - let idx = if input_touchpad.left_handed.unwrap_or(false) { - 1 - } else { - 0 - }; + let idx = input_touchpad.left_handed.unwrap_or(false) as u16; touchpad_primary_button.activate_position(idx); Self { @@ -117,6 +124,7 @@ impl Page { } } + #[allow(clippy::too_many_lines)] pub fn update(&mut self, message: Message) -> iced::Command { match message { Message::SetAcceleration(value, touchpad) => { @@ -125,26 +133,46 @@ impl Page { } else { AccelProfile::Flat }; + self.update_input(touchpad, |x| { - x.acceleration.get_or_insert(Default::default()).profile = Some(profile); + x.acceleration.get_or_insert(AccelConfig::default()).profile = Some(profile); + }); + } + + Message::SetMouseSpeed(value, touchpad) => self.update_input(touchpad, |x| { + x.acceleration.get_or_insert(AccelConfig::default()).speed = value; + }), + + Message::SetDoubleClickSpeed(_value, _touchpad) => { + // TODO + } + + Message::DisableWhileTyping(disabled, touchpad) => { + self.update_input(touchpad, |conf| { + conf.disable_while_typing = Some(disabled); }); } - Message::SetNaturalScroll(value, touchpad) => self.update_input(touchpad, |x| { + + Message::SetNaturalScroll(enabled, touchpad) => self.update_input(touchpad, |x| { x.scroll_config - .get_or_insert(Default::default()) - .natural_scroll = Some(value); + .get_or_insert(ScrollConfig::default()) + .natural_scroll = Some(enabled); }), + Message::SetScrollFactor(value, touchpad) => self.update_input(touchpad, |x| { x.scroll_config - .get_or_insert(Default::default()) - .scroll_factor = Some(value) + .get_or_insert(ScrollConfig::default()) + .scroll_factor = Some(value); }), - Message::SetDoubleClickSpeed(_value, _touchpad) => { - // TODO + + Message::SetScrollMethod(method, touchpad) => { + self.update_input(touchpad, |conf| { + conf.scroll_config + .get_or_insert(ScrollConfig::default()) + .method = method; + }); } - Message::SetMouseSpeed(value, touchpad) => self.update_input(touchpad, |x| { - x.acceleration.get_or_insert(Default::default()).speed = value - }), + Message::PrimaryButtonSelected(entity, touchpad) => { let select_model = if touchpad { &mut self.touchpad_primary_button @@ -152,13 +180,19 @@ impl Page { &mut self.primary_button }; select_model.activate(entity); - let left_entity = select_model.entity_at(1).unwrap(); + + let Some(left_entity) = select_model.entity_at(1) else { + return cosmic::Command::none(); + }; + let left_handed = select_model.active() == left_entity; self.update_input(touchpad, |x| x.left_handed = Some(left_handed)); } + Message::ExpandInputSourcePopover(value) => { self.expanded_source_popover = value; } + Message::OpenSpecialCharacterDialog(special_key) => { self.special_character_dialog = Some(special_key); let window_settings = SctkWindowSettings { @@ -180,10 +214,12 @@ impl Page { }; return commands::window::get_window(window_settings); } + Message::CloseSpecialCharacterDialog => { self.special_character_dialog = None; return commands::window::close_window(*keyboard::SPECIAL_CHARACTER_DIALOGUE_ID); } + Message::SpecialCharacterSelect(id) => { if let Some(special_key) = self.special_character_dialog { let options = self.xkb.options.as_deref().unwrap_or(""); @@ -191,7 +227,7 @@ impl Page { let new_options = options .split(',') .filter(|x| !x.starts_with(prefix)) - .chain(id.into_iter()) + .chain(id) .join(","); self.xkb.options = Some(new_options).filter(|x| !x.is_empty()); if let Err(err) = self.config.set("xkb_config", &self.xkb) { @@ -199,8 +235,24 @@ impl Page { } } } + + Message::PinchToZoom(_enabled) => {} + + Message::TapToClick(enabled) => { + self.update_input(true, |conf| { + conf.tap_config + .get_or_insert(TapConfig { + enabled: true, + button_map: Some(TapButtonMap::LeftRightMiddle), + drag: true, + drag_lock: false, + }) + .enabled = enabled; + }); + } } - iced::Command::none() + + cosmic::Command::none() } } diff --git a/app/src/pages/input/mouse.rs b/app/src/pages/input/mouse.rs index da01172b..faa5107a 100644 --- a/app/src/pages/input/mouse.rs +++ b/app/src/pages/input/mouse.rs @@ -8,10 +8,15 @@ use slotmap::SlotMap; use super::Message; +crate::cache_dynamic_lazy! { + static MOUSE_ACCELERATION: String = fl!("mouse", "acceleration"); + static MOUSE_SPEED: String = fl!("mouse", "speed"); +} + pub fn default_primary_button() -> cosmic::widget::segmented_button::SingleSelectModel { let mut model = cosmic::widget::segmented_button::SingleSelectModel::builder() - .insert(|b| b.text(fl!("mouse", "primary-button-left"))) - .insert(|b| b.text(fl!("mouse", "primary-button-right"))) + .insert(|b| b.text(fl!("primary-button", "left"))) + .insert(|b| b.text(fl!("primary-button", "right"))) .build(); model.activate_position(0); model @@ -40,27 +45,24 @@ impl page::AutoBind for Page {} fn mouse() -> Section { Section::default() .descriptions(vec![ - fl!("mouse", "primary-button"), - fl!("mouse", "speed"), - fl!("mouse", "acceleration"), - fl!("mouse", "acceleration-desc"), - fl!("mouse", "double-click-speed"), - fl!("mouse", "double-click-speed-desc"), + super::PRIMARY_BUTTON.as_str().into(), + MOUSE_SPEED.as_str().into(), + MOUSE_ACCELERATION.as_str().into(), + super::ACCELERATION_DESC.as_str().into(), ]) .view::(|binder, _page, section| { - let descriptions = §ion.descriptions; - let input = binder.page::().expect("input page not found"); settings::view_section(§ion.title) .add(settings::item( - &descriptions[0], + &*super::PRIMARY_BUTTON, cosmic::widget::segmented_selection::horizontal(&input.primary_button) + .minimum_button_width(0) .on_activate(|x| Message::PrimaryButtonSelected(x, false)), )) .add( - settings::item::builder(&descriptions[1]).control(widget::slider( - 0.0..=100.0, + settings::item::builder(&*MOUSE_SPEED).control(widget::slider( + 1.0..=80.0, (input .input_default .acceleration @@ -72,8 +74,8 @@ fn mouse() -> Section { )), ) .add( - settings::item::builder(&descriptions[2]) - .description(&descriptions[3]) + settings::item::builder(&*MOUSE_ACCELERATION) + .description(&*super::ACCELERATION_DESC) .toggler( input .input_default @@ -83,13 +85,6 @@ fn mouse() -> Section { |x| Message::SetAcceleration(x, false), ), ) - .add( - settings::item::builder(&descriptions[4]) - .description(&descriptions[5]) - .control(widget::slider(0..=100, 0, |x| { - Message::SetDoubleClickSpeed(x, false) - })), - ) .apply(Element::from) .map(crate::pages::Message::Input) }) @@ -97,11 +92,11 @@ fn mouse() -> Section { fn scrolling() -> Section { Section::default() - .title(fl!("mouse-scrolling")) + .title(fl!("scrolling")) .descriptions(vec![ - fl!("mouse-scrolling", "speed"), - fl!("mouse-scrolling", "natural"), - fl!("mouse-scrolling", "natural-desc"), + fl!("scrolling", "speed").into(), + fl!("scrolling", "natural").into(), + fl!("scrolling", "natural-desc").into(), ]) .view::(|binder, _page, section| { let descriptions = §ion.descriptions; @@ -110,7 +105,7 @@ fn scrolling() -> Section { settings::view_section(§ion.title) .add(settings::item( - &descriptions[0], + &*descriptions[0], // TODO show numeric value // TODO desired range? widget::slider( @@ -128,8 +123,8 @@ fn scrolling() -> Section { ), )) .add( - settings::item::builder(&descriptions[1]) - .description(&descriptions[2]) + settings::item::builder(&*descriptions[1]) + .description(&*descriptions[2]) .toggler( input .input_default diff --git a/app/src/pages/input/touchpad.rs b/app/src/pages/input/touchpad.rs index 951ecd8b..0e292f02 100644 --- a/app/src/pages/input/touchpad.rs +++ b/app/src/pages/input/touchpad.rs @@ -1,13 +1,36 @@ -use apply::Apply; -use cosmic::widget::{self, settings}; -use cosmic::Element; -use cosmic_comp_config::input::AccelProfile; +use cosmic::widget::{self, settings, text}; +use cosmic::{Apply, Element}; +use cosmic_comp_config::input::{AccelProfile, ScrollMethod}; use cosmic_settings_page::Section; use cosmic_settings_page::{self as page, section}; use slotmap::SlotMap; use super::Message; +crate::cache_dynamic_lazy! { + static EDGE_SCROLLING_DESC: String = fl!("edge-scrolling", "desc"); + static EDGE_SCROLLING: String = fl!("edge-scrolling"); + static TWO_FINGER_SCROLLING: String = fl!("two-finger-scrolling"); + static PINCH_TO_ZOOM_DESC: String = fl!("pinch-to-zoom", "desc"); + static PINCH_TO_ZOOM: String = fl!("pinch-to-zoom"); + static TAP_TO_CLICK_DESC: String = fl!("tap-to-click", "desc"); + static TAP_TO_CLICK: String = fl!("tap-to-click"); + static TAPPING_AND_PINCHING: String = fl!("tapping-and-pinching"); + static TOUCHPAD_ACCELERAION: String = fl!("touchpad", "acceleration"); + static TOUCHPAD_SPEED: String = fl!("touchpad", "speed"); + + static OPEN_APPLICATION_LIBRARY: String = fl!("open-application-library"); + static OPEN_WORKSPACES_VIEW: String = fl!("open-workspaces-view"); + static SWIPING_FOUR_FINGER_DOWN: String = fl!("swiping", "four-finger-down"); + static SWIPING_FOUR_FINGER_LEFT: String = fl!("swiping", "four-finger-left"); + static SWIPING_FOUR_FINGER_RIGHT: String = fl!("swiping", "four-finger-right"); + static SWIPING_FOUR_FINGER_UP: String = fl!("swiping", "four-finger-up"); + static SWIPING_THREE_FINGER_ANY: String = fl!("swiping", "three-finger-any"); + static SWITCH_BETWEEN_WINDOWS: String = fl!("switch-between-windows"); + static SWITCH_TO_NEXT_WORKSPACE: String = fl!("switch-to-next-workspace"); + static SWITCH_TO_PREV_WORKSPACE: String = fl!("switch-to-prev-workspace"); +} + #[derive(Default)] pub struct Page; @@ -18,7 +41,9 @@ impl page::Page for Page { ) -> Option { Some(vec![ sections.insert(touchpad()), + sections.insert(tapping_and_pinching()), sections.insert(scrolling()), + sections.insert(swiping()), ]) } @@ -34,27 +59,25 @@ impl page::AutoBind for Page {} fn touchpad() -> Section { Section::default() .descriptions(vec![ - fl!("touchpad", "primary-button"), - fl!("touchpad", "speed"), - fl!("touchpad", "acceleration"), - fl!("touchpad", "acceleration-desc"), - fl!("touchpad", "double-click-speed"), - fl!("touchpad", "double-click-speed-desc"), + super::PRIMARY_BUTTON.as_str().into(), + TOUCHPAD_SPEED.as_str().into(), + TOUCHPAD_ACCELERAION.as_str().into(), + super::ACCELERATION_DESC.as_str().into(), + super::DISABLE_WHILE_TYPING.as_str().into(), ]) .view::(|binder, _page, section| { - let descriptions = §ion.descriptions; - let input = binder.page::().expect("input page not found"); settings::view_section(§ion.title) .add(settings::item( - &descriptions[0], + &*super::PRIMARY_BUTTON, cosmic::widget::segmented_selection::horizontal(&input.touchpad_primary_button) + .minimum_button_width(0) .on_activate(|x| Message::PrimaryButtonSelected(x, true)), )) .add( - settings::item::builder(&descriptions[1]).control(widget::slider( - 0.0..=100.0, + settings::item::builder(&*TOUCHPAD_SPEED).control(widget::slider( + 10.0..=90.0, (input .input_touchpad .acceleration @@ -66,8 +89,8 @@ fn touchpad() -> Section { )), ) .add( - settings::item::builder(&descriptions[2]) - .description(&descriptions[3]) + settings::item::builder(&*TOUCHPAD_ACCELERAION) + .description(&*super::ACCELERATION_DESC) .toggler( input .input_touchpad @@ -77,14 +100,42 @@ fn touchpad() -> Section { |x| Message::SetAcceleration(x, true), ), ) - // TODO disable while typing .add( - settings::item::builder(&descriptions[4]) - .description(&descriptions[5]) - .control(widget::slider(0..=100, 0, |x| { - Message::SetDoubleClickSpeed(x, true) - })), + settings::item::builder(&*super::DISABLE_WHILE_TYPING).toggler( + input.input_touchpad.disable_while_typing.unwrap_or(false), + |enabled| Message::DisableWhileTyping(enabled, true), + ), + ) + .apply(Element::from) + .map(crate::pages::Message::Input) + }) +} + +fn tapping_and_pinching() -> Section { + Section::default() + .title(fl!("tapping-and-pinching")) + .descriptions(vec![ + TAP_TO_CLICK.as_str().into(), + TAP_TO_CLICK_DESC.as_str().into(), + PINCH_TO_ZOOM.as_str().into(), + PINCH_TO_ZOOM_DESC.as_str().into(), + ]) + .view::(|binder, _page, _section| { + let page = binder + .page::() + .expect("input devices page not found"); + + settings::view_section(&*TAPPING_AND_PINCHING) + .add( + settings::item::builder(&*TAP_TO_CLICK).toggler( + page.input_touchpad + .tap_config + .as_ref() + .map_or(false, |x| x.enabled), + Message::TapToClick, + ), ) + .add(settings::item::builder(&*PINCH_TO_ZOOM).toggler(false, Message::PinchToZoom)) .apply(Element::from) .map(crate::pages::Message::Input) }) @@ -92,26 +143,29 @@ fn touchpad() -> Section { fn scrolling() -> Section { Section::default() - .title(fl!("mouse-scrolling")) + .title(fl!("scrolling")) .descriptions(vec![ - fl!("mouse-scrolling", "speed"), - fl!("mouse-scrolling", "natural"), - fl!("mouse-scrolling", "natural-desc"), + super::SCROLLING_SPEED.as_str().into(), + super::SCROLLING_NATURAL.as_str().into(), + super::SCROLLING_NATURAL_DESC.as_str().into(), + TWO_FINGER_SCROLLING.as_str().into(), + EDGE_SCROLLING.as_str().into(), + EDGE_SCROLLING_DESC.as_str().into(), ]) .view::(|binder, _page, section| { - let descriptions = §ion.descriptions; - - let input = binder.page::().expect("input page not found"); + let page = binder + .page::() + .expect("input devices page not found"); settings::view_section(§ion.title) + // Scroll speed slider .add(settings::item( - &descriptions[0], + &*super::SCROLLING_SPEED, // TODO show numeric value // TODO desired range? widget::slider( - 1.0..=100.0, - input - .input_touchpad + 1.0..=1000.0, + page.input_touchpad .scroll_config .as_ref() .and_then(|x| x.scroll_factor) @@ -122,20 +176,88 @@ fn scrolling() -> Section { |value| Message::SetScrollFactor(2f64.powf((value - 50.0) / 10.0), true), ), )) + // Natural scrolling toggle .add( - settings::item::builder(&descriptions[1]) - .description(&descriptions[2]) + settings::item::builder(&*super::SCROLLING_NATURAL) + .description(&*super::SCROLLING_NATURAL_DESC) .toggler( - input - .input_touchpad + page.input_touchpad + .scroll_config + .as_ref() + .map_or(false, |conf| conf.natural_scroll.unwrap_or(false)), + |enabled| Message::SetNaturalScroll(enabled, true), + ), + ) + // Two-finger scrolling toggle + .add( + settings::item::builder(&*TWO_FINGER_SCROLLING).toggler( + page.input_touchpad + .scroll_config + .as_ref() + .map_or(false, |x| matches!(x.method, Some(ScrollMethod::TwoFinger))), + |enabled| { + Message::SetScrollMethod( + enabled.then_some(ScrollMethod::TwoFinger), + true, + ) + }, + ), + ) + // Edge scrolling toggle + .add( + settings::item::builder(&*EDGE_SCROLLING) + .description(&*EDGE_SCROLLING_DESC) + .toggler( + page.input_touchpad .scroll_config .as_ref() - .and_then(|x| x.natural_scroll) - .unwrap_or(false), - |x| Message::SetNaturalScroll(x, true), + .map_or(false, |x| matches!(x.method, Some(ScrollMethod::Edge))), + |enabled| { + Message::SetScrollMethod( + enabled.then_some(ScrollMethod::Edge), + true, + ) + }, ), ) .apply(Element::from) .map(crate::pages::Message::Input) }) } + +fn swiping() -> Section { + Section::default() + .title(fl!("swiping")) + .descriptions(vec![ + SWIPING_FOUR_FINGER_DOWN.as_str().into(), + SWIPING_FOUR_FINGER_LEFT.as_str().into(), + SWIPING_FOUR_FINGER_RIGHT.as_str().into(), + SWIPING_FOUR_FINGER_UP.as_str().into(), + SWIPING_THREE_FINGER_ANY.as_str().into(), + ]) + .view::(|_binder, _page, section| { + settings::view_section(&*section.title) + .add( + settings::item::builder(&*SWIPING_THREE_FINGER_ANY) + .control(text(&*SWITCH_BETWEEN_WINDOWS)), + ) + .add( + settings::item::builder(&*SWIPING_FOUR_FINGER_UP) + .control(text(&*SWITCH_TO_PREV_WORKSPACE)), + ) + .add( + settings::item::builder(&*SWIPING_FOUR_FINGER_DOWN) + .control(text(&*SWITCH_TO_NEXT_WORKSPACE)), + ) + .add( + settings::item::builder(&*SWIPING_FOUR_FINGER_LEFT) + .control(text(&*OPEN_WORKSPACES_VIEW)), + ) + .add( + settings::item::builder(&*SWIPING_FOUR_FINGER_RIGHT) + .control(text(&*OPEN_APPLICATION_LIBRARY)), + ) + .apply(Element::from) + .map(crate::pages::Message::Input) + }) +} diff --git a/app/src/pages/sound.rs b/app/src/pages/sound.rs index 0a036278..c265138e 100644 --- a/app/src/pages/sound.rs +++ b/app/src/pages/sound.rs @@ -51,13 +51,13 @@ fn alerts() -> Section { Section::default() .title(fl!("sound-alerts")) .descriptions(vec![ - fl!("sound-alerts", "volume"), - fl!("sound-alerts", "sound"), + fl!("sound-alerts", "volume").into(), + fl!("sound-alerts", "sound").into(), ]) .view::(|_binder, _page, section| { settings::view_section(§ion.title) - .add(settings::item(§ion.descriptions[0], text("TODO"))) - .add(settings::item(§ion.descriptions[1], text("TODO"))) + .add(settings::item(&*section.descriptions[0], text("TODO"))) + .add(settings::item(&*section.descriptions[1], text("TODO"))) .into() }) } @@ -65,10 +65,10 @@ fn alerts() -> Section { fn applications() -> Section { Section::default() .title(fl!("sound-applications")) - .descriptions(vec![fl!("sound-applications", "desc")]) + .descriptions(vec![fl!("sound-applications", "desc").into()]) .view::(|_binder, _page, section| { settings::view_section(§ion.title) - .add(settings::item(§ion.descriptions[0], text("TODO"))) + .add(settings::item(&*section.descriptions[0], text("TODO"))) .into() }) } @@ -77,15 +77,15 @@ fn input() -> Section { Section::default() .title(fl!("sound-input")) .descriptions(vec![ - fl!("sound-input", "volume"), - fl!("sound-input", "device"), - fl!("sound-input", "level"), + fl!("sound-input", "volume").into(), + fl!("sound-input", "device").into(), + fl!("sound-input", "level").into(), ]) .view::(|_binder, _page, section| { settings::view_section(§ion.title) - .add(settings::item(§ion.descriptions[0], text("TODO"))) - .add(settings::item(§ion.descriptions[1], text("TODO"))) - .add(settings::item(§ion.descriptions[2], text("TODO"))) + .add(settings::item(&*section.descriptions[0], text("TODO"))) + .add(settings::item(&*section.descriptions[1], text("TODO"))) + .add(settings::item(&*section.descriptions[2], text("TODO"))) .into() }) } @@ -94,18 +94,18 @@ fn output() -> Section { Section::default() .title(fl!("sound-output")) .descriptions(vec![ - fl!("sound-output", "volume"), - fl!("sound-output", "device"), - fl!("sound-output", "level"), - fl!("sound-output", "config"), - fl!("sound-output", "balance"), + fl!("sound-output", "volume").into(), + fl!("sound-output", "device").into(), + fl!("sound-output", "level").into(), + fl!("sound-output", "config").into(), + fl!("sound-output", "balance").into(), ]) .view::(|_binder, _page, section| { settings::view_section(§ion.title) - .add(settings::item(§ion.descriptions[0], text("TODO"))) - .add(settings::item(§ion.descriptions[1], text("TODO"))) - .add(settings::item(§ion.descriptions[2], text("TODO"))) - .add(settings::item(§ion.descriptions[3], text("TODO"))) + .add(settings::item(&*section.descriptions[0], text("TODO"))) + .add(settings::item(&*section.descriptions[1], text("TODO"))) + .add(settings::item(&*section.descriptions[2], text("TODO"))) + .add(settings::item(&*section.descriptions[3], text("TODO"))) .into() }) } diff --git a/app/src/pages/system/about.rs b/app/src/pages/system/about.rs index a265fc18..8e33035b 100644 --- a/app/src/pages/system/about.rs +++ b/app/src/pages/system/about.rs @@ -3,14 +3,8 @@ use cosmic_settings_page::{self as page, section, Section}; +use cosmic::widget::{list_column, settings, text}; use cosmic::{command, Command}; -use cosmic::{ - iced::{ - widget::{horizontal_space, row}, - Length, - }, - widget::{icon, list_column, settings, text}, -}; use cosmic_settings_system::about::Info; use slotmap::SlotMap; @@ -63,11 +57,14 @@ impl Page { fn device() -> Section { Section::default() - .descriptions(vec![fl!("about-device"), fl!("about-device", "desc")]) + .descriptions(vec![ + fl!("about-device").into(), + fl!("about-device", "desc").into(), + ]) .view::(|_binder, page, section| { let desc = §ion.descriptions; - let device_name = settings::item::builder(&desc[0]) - .description(&desc[1]) + let device_name = settings::item::builder(&*desc[0]) + .description(&*desc[1]) .control(text(&page.info.device_name)); list_column().add(device_name).into() @@ -78,26 +75,26 @@ fn hardware() -> Section { Section::default() .title(fl!("about-hardware")) .descriptions(vec![ - fl!("about-hardware", "model"), - fl!("about-hardware", "memory"), - fl!("about-hardware", "processor"), - fl!("about-hardware", "graphics"), - fl!("about-hardware", "disk-capacity"), + fl!("about-hardware", "model").into(), + fl!("about-hardware", "memory").into(), + fl!("about-hardware", "processor").into(), + fl!("about-hardware", "graphics").into(), + fl!("about-hardware", "disk-capacity").into(), ]) .view::(|_binder, page, section| { let desc = §ion.descriptions; let mut sections = settings::view_section(§ion.title) - .add(settings::item(&desc[0], text(&page.info.hardware_model))) - .add(settings::item(&desc[1], text(&page.info.memory))) - .add(settings::item(&desc[2], text(&page.info.processor))); + .add(settings::item(&*desc[0], text(&page.info.hardware_model))) + .add(settings::item(&*desc[1], text(&page.info.memory))) + .add(settings::item(&*desc[2], text(&page.info.processor))); for card in &page.info.graphics { - sections = sections.add(settings::item(&desc[3], text(card.as_str()))); + sections = sections.add(settings::item(&*desc[3], text(card.as_str()))); } sections - .add(settings::item(&desc[4], text(&page.info.disk_capacity))) + .add(settings::item(&*desc[4], text(&page.info.disk_capacity))) .into() }) } @@ -106,21 +103,21 @@ fn os() -> Section { Section::default() .title(fl!("about-os")) .descriptions(vec![ - fl!("about-os", "os"), - fl!("about-os", "os-architecture"), - fl!("about-os", "desktop-environment"), - fl!("about-os", "windowing-system"), + fl!("about-os", "os").into(), + fl!("about-os", "os-architecture").into(), + fl!("about-os", "desktop-environment").into(), + fl!("about-os", "windowing-system").into(), ]) .view::(|_binder, page, section| { let desc = §ion.descriptions; settings::view_section(§ion.title) - .add(settings::item(&desc[0], text(&page.info.operating_system))) - .add(settings::item(&desc[1], text(&page.info.os_architecture))) + .add(settings::item(&*desc[0], text(&page.info.operating_system))) + .add(settings::item(&*desc[1], text(&page.info.os_architecture))) .add(settings::item( - &desc[2], + &*desc[2], text(&page.info.desktop_environment), )) - .add(settings::item(&desc[3], text(&page.info.windowing_system))) + .add(settings::item(&*desc[3], text(&page.info.windowing_system))) .into() }) } @@ -128,10 +125,10 @@ fn os() -> Section { fn related() -> Section { Section::default() .title(fl!("about-related")) - .descriptions(vec![fl!("about-related", "support")]) + .descriptions(vec![fl!("about-related", "support").into()]) .view::(|_binder, _page, section| { settings::view_section(§ion.title) - .add(settings::item(§ion.descriptions[0], text("TODO"))) + .add(settings::item(&*section.descriptions[0], text("TODO"))) .into() }) } diff --git a/app/src/pages/time/date.rs b/app/src/pages/time/date.rs index de00850c..004508c0 100644 --- a/app/src/pages/time/date.rs +++ b/app/src/pages/time/date.rs @@ -61,15 +61,18 @@ impl page::AutoBind for Page {} fn date() -> Section { Section::default() .title(fl!("time-date")) - .descriptions(vec![fl!("time-date", "auto"), fl!("time-date")]) + .descriptions(vec![ + fl!("time-date", "auto").into(), + fl!("time-date").into(), + ]) .view::(|_binder, page, section| { settings::view_section(§ion.title) .add( - settings::item::builder(§ion.descriptions[0]) + settings::item::builder(&*section.descriptions[0]) .toggler(page.auto, Message::Automatic), ) .add(settings::item( - §ion.descriptions[1], + &*section.descriptions[1], horizontal_space(Length::Fill), )) .apply(cosmic::Element::from) @@ -81,19 +84,19 @@ fn format() -> Section { Section::default() .title(fl!("time-format")) .descriptions(vec![ - fl!("time-format", "twenty-four"), - fl!("time-format", "first"), + fl!("time-format", "twenty-four").into(), + fl!("time-format", "first").into(), ]) .view::(|_binder, page, section| { settings::view_section(§ion.title) // 24-hour toggle .add( - settings::item::builder(§ion.descriptions[0]) + settings::item::builder(&*section.descriptions[0]) .toggler(page.military_time, Message::MilitaryTime), ) // First day of week .add(settings::item( - §ion.descriptions[1], + &*section.descriptions[1], horizontal_space(Length::Fill), )) .apply(cosmic::Element::from) @@ -105,21 +108,21 @@ fn timezone() -> Section { Section::default() .title(fl!("time-zone")) .descriptions(vec![ - fl!("time-zone", "auto"), - fl!("time-zone", "auto-info"), - fl!("time-zone"), + fl!("time-zone", "auto").into(), + fl!("time-zone", "auto-info").into(), + fl!("time-zone").into(), ]) .view::(|_binder, page, section| { settings::view_section(§ion.title) // Automatic timezone toggle .add( - settings::item::builder(§ion.descriptions[0]) - .description(§ion.descriptions[1]) + settings::item::builder(&*section.descriptions[0]) + .description(&*section.descriptions[1]) .toggler(page.auto_timezone, Message::AutomaticTimezone), ) // Time zone select .add( - settings::item::builder(§ion.descriptions[2]) + settings::item::builder(&*section.descriptions[2]) .control(horizontal_space(Length::Fill)), ) .apply(cosmic::Element::from) diff --git a/i18n/cs/cosmic_settings.ftl b/i18n/cs/cosmic_settings.ftl index 08f70ef2..b58e6a48 100644 --- a/i18n/cs/cosmic_settings.ftl +++ b/i18n/cs/cosmic_settings.ftl @@ -224,8 +224,16 @@ users = Uživatelé ## Input -input = Vstup - .desc = Vstup +acceleration-desc = Automaticky upravit citlivost sledování na základě rychlosti. + +primary-button = Hlavní tlačítko + .left = Levé + .right = Pravé + +scrolling = Skrolování + .speed = Rychlost skrolování + .natural = Přirozené skrolování + .natural-desc = Převrátí směr skrolování ## Input: Keyboard @@ -250,31 +258,15 @@ keyboard-shortcuts = Klávesové zkratky .desc = Zobrazit a změnit klávesové zkratky ## Input: Mouse + mouse = Myš .desc = Citlivost myši, akcelerace, přirozené skrolování. - .primary-button = Hlavní tlačítko - .primary-button-left = Levé - .primary-button-right = Pravé .speed = Citlivost myši .acceleration = Zapnout akceleraci myši - .acceleration-desc = Automaticky upravit citlivost sledování na základě rychlosti. - .double-click-speed = Rychlost dvojtého kliknutí - .double-click-speed-desc = Změní jak rychle je třeba zmáčknout dvakrát pro zaznamenání dvojkliku. - -mouse-scrolling = Skrolování - .speed = Rychlost skrolování - .natural = Přirozené skrolování - .natural-desc = Převrátí směr skrolování ## Input: Touchpad touchpad = Touchpad .desc = Citlivost touchpadu, nastavení klikání, gesta. - .primary-button = Hlavní tlačítko - .primary-button-left = Levé - .primary-button-right = Pravé .speed = Citlivost touchpadu .acceleration = Zapnout akceleraci touchpadu - .acceleration-desc = Automaticky upravit citlivost sledování na základě rychlosti. - .double-click-speed = Rychlost dvojtého kliknutí - .double-click-speed-desc = Změní jak rychle je třeba zmáčknout dvakrát pro zaznamenání dvojkliku. diff --git a/i18n/en/cosmic_settings.ftl b/i18n/en/cosmic_settings.ftl index a2dab25c..c7def176 100644 --- a/i18n/en/cosmic_settings.ftl +++ b/i18n/en/cosmic_settings.ftl @@ -356,9 +356,22 @@ users = Users ## Input +acceleration-desc = Automatically adjusts tracking sensitivity based on speed. + +disable-while-typing = Disable while typing + input-devices = Input Devices .desc = Input Devices +primary-button = Primary button + .left = Left + .right = Right + +scrolling = Scrolling + .speed = Scrolling speed + .natural = Natural scrolling + .natural-desc = Scroll the content, instead of the view + ## Input: Keyboard keyboard = Keyboard @@ -382,31 +395,43 @@ keyboard-shortcuts = Keyboard Shortcuts .desc = View and customize shortcuts ## Input: Mouse + mouse = Mouse .desc = Mouse speed, acceleration, natural scrolling. - .primary-button = Primary button - .primary-button-left = Left - .primary-button-right = Right .speed = Mouse speed .acceleration = Enable mouse acceleration - .acceleration-desc = Automatically adjusts tracking sensitivty based on speed. - .double-click-speed = Double-click speed - .double-click-speed-desc = Changes how fast double-clicks have to be to register. - -mouse-scrolling = Scrolling - .speed = Scrolling speed - .natural = Natural scrolling - .natural-desc = Scroll the content, instead of the view ## Input: Touchpad +edge-scrolling = Edge scrolling + .desc = Scroll using the edge of the touchpad. + +pinch-to-zoom = Pinch to zoom + .desc = Use two fingers to zoom into content, for applications that support zoom. + +tap-to-click = Tap to click + .desc = Enables single-finger tap for primary click, two-finger tap for secondary click, and three-finger tap for middle click. + +tapping-and-pinching = Tapping and Pinching + touchpad = Touchpad + .acceleration = Enable touchpad acceleration .desc = Touchpad speed, click options, gestures. - .primary-button = Primary button - .primary-button-left = Left - .primary-button-right = Right .speed = Touchpad speed - .acceleration = Enable touchpad acceleration - .acceleration-desc = Automatically adjusts tracking sensitivty based on speed. - .double-click-speed = Double-click speed - .double-click-speed-desc = Changes how fast double-clicks have to be to register. + +two-finger-scrolling = Two-finger scrolling + +## Input: Gestures + +swiping = Swiping + .four-finger-down = Four-finger swipe down + .four-finger-left = Four-finger swipe left + .four-finger-right = Four-finger swipe right + .four-finger-up = Four-finger swipe up + .three-finger-any = Three-finger swip any direction + +switch-between-windows = Switch between windows +switch-to-next-workspace = Switch to next workspace +switch-to-prev-workspace = Switch to prev workspace +open-application-library = Open Application Library +open-workspaces-view = Open Workspaces Overview \ No newline at end of file diff --git a/i18n/it/cosmic_settings.ftl b/i18n/it/cosmic_settings.ftl index 7bb96e12..89c1536c 100644 --- a/i18n/it/cosmic_settings.ftl +++ b/i18n/it/cosmic_settings.ftl @@ -295,8 +295,16 @@ users = Utenti ## Input -input = Input - .desc = Input +acceleration-desc = Aggiusta automaticamente la sensibilità di tracciamento in base alla velocità. + +primary-button = Tasto principale + .left = Sinistro + .right = Destro + +scrolling = Scorrimento + .speed = Velocità di scorrimento + .natural = Scorrimento naturale + .natural-desc = Scorri il contenuto invece che la visualizzazione ## Input: Keyboard @@ -321,31 +329,15 @@ keyboard-shortcuts = Scorciatoie da Tastiera .desc = Vedi e personalizza le scorciatoie ## Input: Mouse + mouse = Mouse .desc = Velocità, accelerazione, scorrimento naturale del mouse. - .primary-button = Tasto principale - .primary-button-left = Sinistro - .primary-button-right = Destro .speed = Velocità mouse .acceleration = Abilita accelerazione mouse - .acceleration-desc = Aggiusta automaticamente la sensibilità di tracciamento in base alla velocità. - .double-click-speed = Velocità doppio-click - .double-click-speed-desc = Cambia quanto deve essere veloce il doppio-click per essere riconosciuto tale. - -mouse-scrolling = Scorrimento - .speed = Velocità di scorrimento - .natural = Scorrimento naturale - .natural-desc = Scorri il contenuto invece che la visualizzazione ## Input: Touchpad touchpad = Touchpad .desc = Velocità, opzioni click e movimenti sul touchpad. - .primary-button = Tasto principale - .primary-button-left = Sinistro - .primary-button-right = Destro .speed = Velocità touchpad .acceleration = Abilita accelerazione touchpad - .acceleration-desc = Aggiusta automaticamente la sensibilità di tracciamento in base alla velocità. - .double-click-speed = Velocità doppio-click - .double-click-speed-desc = Cambia quanto deve essere veloce il doppio-click per essere riconosciuto tale. diff --git a/i18n/pl/cosmic_settings.ftl b/i18n/pl/cosmic_settings.ftl index ac4664a7..06c91204 100644 --- a/i18n/pl/cosmic_settings.ftl +++ b/i18n/pl/cosmic_settings.ftl @@ -367,8 +367,19 @@ users = Użytkownicy ## Input -input = Wprowadzanie Danych - .desc = Wprowadzanie Danych +acceleration-desc = Automatycznie dostosuj dokładność śledzenia opierając się na szybkości ruchu myszki. + +input-devices = Urządzenia Wejściowe + .desc = Urządzenia Wejściowe + +primary-button = Główny przycisk + .left = Lewy + .right = Prawy + +scrolling = Przewijanie + .speed = Prędkość przewijania + .natural = Naturalne przewijanie + .natural-desc = Przewijaj zawartość, nie widok ## Input: Keyboard @@ -395,29 +406,12 @@ keyboard-shortcuts = Skróty Klawiaturowe ## Input: Mouse mouse = Myszka .desc = Prędkość, przyśpieszenie i naturalne przewijanie myszki - .primary-button = Główny przycisk - .primary-button-left = Lewy - .primary-button-right = Prawy .speed = Prędkość myszki .acceleration = Włącz przyśpieszenie myszki - .acceleration-desc = Automatycznie dostosuj dokładność śledzenia opierając się na szybkości ruchu myszki. - .double-click-speed = Prędkość podwójnego kliknięcia - .double-click-speed-desc = Ustawia to, jak szybkie musi być podwójnego kliknięcia, by było zarejestrowane. - -mouse-scrolling = Przewijanie - .speed = Prędkość przewijania - .natural = Naturalne przewijanie - .natural-desc = Przewijaj zawartość, nie widok ## Input: Touchpad touchpad = Gładzik .desc = Prędkość, opcje klikania i gesty gładzikiem. - .primary-button = Główny przycisk - .primary-button-left = Lewy - .primary-button-right = Prawy .speed = Prędkość Gładzika .acceleration = Włącz przyśpieszenie gładzika - .acceleration-desc = Automatycznie dostosuj dokładność śledzenia opierając się na szybkości ruchu gładzika. - .double-click-speed = Prędkość podwójnego kliknięcia - .double-click-speed-desc = Ustawia to, jak szybkie musi być podwójnego kliknięcia, by było zarejestrowane. diff --git a/i18n/ru/cosmic_settings.ftl b/i18n/ru/cosmic_settings.ftl index 2cad3631..6f32602f 100644 --- a/i18n/ru/cosmic_settings.ftl +++ b/i18n/ru/cosmic_settings.ftl @@ -295,8 +295,16 @@ users = Пользователи ## Input -input = Ввод - .desc = Ввод +acceleration-desc = Автоматически регулирует чувствительность панели в зависимости от скорости. + +primary-button = Основная кнопка + .left = Левая + .right = Правая + +scrolling = Прокрутка + .speed = Скорость прокрутки + .natural = Естественная прокрутка + .natural-desc = Прокручивать содержимое, а не представление ## Input: Keyboard @@ -323,29 +331,12 @@ keyboard-shortcuts = Сочетания клавиш ## Input: Mouse mouse = Мышь .desc = Скорость и ускорение мыши, естественная прокрутка. - .primary-button = Основная кнопка - .primary-button-left = Левая - .primary-button-right = Правая .speed = Скорость мыши .acceleration = Включить ускорение мыши - .acceleration-desc = Автоматически регулирует чувствительность мыши в зависимости от скорости. - .double-click-speed = Скорость двойного нажатия - .double-click-speed-desc = Изменить скорость регистрации двойных нажатий. - -mouse-scrolling = Прокрутка - .speed = Скорость прокрутки - .natural = Естественная прокрутка - .natural-desc = Прокручивать содержимое, а не представление ## Input: Touchpad touchpad = Сенсорная панель .desc = Скорость сенсорной панели, параметры нажатия, жесты. - .primary-button = Основная кнопка - .primary-button-left = Левая - .primary-button-right = Правая .speed = Скорость сенсорной панели - .acceleration = Включить ускорение сенсорной панели - .acceleration-desc = Автоматически регулирует чувствительность панели в зависимости от скорости. - .double-click-speed = Скорость двойного нажатия - .double-click-speed-desc = Изменить скорость регистрации двойных нажатий. \ No newline at end of file + .acceleration = Включить ускорение сенсорной панели \ No newline at end of file diff --git a/i18n/sr-Cyrl/cosmic_settings.ftl b/i18n/sr-Cyrl/cosmic_settings.ftl index 3c438d35..30dc3841 100644 --- a/i18n/sr-Cyrl/cosmic_settings.ftl +++ b/i18n/sr-Cyrl/cosmic_settings.ftl @@ -12,7 +12,7 @@ desktop = Радна површина appearance = Изглед .desc = Боје детаља и промена COSMIC палете. - + accent-color = Боја детаља app-background = Позадина апликација или прозора auto = Аутоматски @@ -40,7 +40,7 @@ container-background = Позадина контејнера .desc-detail = Боја позадине контејнера се користи за бочну траку за навигацију, бочни мени, дијалошке оквире и друге сличне виџете. Подразумевано, аутоматски се изводи из позадине апликација или прозора. .reset = Врати на аутоматско .desc = Боја позадине контејнера се користи за бочну траку за навигацију, бочни мени, дијалошке оквире и друге сличне виџете. - + control-tint = Нијанса контролних компоненти .desc = Користи се за позадину стандардних дугмади, уноса за претрагу, уноса текста и сличних компоненти. @@ -139,12 +139,12 @@ notifications = Обавештења desktop-panel-options = Радна површина и панел .desc = Улога Super тастера, лепљиви углови, контрола прозора. - + desktop-panels-and-applets = Панели радне површине и аплети dock = Док .desc = Трака са закаченим апликацијама. - + hot-corner = Лепљиви углови .top-left-corner = Укључити горњи леви лепљиви угао за радне просторе @@ -165,7 +165,7 @@ window-controls = Контрола прозора panel = Горњи панел .desc = Горња трака са контролама радне површине и менијима. - + add = Додај add-applet = Додај аплет all = Све @@ -254,7 +254,7 @@ workspaces-behavior = Понашање радних простора workspaces-multi-behavior = Понашање са више монитора .span = Радни простори су заједнички за све екране .separate = Екрани имају одвојене радне просторе - + workspaces-overview-thumbnails = Приказ радних простора у прегледу .show-number = Прикажи број радног простора .show-name = Прикажи име радног простора @@ -357,8 +357,16 @@ users = Корисници ## Input -input = Унос - .desc = Унос +acceleration-desc = Аутоматски подешава осетљивост праћења на основу брзине. + +primary-button = Примарно дугме + .left = Лево + .right = Десно + +scrolling = Померање + .speed = Брзина померања + .natural = Природно померање + .natural-desc = Окретање точка помера садржај уместо приказа. ## Input: Keyboard @@ -385,29 +393,12 @@ keyboard-shortcuts = Пречице на тастатури ## Input: Mouse mouse = Миш .desc = Брзина миша, убрзање, природно померање. - .primary-button = Примарно дугме - .primary-button-left = Лево - .primary-button-right = Десно .speed = Брзина миша .acceleration = Омогући убрзање миша - .acceleration-desc = Аутоматски подешава осетљивост праћења на основу брзине. - .double-click-speed = Брзина двоструког клика - .double-click-speed-desc = Мења потребну брзину за регистровање двоструких кликова. - -mouse-scrolling = Померање - .speed = Брзина померања - .natural = Природно померање - .natural-desc = Окретање точка помера садржај уместо приказа. ## Input: Touchpad touchpad = Додирна табла .desc = Брзина додирне табле, опције клика, покрети. - .primary-button = Примарно дугме - .primary-button-left = Лево - .primary-button-right = Десно .speed = Брзина додирне табле - .acceleration = Омогући убрзање додирне табле - .acceleration-desc = Аутоматски подешава осетљивост праћења на основу брзине. - .double-click-speed = Брзина двоструког клика - .double-click-speed-desc = Мења потребну брзину за регистровање двоструких кликова. + .acceleration = Омогући убрзање додирне табле \ No newline at end of file diff --git a/i18n/sr-Latn/cosmic_settings.ftl b/i18n/sr-Latn/cosmic_settings.ftl index c2c793e9..17710529 100644 --- a/i18n/sr-Latn/cosmic_settings.ftl +++ b/i18n/sr-Latn/cosmic_settings.ftl @@ -40,16 +40,16 @@ container-background = Pozadina kontejnera .desc-detail = Boja pozadine kontejnera se koristi za bočnu traku za navigaciju, bočni meni, dijaloške okvire i druge slične vidžete. Podrazumevano, automatski se izvodi iz pozadine aplikacija ili prozora. .reset = Vrati na automatsko .desc = Boja pozadine kontejnera se koristi za bočnu traku za navigaciju, bočni meni, dijaloške okvire i druge slične vidžete. - + control-tint = Nijansa kontrolnih komponenti .desc = Koristi se za pozadinu standardnih dugmadi, unosa za pretragu, unosa teksta i sličnih komponenti. - + frosted = Efekat mat stakla na interfejsu sistema .desc = Primenjuje zamućenje pozadine na panel, dok, aplete, pokretač i biblioteku aplikacija. - + text-tint = Nijansa teksta interfejsa .desc = Boja koja se koristi za dobijanje boja teksta interfejsa koje imaju dovoljan kontrast na različitim površinama. - + style = Stil .round = Okrugli .slightly-round = Blago okrugli @@ -139,12 +139,12 @@ notifications = Obaveštenja desktop-panel-options = Radna površina i panel .desc = Uloga Super tastera, lepljivi uglovi, kontrola prozora. - + desktop-panels-and-applets = Paneli radne površine i apleti dock = Dok .desc = Traka sa zakačenim aplikacijama. - + hot-corner = Lepljivi uglovi .top-left-corner = Uključiti gornji levi lepljivi ugao za radne prostore @@ -165,7 +165,7 @@ window-controls = Kontrola prozora panel = Gornji panel .desc = Gornja traka sa kontrolama radne površine i menijima. - + add = Dodaj add-applet = Dodaj aplet all = Sve @@ -254,7 +254,7 @@ workspaces-behavior = Ponašanje radnih prostora workspaces-multi-behavior = Ponašanje sa više monitora .span = Radni prostori su zajednički za sve ekrane .separate = Ekrani imaju odvojene radne prostore - + workspaces-overview-thumbnails = Prikaz radnih prostora u pregledu .show-number = Prikaži broj radnog prostora .show-name = Prikaži ime radnog prostora @@ -357,8 +357,16 @@ users = Korisnici ## Input -input = Unos - .desc = Unos +acceleration-desc = Automatski podešava osetljivost praćenja na osnovu brzine. + +primary-button = Primarno dugme + .left = Levo + .right = Desno + +scrolling = Pomeranje + .speed = Brzina pomeranja + .natural = Prirodno pomeranje + .natural-desc = Okretanje točka pomera sadržaj umesto prikaza. ## Input: Keyboard @@ -383,31 +391,15 @@ keyboard-shortcuts = Prečice na tastaturi .desc = Pregledajte i prilagodite prečice ## Input: Mouse + mouse = Miš .desc = Brzina miša, ubrzanje, prirodno pomeranje. - .primary-button = Primarno dugme - .primary-button-left = Levo - .primary-button-right = Desno .speed = Brzina miša .acceleration = Omogući ubrzanje miša - .acceleration-desc = Automatski podešava osetljivost praćenja na osnovu brzine. - .double-click-speed = Brzina dvostrukog klika - .double-click-speed-desc = Menja potrebnu brzinu za registrovanje dvostrukih klikova. - -mouse-scrolling = Pomeranje - .speed = Brzina pomeranja - .natural = Prirodno pomeranje - .natural-desc = Okretanje točka pomera sadržaj umesto prikaza. ## Input: Touchpad touchpad = Dodirna tabla .desc = Brzina dodirne table, opcije klika, pokreti. - .primary-button = Primarno dugme - .primary-button-left = Levo - .primary-button-right = Desno .speed = Brzina dodirne table - .acceleration = Omogući ubrzanje dodirne table - .acceleration-desc = Automatski podešava osetljivost praćenja na osnovu brzine. - .double-click-speed = Brzina dvostrukog klika - .double-click-speed-desc = Menja potrebnu brzinu za registrovanje dvostrukih klikova. + .acceleration = Omogući ubrzanje dodirne table \ No newline at end of file diff --git a/i18n/sv/cosmic_settings.ftl b/i18n/sv/cosmic_settings.ftl index 35926a63..48f9da1e 100644 --- a/i18n/sv/cosmic_settings.ftl +++ b/i18n/sv/cosmic_settings.ftl @@ -351,12 +351,20 @@ firmware = Fast programvara users = Användare .desc = Autentisering och login, låsskärm. -## Inmatning +## Input -input = Inmatning - .desc = Inmatning +acceleration-desc = Justerar automatiskt spårningskänsligheten baserat på hastighet. -## Input: Tangentbord +primary-button = Primär knapp + .left = Vänster + .right = Höger + +scrolling = Rullning + .speed = Rullningshastighet + .natural = Naturlig rullning + .natural-desc = Rulla igenom innehållet istället för vyn + +## Input: Keyboard keyboard = Tangentbord .desc = Tangentbordsinmatning @@ -373,37 +381,21 @@ keyboard-special-char = Specialteckenssinmatning .alternate = Alternativa tecken-knapp .compose = Compose knapp -## Inmatning: Tangentbord: Genvägar +## Input: Keyboard shortcuts keyboard-shortcuts = Tangentbordsgenvägar .desc = Visa och anpassa genvägar -## Inmatning: Mus +## Input: Mouse + mouse = Mus .desc = Mushastighet, acceleration, naturlig rullning. - .primary-button = Primär knapp - .primary-button-left = Vänster - .primary-button-right = Höger .speed = Mushastighet .acceleration = Aktivera mus acceleration - .acceleration-desc = Justerar automatiskt spårningskänsligheten baserat på hastighet. - .double-click-speed = Dubbelklickshastighet - .double-click-speed-desc = Ändrar hur snabba dubbelklick måste vara för att registreras. - -mouse-scrolling = Rullning - .speed = Rullningshastighet - .natural = Naturlig rullning - .natural-desc = Rulla igenom innehållet istället för vyn -## Inmatning: Pekplatta +## Input: Touchpad touchpad = Pekplatta .desc = Pekplattans hastighet, klickalternativ, gester. - .primary-button = Primär knapp - .primary-button-left = Vänster - .primary-button-right = Höger .speed = Pekplattans hastighet - .acceleration = Aktivera pekplattans acceleration - .acceleration-desc = Justerar automatiskt spårningskänsligheten baserat på hastighet. - .double-click-speed = Dubbelklickshastighet - .double-click-speed-desc = Ändrar hur snabba dubbelklick måste vara för att registreras. + .acceleration = Aktivera pekplattans acceleration \ No newline at end of file diff --git a/i18n/zh-TW/cosmic_settings.ftl b/i18n/zh-TW/cosmic_settings.ftl index b0e36944..a795af6b 100644 --- a/i18n/zh-TW/cosmic_settings.ftl +++ b/i18n/zh-TW/cosmic_settings.ftl @@ -263,8 +263,16 @@ users = 使用者 ## Input -input = 輸入 - .desc = 輸入 +acceleration-desc = 自動依照觸控板移動加速度即時變更滑鼠速度 + +primary-button = 主要按鈕 + .left = 左 + .right = 右 + +scrolling = 捲動 + .speed = 捲動速度 + .natural = 自然捲動 + .natural-desc = 捲動內容而非視界 ## Input: Keyboard @@ -289,31 +297,15 @@ keyboard-shortcuts = 鍵盤快捷鍵 .desc = 顯示與修改快捷鍵 ## Input: Mouse + mouse = 滑鼠 .desc = 滑鼠靈敏度、加速及捲動設定 - .primary-button = 主要按鈕 - .primary-button-left = 左 - .primary-button-right = 右 .speed = 滑鼠速度 .acceleration = 啟用滑鼠加速 - .acceleration-desc = 自動依照滑鼠移動加速度即時變更滑鼠速度 - .double-click-speed = 按兩下按鈕的速度 - .double-click-speed-desc = 設定雙按兩下按鈕要以多短的間隔才會觸發按兩下事件 - -mouse-scrolling = 捲動 - .speed = 捲動速度 - .natural = 自然捲動 - .natural-desc = 捲動內容而非視界 ## Input: Touchpad touchpad = 觸控板 .desc = 觸控靈敏度、點擊和手勢 - .primary-button = 主要按鈕 - .primary-button-left = 左 - .primary-button-right = 右 .speed = 觸控靈敏度 - .acceleration = 啟用觸控板加速 - .acceleration-desc = 自動依照觸控板移動加速度即時變更滑鼠速度 - .double-click-speed = 按兩下觸控板的速度 - .double-click-speed-desc = 設定按兩下觸控板要以多短的間隔才會觸發按兩下事件 + .acceleration = 啟用觸控板加速 \ No newline at end of file diff --git a/page/src/section.rs b/page/src/section.rs index 6d75b081..335eb843 100644 --- a/page/src/section.rs +++ b/page/src/section.rs @@ -3,6 +3,7 @@ use derive_setters::Setters; use regex::Regex; +use std::borrow::Cow; use crate::{Binder, Page}; @@ -29,7 +30,8 @@ pub type ViewFn = Box< pub struct Section { #[setters(into)] pub title: String, - pub descriptions: Vec, + #[setters(into)] + pub descriptions: Vec>, #[setters(skip)] pub show_while: Option>, #[setters(skip)] @@ -61,8 +63,8 @@ impl Section { return true; } - for description in &self.descriptions { - if rule.is_match(description.as_str()) { + for description in &*self.descriptions { + if rule.is_match(description) { return true; } } diff --git a/pages/system/src/about.rs b/pages/system/src/about.rs index 47fe8d47..e8d11a24 100644 --- a/pages/system/src/about.rs +++ b/pages/system/src/about.rs @@ -129,7 +129,7 @@ pub fn hardware_model(bump: &Bump, hardware_model: &mut String) { None => name, }; - strcat!(&mut *hardware_model, " " name); + let _str = strcat!(&mut *hardware_model, " " name); } let buffer = &mut bumpalo::collections::Vec::new_in(bump); @@ -137,7 +137,7 @@ pub fn hardware_model(bump: &Bump, hardware_model: &mut String) { version = version.trim(); if !version.is_empty() && !VERSION_IGNORING_PRODUCTS.contains(&name) { - strcat!(hardware_model, " (" version.trim() ")"); + let _str = strcat!(hardware_model, " (" version.trim() ")"); } } }