diff --git a/.zed/settings.json b/.zed/settings.json new file mode 100644 index 0000000..2cc7b98 --- /dev/null +++ b/.zed/settings.json @@ -0,0 +1,15 @@ +{ + "format_on_save": "on", + "lsp": { + "rust-analyzer": { + "initialization_options": { + "check": { + "command": "clippy", + }, + "rustfmt": { + "extraArgs": ["+nightly"], + }, + }, + }, + }, +} diff --git a/cosmic-settings/build.rs b/cosmic-settings/build.rs index 4f0dd04..5be3e7c 100644 --- a/cosmic-settings/build.rs +++ b/cosmic-settings/build.rs @@ -1,4 +1,5 @@ -use std::{env, fs, path::PathBuf}; +use std::path::PathBuf; +use std::{env, fs}; use xdgen::{App, Context, FluentString}; fn main() { diff --git a/cosmic-settings/src/app.rs b/cosmic-settings/src/app.rs index dfac360..bbeec4a 100644 --- a/cosmic-settings/src/app.rs +++ b/cosmic-settings/src/app.rs @@ -5,7 +5,6 @@ use crate::PageCommands; use crate::config::Config; #[cfg(feature = "page-accessibility")] use crate::pages::accessibility; -use crate::pages::applications; #[cfg(feature = "page-bluetooth")] use crate::pages::bluetooth; use crate::pages::desktop::{self, appearance}; @@ -19,26 +18,21 @@ use crate::pages::networking; use crate::pages::power; #[cfg(feature = "page-sound")] use crate::pages::sound; -use crate::pages::{self, system, time}; +use crate::pages::{self, applications, system, time}; use crate::subscription::desktop_files; use crate::widget::{page_title, search_header}; +use cosmic::app::context_drawer::ContextDrawer; +use cosmic::app::{Core, Task}; #[cfg(feature = "wayland")] use cosmic::cctk::{sctk::output::OutputInfo, wayland_client::protocol::wl_output::WlOutput}; -use cosmic::{ - Element, - app::{Core, Task, context_drawer::ContextDrawer}, - iced::{ - self, Length, Subscription, - event::{self, PlatformSpecific}, - keyboard, window, - }, - prelude::*, - surface, - widget::{ - button, column, container, icon, id_container, nav_bar, row, scrollable, segmented_button, - settings, text_input, - }, +use cosmic::iced::event::{self, PlatformSpecific}; +use cosmic::iced::{self, Length, Subscription, keyboard, window}; +use cosmic::prelude::*; +use cosmic::widget::{ + button, column, container, icon, id_container, nav_bar, row, scrollable, segmented_button, + settings, text_input, }; +use cosmic::{Element, surface}; #[cfg(feature = "cosmic-comp-config")] use cosmic_comp_config::CosmicCompConfig; #[cfg(feature = "wayland")] @@ -52,8 +46,9 @@ use desktop::{ #[cfg(feature = "wayland")] use event::wayland; use page::Entity; +use std::borrow::Cow; use std::collections::BTreeSet; -use std::{borrow::Cow, str::FromStr}; +use std::str::FromStr; #[allow(clippy::struct_excessive_bools)] #[allow(clippy::module_name_repetitions)] diff --git a/cosmic-settings/src/config.rs b/cosmic-settings/src/config.rs index 88de69e..9856f63 100644 --- a/cosmic-settings/src/config.rs +++ b/cosmic-settings/src/config.rs @@ -1,10 +1,8 @@ // Copyright 2023 System76 // SPDX-License-Identifier: GPL-3.0-only -use cosmic::{ - cosmic_config::{self, ConfigGet, ConfigSet}, - cosmic_theme::palette::Srgba, -}; +use cosmic::cosmic_config::{self, ConfigGet, ConfigSet}; +use cosmic::cosmic_theme::palette::Srgba; const NAME: &str = "com.system76.CosmicSettings"; diff --git a/cosmic-settings/src/localize.rs b/cosmic-settings/src/localize.rs index 25aee1d..3e4d237 100644 --- a/cosmic-settings/src/localize.rs +++ b/cosmic-settings/src/localize.rs @@ -1,10 +1,8 @@ // Copyright 2023 System76 // SPDX-License-Identifier: GPL-3.0-only -use i18n_embed::{ - DefaultLocalizer, LanguageLoader, Localizer, - fluent::{FluentLanguageLoader, fluent_language_loader}, -}; +use i18n_embed::fluent::{FluentLanguageLoader, fluent_language_loader}; +use i18n_embed::{DefaultLocalizer, LanguageLoader, Localizer}; use rust_embed::RustEmbed; use std::sync::LazyLock; diff --git a/cosmic-settings/src/main.rs b/cosmic-settings/src/main.rs index cb68840..3c18d77 100644 --- a/cosmic-settings/src/main.rs +++ b/cosmic-settings/src/main.rs @@ -24,7 +24,8 @@ pub mod widget; use std::path::PathBuf; use clap::{Parser, Subcommand}; -use cosmic::{app::CosmicFlags, iced::Limits}; +use cosmic::app::CosmicFlags; +use cosmic::iced::Limits; use i18n_embed::DesktopLanguageRequester; use ron::error::SpannedError; use serde::{Deserialize, Serialize}; diff --git a/cosmic-settings/src/pages/accessibility/magnifier.rs b/cosmic-settings/src/pages/accessibility/magnifier.rs index d476b71..7dae60d 100644 --- a/cosmic-settings/src/pages/accessibility/magnifier.rs +++ b/cosmic-settings/src/pages/accessibility/magnifier.rs @@ -1,20 +1,15 @@ use std::collections::HashSet; use std::fmt::Write; -use cosmic::{ - Apply, - iced::core::text::Wrapping, - iced::{Element, Length, stream}, - surface, - widget::{self, icon, settings, svg, text}, -}; +use cosmic::iced::core::text::Wrapping; +use cosmic::iced::{Element, Length, stream}; +use cosmic::widget::{self, icon, settings, svg, text}; +use cosmic::{Apply, surface}; use cosmic_comp_config::{ZoomConfig, ZoomMovement}; use cosmic_config::{ConfigGet, ConfigSet}; use cosmic_settings_config::{Action, Binding, shortcuts}; -use cosmic_settings_page::{ - self as page, Entity, - section::{self, Section}, -}; +use cosmic_settings_page::section::{self, Section}; +use cosmic_settings_page::{self as page, Entity}; use futures::SinkExt; use slotmap::SlotMap; use tracing::error; diff --git a/cosmic-settings/src/pages/accessibility/mod.rs b/cosmic-settings/src/pages/accessibility/mod.rs index f8b75f2..919b5e5 100644 --- a/cosmic-settings/src/pages/accessibility/mod.rs +++ b/cosmic-settings/src/pages/accessibility/mod.rs @@ -1,21 +1,16 @@ -use cosmic::{ - Apply, Element, Task, - cosmic_theme::{CosmicPalette, ThemeBuilder}, - iced::core::text::Wrapping, - iced::stream, - surface, - theme::CosmicTheme, - widget::{dropdown, settings, text}, -}; +use cosmic::cosmic_theme::{CosmicPalette, ThemeBuilder}; +use cosmic::iced::core::text::Wrapping; +use cosmic::iced::stream; +use cosmic::theme::CosmicTheme; +use cosmic::widget::{dropdown, settings, text}; +use cosmic::{Apply, Element, Task, surface}; pub use cosmic_comp_config::ZoomMovement; use cosmic_config::CosmicConfigEntry; use cosmic_settings_a11y_manager_subscription as cosmic_a11y_manager; use cosmic_settings_accessibility_subscription as a11y_bus; use cosmic_settings_daemon_config::CosmicSettingsDaemonConfig; -use cosmic_settings_page::{ - self as page, Insert, - section::{self, Section}, -}; +use cosmic_settings_page::section::{self, Section}; +use cosmic_settings_page::{self as page, Insert}; use futures::SinkExt; use num_traits::FromPrimitive; use slotmap::SlotMap; diff --git a/cosmic-settings/src/pages/applications/default_apps.rs b/cosmic-settings/src/pages/applications/default_apps.rs index ee759e3..8512ab9 100644 --- a/cosmic-settings/src/pages/applications/default_apps.rs +++ b/cosmic-settings/src/pages/applications/default_apps.rs @@ -2,19 +2,14 @@ // Copyright 2024 bbb651 // SPDX-License-Identifier: GPL-3.0-only -use std::{ - borrow::Cow, - collections::{BTreeMap, BTreeSet}, - path::{Path, PathBuf}, - sync::Arc, -}; +use std::borrow::Cow; +use std::collections::{BTreeMap, BTreeSet}; +use std::path::{Path, PathBuf}; +use std::sync::Arc; -use cosmic::{ - Apply, Element, Task, - iced::{Alignment, Length}, - surface, - widget::{self, dropdown, icon, settings}, -}; +use cosmic::iced::{Alignment, Length}; +use cosmic::widget::{self, dropdown, icon, settings}; +use cosmic::{Apply, Element, Task, surface}; use cosmic_config::{ConfigGet, ConfigSet}; use cosmic_settings_config::shortcuts::SystemActions; use cosmic_settings_config::shortcuts::action::System; diff --git a/cosmic-settings/src/pages/applications/legacy_applications.rs b/cosmic-settings/src/pages/applications/legacy_applications.rs index a21d605..f2a1b20 100644 --- a/cosmic-settings/src/pages/applications/legacy_applications.rs +++ b/cosmic-settings/src/pages/applications/legacy_applications.rs @@ -1,25 +1,17 @@ // Copyright 2023 System76 // SPDX-License-Identifier: GPL-3.0-only -use std::{ - process::ExitStatus, - sync::{ - Arc, - atomic::{AtomicBool, Ordering}, - }, -}; +use std::process::ExitStatus; +use std::sync::Arc; +use std::sync::atomic::{AtomicBool, Ordering}; -use cosmic::{ - Apply, Element, Task, - cosmic_config::{self, ConfigGet, ConfigSet}, - iced::stream, - surface, - widget::{self, dropdown, settings, text}, -}; +use cosmic::cosmic_config::{self, ConfigGet, ConfigSet}; +use cosmic::iced::stream; +use cosmic::widget::{self, dropdown, settings, text}; +use cosmic::{Apply, Element, Task, surface}; use cosmic_comp_config::{EavesdroppingKeyboardMode, XwaylandDescaling, XwaylandEavesdropping}; use cosmic_randr_shell::List; -use cosmic_settings_page::Section; -use cosmic_settings_page::{self as page, section}; +use cosmic_settings_page::{self as page, Section, section}; use futures::SinkExt; use slotmap::SlotMap; use tokio::sync::oneshot; diff --git a/cosmic-settings/src/pages/bluetooth/mod.rs b/cosmic-settings/src/pages/bluetooth/mod.rs index f8d1338..7ffec0a 100644 --- a/cosmic-settings/src/pages/bluetooth/mod.rs +++ b/cosmic-settings/src/pages/bluetooth/mod.rs @@ -3,7 +3,8 @@ use cosmic::iced::core::text::Wrapping; use cosmic::iced::{Alignment, Length, color}; -use cosmic::widget::{self, settings, space::horizontal as horizontal_space, text}; +use cosmic::widget::space::horizontal as horizontal_space; +use cosmic::widget::{self, settings, text}; use cosmic::{Apply, Element, Task, theme}; use cosmic_settings_bluetooth_subscription::*; use cosmic_settings_page::{self as page, Section, section}; diff --git a/cosmic-settings/src/pages/desktop/appearance/drawer.rs b/cosmic-settings/src/pages/desktop/appearance/drawer.rs index 7b7caa0..5e33fd6 100644 --- a/cosmic-settings/src/pages/desktop/appearance/drawer.rs +++ b/cosmic-settings/src/pages/desktop/appearance/drawer.rs @@ -3,11 +3,9 @@ use cosmic::config::CosmicTk; use cosmic::cosmic_config::{Config, ConfigSet}; use cosmic::cosmic_theme::Spacing; use cosmic::iced::core::{Color, Length}; -use cosmic::widget::{ - ColorPickerModel, color_picker::ColorPickerUpdate, container, flex_row, settings, text, -}; -use cosmic::{Apply, Task}; -use cosmic::{Element, widget}; +use cosmic::widget::color_picker::ColorPickerUpdate; +use cosmic::widget::{ColorPickerModel, container, flex_row, settings, text}; +use cosmic::{Apply, Element, Task, widget}; use cosmic_config::ConfigGet; use std::sync::Arc; use tracing::error; @@ -15,11 +13,8 @@ use tracing::error; use crate::app; use crate::widget::color_picker_context_view; -use super::{ - ContextView, Message, font_config, icon_themes, - icon_themes::{IconHandles, IconThemes}, - theme_manager, -}; +use super::icon_themes::{IconHandles, IconThemes}; +use super::{ContextView, Message, font_config, icon_themes, theme_manager}; pub struct Content { context_view: Option, diff --git a/cosmic-settings/src/pages/desktop/appearance/font_config.rs b/cosmic-settings/src/pages/desktop/appearance/font_config.rs index d2b2558..92905dd 100644 --- a/cosmic-settings/src/pages/desktop/appearance/font_config.rs +++ b/cosmic-settings/src/pages/desktop/appearance/font_config.rs @@ -3,11 +3,8 @@ use std::sync::Arc; -use cosmic::{ - Apply, Element, Task, - config::{CosmicTk, FontConfig}, - widget, -}; +use cosmic::config::{CosmicTk, FontConfig}; +use cosmic::{Apply, Element, Task, widget}; use cosmic_config::ConfigSet; use crate::app; diff --git a/cosmic-settings/src/pages/desktop/appearance/icon_themes.rs b/cosmic-settings/src/pages/desktop/appearance/icon_themes.rs index 5dc4620..112568c 100644 --- a/cosmic-settings/src/pages/desktop/appearance/icon_themes.rs +++ b/cosmic-settings/src/pages/desktop/appearance/icon_themes.rs @@ -1,14 +1,13 @@ // Copyright 2024 System76 // SPDX-License-Identifier: GPL-3.0-only -use std::{collections::BTreeMap, path::PathBuf}; +use std::collections::BTreeMap; +use std::path::PathBuf; use super::Message; -use cosmic::{ - Element, - iced::{Background, Length}, - widget::{button, icon, text}, -}; +use cosmic::Element; +use cosmic::iced::{Background, Length}; +use cosmic::widget::{button, icon, text}; use tokio::io::AsyncBufReadExt; const ICON_PREV_N: usize = 6; diff --git a/cosmic-settings/src/pages/desktop/appearance/mod.rs b/cosmic-settings/src/pages/desktop/appearance/mod.rs index c1934b6..e07fbe7 100644 --- a/cosmic-settings/src/pages/desktop/appearance/mod.rs +++ b/cosmic-settings/src/pages/desktop/appearance/mod.rs @@ -21,14 +21,13 @@ use cosmic::cosmic_theme::{CornerRadii, Density, Roundness, ThemeBuilder, ThemeM use cosmic::dialog::file_chooser::{self, FileFilter}; use cosmic::iced::Subscription; use cosmic::iced::core::{Alignment, Length}; -use cosmic::widget::{ - button, color_picker::ColorPickerUpdate, container, row, settings, space::horizontal, text, -}; +use cosmic::widget::color_picker::ColorPickerUpdate; +use cosmic::widget::space::horizontal; +use cosmic::widget::{button, container, row, settings, text}; use cosmic::{Apply, Element, Task, widget}; #[cfg(feature = "wayland")] use cosmic_panel_config::CosmicPanelConfig; -use cosmic_settings_page::Section; -use cosmic_settings_page::{self as page, section}; +use cosmic_settings_page::{self as page, Section, section}; use ron::ser::PrettyConfig; use slotmap::{Key, SlotMap}; diff --git a/cosmic-settings/src/pages/desktop/appearance/style.rs b/cosmic-settings/src/pages/desktop/appearance/style.rs index 6db3477..160b794 100644 --- a/cosmic-settings/src/pages/desktop/appearance/style.rs +++ b/cosmic-settings/src/pages/desktop/appearance/style.rs @@ -1,4 +1,5 @@ -use cosmic::iced::core::{Alignment, Length, text::Wrapping}; +use cosmic::iced::core::text::Wrapping; +use cosmic::iced::core::{Alignment, Length}; use cosmic::widget::icon::{from_name, icon}; use cosmic::widget::{button, container, settings, text}; use cosmic::{Apply, Element}; diff --git a/cosmic-settings/src/pages/desktop/dock/applets.rs b/cosmic-settings/src/pages/desktop/dock/applets.rs index 5dc1923..a8a9dc4 100644 --- a/cosmic-settings/src/pages/desktop/dock/applets.rs +++ b/cosmic-settings/src/pages/desktop/dock/applets.rs @@ -1,22 +1,16 @@ -use cosmic::{ - Apply, Element, Task, - app::ContextDrawer, - cosmic_config::CosmicConfigEntry, - iced::{Alignment, Length}, - widget::{button, container, row}, -}; +use cosmic::app::ContextDrawer; +use cosmic::cosmic_config::CosmicConfigEntry; +use cosmic::iced::{Alignment, Length}; +use cosmic::widget::{button, container, row}; +use cosmic::{Apply, Element, Task}; use cosmic_panel_config::CosmicPanelConfig; use cosmic_settings_page::{self as page, Section, section}; use slotmap::{Key, SlotMap}; use std::borrow::Cow; -use crate::{ - app, - pages::{ - self, - desktop::panel::applets_inner::{self, AppletsPage, ContextDrawerVariant, lists}, - }, -}; +use crate::app; +use crate::pages::desktop::panel::applets_inner::{self, AppletsPage, ContextDrawerVariant, lists}; +use crate::pages::{self}; pub(crate) struct Page { inner: applets_inner::Page, diff --git a/cosmic-settings/src/pages/desktop/dock/mod.rs b/cosmic-settings/src/pages/desktop/dock/mod.rs index 40738aa..a118e91 100644 --- a/cosmic-settings/src/pages/desktop/dock/mod.rs +++ b/cosmic-settings/src/pages/desktop/dock/mod.rs @@ -1,11 +1,8 @@ use std::collections::HashMap; -use cosmic::Apply; -use cosmic::{ - Element, Task, - cosmic_config::{ConfigSet, CosmicConfigEntry}, - widget::{settings, text}, -}; +use cosmic::cosmic_config::{ConfigSet, CosmicConfigEntry}; +use cosmic::widget::{settings, text}; +use cosmic::{Apply, Element, Task}; use cosmic_panel_config::{CosmicPanelConfig, CosmicPanelContainerConfig}; use cosmic_settings_page::{self as page, Section, section}; use slotmap::SlotMap; diff --git a/cosmic-settings/src/pages/desktop/panel/applets_inner.rs b/cosmic-settings/src/pages/desktop/panel/applets_inner.rs index bd0ed6c..8f75940 100644 --- a/cosmic-settings/src/pages/desktop/panel/applets_inner.rs +++ b/cosmic-settings/src/pages/desktop/panel/applets_inner.rs @@ -10,23 +10,21 @@ use cosmic::iced; use cosmic::iced::core::clipboard::IconSurface; use cosmic::widget::{Column, button, column, container, icon, list_column, row, text, text_input}; -use cosmic::{ - Apply, Element, - cosmic_config::{Config, CosmicConfigEntry}, - iced::core::{ - Clipboard, Shell, Widget, layout, renderer, - widget::{Operation, Tree, tree}, - }, - iced::runtime::{Task, core::id::Id}, - iced::{ - Alignment, Border, Color, Length, Point, Rectangle, Size, Vector, core::window, event, - mouse, overlay, touch, - }, - theme, +use cosmic::cosmic_config::{Config, CosmicConfigEntry}; +use cosmic::iced::core::widget::{Operation, Tree, tree}; +use cosmic::iced::core::{Clipboard, Shell, Widget, layout, renderer, window}; +use cosmic::iced::runtime::Task; +use cosmic::iced::runtime::core::id::Id; +use cosmic::iced::{ + Alignment, Border, Color, Length, Point, Rectangle, Size, Vector, event, mouse, overlay, touch, }; +use cosmic::{Apply, Element, theme}; +use std::borrow::Cow; +use std::fmt::Debug; +use std::mem; use std::path::{Path, PathBuf}; -use std::{borrow::Cow, fmt::Debug, mem, sync::LazyLock}; +use std::sync::LazyLock; use crate::{app, pages}; use cosmic_panel_config::CosmicPanelConfig; diff --git a/cosmic-settings/src/pages/desktop/panel/inner.rs b/cosmic-settings/src/pages/desktop/panel/inner.rs index 3627398..7d5dd85 100644 --- a/cosmic-settings/src/pages/desktop/panel/inner.rs +++ b/cosmic-settings/src/pages/desktop/panel/inner.rs @@ -1,12 +1,11 @@ -use cosmic::{ - Element, Task, - cctk::sctk::reexports::client::{Proxy, backend::ObjectId, protocol::wl_output::WlOutput}, - cosmic_config::{self, CosmicConfigEntry}, - cosmic_theme::{Density, Roundness}, - iced::{Alignment, Length}, - surface, - widget::{button, container, dropdown, row, settings, slider, space, text}, -}; +use cosmic::cctk::sctk::reexports::client::Proxy; +use cosmic::cctk::sctk::reexports::client::backend::ObjectId; +use cosmic::cctk::sctk::reexports::client::protocol::wl_output::WlOutput; +use cosmic::cosmic_config::{self, CosmicConfigEntry}; +use cosmic::cosmic_theme::{Density, Roundness}; +use cosmic::iced::{Alignment, Length}; +use cosmic::widget::{button, container, dropdown, row, settings, slider, space, text}; +use cosmic::{Element, Task, surface}; use cosmic::Apply; use cosmic_config::ConfigSet; @@ -15,7 +14,8 @@ use cosmic_panel_config::{ CosmicPanelOuput, PanelAnchor, PanelSize, }; use cosmic_settings_page::{self as page, Section}; -use std::{collections::HashMap, time::Duration}; +use std::collections::HashMap; +use std::time::Duration; pub struct PageInner { pub(crate) config_helper: Option, diff --git a/cosmic-settings/src/pages/desktop/panel/mod.rs b/cosmic-settings/src/pages/desktop/panel/mod.rs index 4f98e64..72aa66b 100644 --- a/cosmic-settings/src/pages/desktop/panel/mod.rs +++ b/cosmic-settings/src/pages/desktop/panel/mod.rs @@ -1,6 +1,7 @@ use std::collections::HashMap; -use cosmic::{Task, cosmic_config::CosmicConfigEntry}; +use cosmic::Task; +use cosmic::cosmic_config::CosmicConfigEntry; use cosmic_panel_config::{CosmicPanelConfig, CosmicPanelContainerConfig}; use cosmic_settings_page::{self as page, Section, section}; use slotmap::SlotMap; diff --git a/cosmic-settings/src/pages/desktop/wallpaper/mod.rs b/cosmic-settings/src/pages/desktop/wallpaper/mod.rs index 7f99b25..b3acb5a 100644 --- a/cosmic-settings/src/pages/desktop/wallpaper/mod.rs +++ b/cosmic-settings/src/pages/desktop/wallpaper/mod.rs @@ -7,37 +7,25 @@ pub mod widgets; pub use config::Config; use url::Url; -use std::{ - collections::HashMap, - path::{Path, PathBuf}, - sync::Arc, -}; +use std::collections::HashMap; +use std::path::{Path, PathBuf}; +use std::sync::Arc; +use cosmic::app::ContextDrawer; #[cfg(feature = "xdg-portal")] use cosmic::dialog::file_chooser; -use cosmic::{ - Apply, Element, Task, - iced::core::text::{Ellipsize, EllipsizeHeightLimit}, - widget::{ColorPickerModel, color_picker::ColorPickerUpdate, icon}, -}; -use cosmic::{app::ContextDrawer, iced::runtime::core::image::Handle as ImageHandle}; -use cosmic::{ - iced::Subscription, - widget::{ - button, dropdown, list_column, row, - segmented_button::{self, SingleSelectModel}, - settings, - space::horizontal as horizontal_space, - tab_bar, text, - }, -}; -use cosmic::{ - iced::{Alignment, Color, Length, window}, - surface, +use cosmic::iced::core::text::{Ellipsize, EllipsizeHeightLimit}; +use cosmic::iced::runtime::core::image::Handle as ImageHandle; +use cosmic::iced::{Alignment, Color, Length, Subscription, window}; +use cosmic::widget::color_picker::ColorPickerUpdate; +use cosmic::widget::segmented_button::{self, SingleSelectModel}; +use cosmic::widget::space::horizontal as horizontal_space; +use cosmic::widget::{ + ColorPickerModel, button, dropdown, icon, list_column, row, settings, tab_bar, text, }; +use cosmic::{Apply, Element, Task, surface}; use cosmic_bg_config::Source; -use cosmic_settings_page::Section; -use cosmic_settings_page::{self as page, section}; +use cosmic_settings_page::{self as page, Section, section}; use cosmic_settings_wallpaper::{self as wallpaper, Entry, ScalingMode}; use image::imageops::FilterType::Lanczos3; use image::{ImageBuffer, Rgba}; diff --git a/cosmic-settings/src/pages/desktop/wallpaper/widgets.rs b/cosmic-settings/src/pages/desktop/wallpaper/widgets.rs index f9d2bcb..e71efde 100644 --- a/cosmic-settings/src/pages/desktop/wallpaper/widgets.rs +++ b/cosmic-settings/src/pages/desktop/wallpaper/widgets.rs @@ -3,8 +3,8 @@ use super::Message; use cosmic::iced::Radius; -use cosmic::iced::core::Border; -use cosmic::iced::core::{Background, Color, Degrees, Length, gradient::Linear}; +use cosmic::iced::core::gradient::Linear; +use cosmic::iced::core::{Background, Border, Color, Degrees, Length}; use cosmic::iced::runtime::core::image::Handle as ImageHandle; use cosmic::prelude::*; use cosmic::widget::{Space, button, container}; diff --git a/cosmic-settings/src/pages/desktop/window_management.rs b/cosmic-settings/src/pages/desktop/window_management.rs index b93e0f8..b3b130f 100644 --- a/cosmic-settings/src/pages/desktop/window_management.rs +++ b/cosmic-settings/src/pages/desktop/window_management.rs @@ -1,18 +1,14 @@ // Copyright 2023 System76 // SPDX-License-Identifier: GPL-3.0-only -use cosmic::{ - Apply, Element, - iced::Length, - surface, - widget::{self, settings}, -}; +use cosmic::iced::Length; +use cosmic::widget::{self, settings}; +use cosmic::{Apply, Element, surface}; use cosmic_comp_config::CosmicCompConfig; use cosmic_config::{ConfigGet, ConfigSet}; use cosmic_settings_config::{Action, Binding, Shortcuts, shortcuts}; -use cosmic_settings_page::Section; -use cosmic_settings_page::{self as page, section}; +use cosmic_settings_page::{self as page, Section, section}; use slotmap::SlotMap; use tracing::error; diff --git a/cosmic-settings/src/pages/desktop/workspaces.rs b/cosmic-settings/src/pages/desktop/workspaces.rs index 6f5e1f2..ecb93a3 100644 --- a/cosmic-settings/src/pages/desktop/workspaces.rs +++ b/cosmic-settings/src/pages/desktop/workspaces.rs @@ -3,15 +3,11 @@ // TODO make settings work -use cosmic::{ - Apply, Element, - cosmic_config::{self, ConfigGet, ConfigSet}, - surface, - widget::{self, settings}, -}; +use cosmic::cosmic_config::{self, ConfigGet, ConfigSet}; +use cosmic::widget::{self, settings}; +use cosmic::{Apply, Element, surface}; use cosmic_comp_config::workspace::{Action, WorkspaceConfig, WorkspaceLayout, WorkspaceMode}; -use cosmic_settings_page::Section; -use cosmic_settings_page::{self as page, section}; +use cosmic_settings_page::{self as page, Section, section}; use slotmap::SlotMap; use tracing::error; diff --git a/cosmic-settings/src/pages/display/arrangement.rs b/cosmic-settings/src/pages/display/arrangement.rs index 61d99e4..0eced7f 100644 --- a/cosmic-settings/src/pages/display/arrangement.rs +++ b/cosmic-settings/src/pages/display/arrangement.rs @@ -5,11 +5,9 @@ use cosmic::Renderer; use cosmic::iced::core::renderer::Quad; use cosmic::iced::core::widget::{Tree, tree}; use cosmic::iced::core::{ - self as core, Border, Clipboard, Element, Layout, Length, Rectangle, Renderer as IcedRenderer, - Shell, Size, Widget, + self as core, Border, Clipboard, Element, Layout, Length, Point, Rectangle, + Renderer as IcedRenderer, Shell, Size, Widget, alignment, layout, mouse, renderer, text, touch, }; -use cosmic::iced::core::{Point, layout, mouse, renderer, touch}; -use cosmic::iced::core::{alignment, text}; use cosmic::widget::segmented_button::{self, SingleSelectModel}; use cosmic_randr_shell::{self as randr, OutputKey}; use randr::Transform; diff --git a/cosmic-settings/src/pages/display/mod.rs b/cosmic-settings/src/pages/display/mod.rs index 1b73211..eba2ee7 100644 --- a/cosmic-settings/src/pages/display/mod.rs +++ b/cosmic-settings/src/pages/display/mod.rs @@ -20,9 +20,10 @@ use cosmic_settings_page::{self as page, Section, section}; use futures::SinkExt; use indexmap::Equivalent; use slotmap::{Key, SecondaryMap, SlotMap}; +use std::collections::BTreeMap; +use std::process::ExitStatus; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::{Arc, LazyLock}; -use std::{collections::BTreeMap, process::ExitStatus}; use tokio::sync::oneshot; static DPI_SCALES: &[u32] = &[50, 75, 100, 125, 150, 175, 200, 225, 250, 275, 300]; diff --git a/cosmic-settings/src/pages/input/keyboard/mod.rs b/cosmic-settings/src/pages/input/keyboard/mod.rs index 468ecbb..2372c90 100644 --- a/cosmic-settings/src/pages/input/keyboard/mod.rs +++ b/cosmic-settings/src/pages/input/keyboard/mod.rs @@ -5,14 +5,11 @@ pub mod shortcuts; use std::cmp; -use cosmic::{ - Apply, Element, Task, - app::{ContextDrawer, context_drawer}, - cosmic_config::{self, ConfigSet}, - iced::{Alignment, Length}, - theme, - widget::{self, ListColumn, button, container, icon, list, row, settings}, -}; +use cosmic::app::{ContextDrawer, context_drawer}; +use cosmic::cosmic_config::{self, ConfigSet}; +use cosmic::iced::{Alignment, Length}; +use cosmic::widget::{self, ListColumn, button, container, icon, list, row, settings}; +use cosmic::{Apply, Element, Task, theme}; use cosmic_comp_config::{KeyboardConfig, NumlockState, XkbConfig}; use cosmic_settings_page::{self as page, Section, section}; use itertools::Itertools; diff --git a/cosmic-settings/src/pages/input/keyboard/shortcuts/common.rs b/cosmic-settings/src/pages/input/keyboard/shortcuts/common.rs index 669c3e7..5e6a558 100644 --- a/cosmic-settings/src/pages/input/keyboard/shortcuts/common.rs +++ b/cosmic-settings/src/pages/input/keyboard/shortcuts/common.rs @@ -652,7 +652,8 @@ impl Model { modifiers, .. }) => { - use cosmic::iced::keyboard::{Key, key::Named}; + use cosmic::iced::keyboard::Key; + use cosmic::iced::keyboard::key::Named; if matches!( key, @@ -669,7 +670,8 @@ impl Model { location, .. }) => { - use cosmic::iced::keyboard::{Key, key::Named}; + use cosmic::iced::keyboard::Key; + use cosmic::iced::keyboard::key::Named; if matches!( key, diff --git a/cosmic-settings/src/pages/input/keyboard/shortcuts/custom.rs b/cosmic-settings/src/pages/input/keyboard/shortcuts/custom.rs index 7b04dea..d15f4dc 100644 --- a/cosmic-settings/src/pages/input/keyboard/shortcuts/custom.rs +++ b/cosmic-settings/src/pages/input/keyboard/shortcuts/custom.rs @@ -590,7 +590,8 @@ impl page::Page for Page { &self, core: &cosmic::Core, ) -> cosmic::iced::Subscription { - use cosmic::iced::{self, event::listen_with}; + use cosmic::iced::event::listen_with; + use cosmic::iced::{self}; cosmic::iced::Subscription::batch(vec![ if self.add_shortcut.active @@ -605,7 +606,8 @@ impl page::Page for Page { modifiers, .. }) => { - use cosmic::iced::keyboard::{Key, key::Named}; + use cosmic::iced::keyboard::Key; + use cosmic::iced::keyboard::key::Named; if matches!( key, Key::Named(Named::Super | Named::Alt | Named::Control | Named::Shift) @@ -624,7 +626,8 @@ impl page::Page for Page { location, .. }) => { - use cosmic::iced::keyboard::{Key, key::Named}; + use cosmic::iced::keyboard::Key; + use cosmic::iced::keyboard::key::Named; if matches!( key, Key::Named(Named::Super | Named::Alt | Named::Control | Named::Shift) diff --git a/cosmic-settings/src/pages/input/keyboard/shortcuts/manage_windows.rs b/cosmic-settings/src/pages/input/keyboard/shortcuts/manage_windows.rs index 3d14669..394f5fe 100644 --- a/cosmic-settings/src/pages/input/keyboard/shortcuts/manage_windows.rs +++ b/cosmic-settings/src/pages/input/keyboard/shortcuts/manage_windows.rs @@ -2,8 +2,9 @@ // SPDX-License-Identifier: GPL-3.0-only use super::{ShortcutMessage, ShortcutModel}; +use cosmic::app::ContextDrawer; use cosmic::iced::platform_specific::shell::wayland::commands::keyboard_shortcuts_inhibit; -use cosmic::{Element, Task, app::ContextDrawer}; +use cosmic::{Element, Task}; use cosmic_settings_config::shortcuts::Action; use cosmic_settings_config::shortcuts::action::ResizeDirection; use cosmic_settings_page::{self as page, Section, section}; diff --git a/cosmic-settings/src/pages/input/keyboard/shortcuts/mod.rs b/cosmic-settings/src/pages/input/keyboard/shortcuts/mod.rs index ab60609..0635893 100644 --- a/cosmic-settings/src/pages/input/keyboard/shortcuts/mod.rs +++ b/cosmic-settings/src/pages/input/keyboard/shortcuts/mod.rs @@ -15,7 +15,8 @@ pub mod tiling; use cosmic::app::ContextDrawer; use cosmic::iced::Length; -use cosmic::widget::{self, list::ListButton, settings, text}; +use cosmic::widget::list::ListButton; +use cosmic::widget::{self, settings, text}; use cosmic::{Apply, Element, Task}; use cosmic_config::ConfigGet; use cosmic_settings_config::Binding; @@ -23,8 +24,7 @@ use cosmic_settings_config::shortcuts::action::{ Direction, FocusDirection, Orientation, ResizeDirection, }; use cosmic_settings_config::shortcuts::{self, Action, Shortcuts}; -use cosmic_settings_page::Section; -use cosmic_settings_page::{self as page, section}; +use cosmic_settings_page::{self as page, Section, section}; use itertools::Itertools; use shortcuts::action::System as SystemAction; use slab::Slab; diff --git a/cosmic-settings/src/pages/input/keyboard/shortcuts/move_window.rs b/cosmic-settings/src/pages/input/keyboard/shortcuts/move_window.rs index f0ca09c..15389ed 100644 --- a/cosmic-settings/src/pages/input/keyboard/shortcuts/move_window.rs +++ b/cosmic-settings/src/pages/input/keyboard/shortcuts/move_window.rs @@ -2,8 +2,9 @@ // SPDX-License-Identifier: GPL-3.0-only // use super::{ShortcutMessage, ShortcutModel}; +use cosmic::app::ContextDrawer; use cosmic::iced::platform_specific::shell::wayland::commands::keyboard_shortcuts_inhibit; -use cosmic::{Element, Task, app::ContextDrawer}; +use cosmic::{Element, Task}; use cosmic_settings_config::shortcuts::Action; use cosmic_settings_config::shortcuts::action::Direction; use cosmic_settings_page::{self as page, Section, section}; diff --git a/cosmic-settings/src/pages/input/keyboard/shortcuts/system.rs b/cosmic-settings/src/pages/input/keyboard/shortcuts/system.rs index 02c2277..788f147 100644 --- a/cosmic-settings/src/pages/input/keyboard/shortcuts/system.rs +++ b/cosmic-settings/src/pages/input/keyboard/shortcuts/system.rs @@ -2,8 +2,9 @@ // SPDX-License-Identifier: GPL-3.0-only use super::{ShortcutMessage, ShortcutModel}; +use cosmic::app::ContextDrawer; use cosmic::iced::platform_specific::shell::wayland::commands::keyboard_shortcuts_inhibit; -use cosmic::{Element, Task, app::ContextDrawer}; +use cosmic::{Element, Task}; use cosmic_settings_config::shortcuts::Action; use cosmic_settings_config::shortcuts::action::System as SystemAction; use cosmic_settings_page::{self as page, Section, section}; diff --git a/cosmic-settings/src/pages/input/keyboard/shortcuts/tiling.rs b/cosmic-settings/src/pages/input/keyboard/shortcuts/tiling.rs index aa0717d..1b40522 100644 --- a/cosmic-settings/src/pages/input/keyboard/shortcuts/tiling.rs +++ b/cosmic-settings/src/pages/input/keyboard/shortcuts/tiling.rs @@ -2,8 +2,9 @@ // SPDX-License-Identifier: GPL-3.0-only use super::{ShortcutMessage, ShortcutModel}; +use cosmic::app::ContextDrawer; use cosmic::iced::platform_specific::shell::wayland::commands::keyboard_shortcuts_inhibit; -use cosmic::{Element, Task, app::ContextDrawer}; +use cosmic::{Element, Task}; use cosmic_settings_config::shortcuts::Action; use cosmic_settings_config::shortcuts::action::Orientation; use cosmic_settings_page::{self as page, Section, section}; diff --git a/cosmic-settings/src/pages/input/mod.rs b/cosmic-settings/src/pages/input/mod.rs index 560f740..10613dc 100644 --- a/cosmic-settings/src/pages/input/mod.rs +++ b/cosmic-settings/src/pages/input/mod.rs @@ -2,10 +2,8 @@ // SPDX-License-Identifier: GPL-3.0-only use crate::app; -use cosmic::{ - Task, - cosmic_config::{self, ConfigGet, ConfigSet}, -}; +use cosmic::Task; +use cosmic::cosmic_config::{self, ConfigGet, ConfigSet}; use cosmic_comp_config::input::{ AccelConfig, AccelProfile, ClickMethod, InputConfig, ScrollConfig, ScrollMethod, TapButtonMap, TapConfig, diff --git a/cosmic-settings/src/pages/input/mouse.rs b/cosmic-settings/src/pages/input/mouse.rs index a32eb57..849820f 100644 --- a/cosmic-settings/src/pages/input/mouse.rs +++ b/cosmic-settings/src/pages/input/mouse.rs @@ -5,8 +5,7 @@ use cosmic::iced::{Alignment, Length}; use cosmic::widget::{self, row, settings, text}; use cosmic::{Apply, Element}; use cosmic_comp_config::input::AccelProfile; -use cosmic_settings_page::Section; -use cosmic_settings_page::{self as page, section}; +use cosmic_settings_page::{self as page, Section, section}; use slotmap::SlotMap; use super::Message; diff --git a/cosmic-settings/src/pages/input/touchpad.rs b/cosmic-settings/src/pages/input/touchpad.rs index ba667ef..29d167c 100644 --- a/cosmic-settings/src/pages/input/touchpad.rs +++ b/cosmic-settings/src/pages/input/touchpad.rs @@ -8,8 +8,7 @@ use cosmic::{Apply, Element}; use cosmic_comp_config::CosmicCompConfig; use cosmic_comp_config::input::{AccelProfile, ClickMethod, ScrollMethod}; use cosmic_comp_config::workspace::{WorkspaceConfig, WorkspaceLayout}; -use cosmic_settings_page::Section; -use cosmic_settings_page::{self as page, section}; +use cosmic_settings_page::{self as page, Section, section}; use slotmap::SlotMap; use tracing::error; diff --git a/cosmic-settings/src/pages/networking/mod.rs b/cosmic-settings/src/pages/networking/mod.rs index 8382e38..f9b4a4c 100644 --- a/cosmic-settings/src/pages/networking/mod.rs +++ b/cosmic-settings/src/pages/networking/mod.rs @@ -5,14 +5,14 @@ pub mod vpn; pub mod wifi; pub mod wired; -use std::{ffi::OsStr, process::Stdio, sync::Arc}; +use std::ffi::OsStr; +use std::process::Stdio; +use std::sync::Arc; use anyhow::Context; use cosmic::{Apply, Element, Task, widget}; -use cosmic_dbus_networkmanager::{ - interface::enums::{DeviceState, DeviceType}, - nm::NetworkManager, -}; +use cosmic_dbus_networkmanager::interface::enums::{DeviceState, DeviceType}; +use cosmic_dbus_networkmanager::nm::NetworkManager; use cosmic_settings_network_manager_subscription as network_manager; use cosmic_settings_page::{self as page, Section, section}; use futures::{SinkExt, StreamExt}; diff --git a/cosmic-settings/src/pages/networking/vpn/mod.rs b/cosmic-settings/src/pages/networking/vpn/mod.rs index d9cf113..4e8c150 100644 --- a/cosmic-settings/src/pages/networking/vpn/mod.rs +++ b/cosmic-settings/src/pages/networking/vpn/mod.rs @@ -8,16 +8,16 @@ use std::sync::{Arc, LazyLock}; use anyhow::Context; use cosmic::dialog::file_chooser::FileFilter; -use cosmic::task; -use cosmic::{ - Apply, Element, Task, - iced::core::text::Wrapping, - iced::{Alignment, Length}, - widget::{self, icon, space::horizontal as horizontal_space, text_input::focus}, -}; +use cosmic::iced::core::text::Wrapping; +use cosmic::iced::{Alignment, Length}; +use cosmic::widget::space::horizontal as horizontal_space; +use cosmic::widget::text_input::focus; +use cosmic::widget::{self, icon}; +use cosmic::{Apply, Element, Task, task}; +use cosmic_settings_network_manager_subscription::current_networks::ActiveConnectionInfo; use cosmic_settings_network_manager_subscription::nm_secret_agent::{self, PasswordFlag}; use cosmic_settings_network_manager_subscription::{ - self as network_manager, NetworkManagerState, UUID, current_networks::ActiveConnectionInfo, + self as network_manager, NetworkManagerState, UUID, }; use cosmic_settings_page::{self as page, Section, section}; use futures::{FutureExt, SinkExt, StreamExt}; diff --git a/cosmic-settings/src/pages/networking/wifi.rs b/cosmic-settings/src/pages/networking/wifi.rs index bc194ef..53c0a37 100644 --- a/cosmic-settings/src/pages/networking/wifi.rs +++ b/cosmic-settings/src/pages/networking/wifi.rs @@ -1,25 +1,22 @@ // Copyright 2024 System76 // SPDX-License-Identifier: GPL-3.0-only -use std::{ - collections::{BTreeMap, BTreeSet}, - sync::{Arc, LazyLock}, -}; +use std::collections::{BTreeMap, BTreeSet}; +use std::sync::{Arc, LazyLock}; use anyhow::Context; -use cosmic::{ - Apply, Element, Task, - app::ContextDrawer, - iced::core::text::Wrapping, - iced::{Alignment, Length, widget::operation::focus_next}, - task, - widget::{self, column, icon, space::horizontal, text_input::focus}, -}; +use cosmic::app::ContextDrawer; +use cosmic::iced::core::text::Wrapping; +use cosmic::iced::widget::operation::focus_next; +use cosmic::iced::{Alignment, Length}; +use cosmic::widget::space::horizontal; +use cosmic::widget::text_input::focus; +use cosmic::widget::{self, column, icon}; +use cosmic::{Apply, Element, Task, task}; +use cosmic_settings_network_manager_subscription::available_wifi::{AccessPoint, NetworkType}; +use cosmic_settings_network_manager_subscription::current_networks::ActiveConnectionInfo; use cosmic_settings_network_manager_subscription::{ - self as network_manager, NetworkManagerState, - available_wifi::{AccessPoint, NetworkType}, - current_networks::ActiveConnectionInfo, - nm_secret_agent, + self as network_manager, NetworkManagerState, nm_secret_agent, }; use cosmic_settings_page::{self as page, Section, section}; use futures::{SinkExt, StreamExt}; diff --git a/cosmic-settings/src/pages/networking/wired.rs b/cosmic-settings/src/pages/networking/wired.rs index 18bb8af..104d4a0 100644 --- a/cosmic-settings/src/pages/networking/wired.rs +++ b/cosmic-settings/src/pages/networking/wired.rs @@ -1,19 +1,18 @@ // Copyright 2024 System76 // SPDX-License-Identifier: GPL-3.0-only -use std::{collections::BTreeSet, sync::Arc}; +use std::collections::BTreeSet; +use std::sync::Arc; use anyhow::Context; -use cosmic::{ - Apply, Element, Task, - iced::core::text::Wrapping, - iced::{Alignment, Length}, - widget::{self, icon, space::horizontal as horizontal_space}, -}; +use cosmic::iced::core::text::Wrapping; +use cosmic::iced::{Alignment, Length}; +use cosmic::widget::space::horizontal as horizontal_space; +use cosmic::widget::{self, icon}; +use cosmic::{Apply, Element, Task}; use cosmic_dbus_networkmanager::interface::enums::DeviceState; -use cosmic_settings_network_manager_subscription::{ - self as network_manager, NetworkManagerState, current_networks::ActiveConnectionInfo, -}; +use cosmic_settings_network_manager_subscription::current_networks::ActiveConnectionInfo; +use cosmic_settings_network_manager_subscription::{self as network_manager, NetworkManagerState}; use cosmic_settings_page::{self as page, Section, section}; use futures::{SinkExt, StreamExt}; diff --git a/cosmic-settings/src/pages/power/backend/mod.rs b/cosmic-settings/src/pages/power/backend/mod.rs index fd9ca73..afff003 100644 --- a/cosmic-settings/src/pages/power/backend/mod.rs +++ b/cosmic-settings/src/pages/power/backend/mod.rs @@ -1,7 +1,9 @@ -use futures::{FutureExt, Stream, StreamExt, future::join_all}; +use futures::future::join_all; +use futures::{FutureExt, Stream, StreamExt}; use jiff::{Span, SpanRelativeTo, SpanRound, ToSpan, Unit}; use upower_dbus::{BatteryState, BatteryType, DeviceProxy}; -use zbus::{Connection, zvariant::ObjectPath}; +use zbus::Connection; +use zbus::zvariant::ObjectPath; mod ppdaemon; mod s76powerdaemon; diff --git a/cosmic-settings/src/pages/power/mod.rs b/cosmic-settings/src/pages/power/mod.rs index b68b135..33e75d6 100644 --- a/cosmic-settings/src/pages/power/mod.rs +++ b/cosmic-settings/src/pages/power/mod.rs @@ -3,12 +3,11 @@ mod backend; use self::backend::{GetCurrentPowerProfile, SetPowerProfile}; use backend::{Battery, ConnectedDevice, PowerProfile}; -use cosmic::Task; use cosmic::iced::core::text::{Ellipsize, EllipsizeHeightLimit}; use cosmic::iced::widget::{column, row}; use cosmic::iced::{self, Alignment, Length, stream}; use cosmic::widget::{self, settings, space, text}; -use cosmic::{Apply, surface}; +use cosmic::{Apply, Task, surface}; use cosmic_config::{Config, CosmicConfigEntry}; use cosmic_idle_config::CosmicIdleConfig; use cosmic_settings_page::{self as page, Section, section}; diff --git a/cosmic-settings/src/pages/sound/mod.rs b/cosmic-settings/src/pages/sound/mod.rs index a2a7699..fa27e9a 100644 --- a/cosmic-settings/src/pages/sound/mod.rs +++ b/cosmic-settings/src/pages/sound/mod.rs @@ -3,12 +3,10 @@ pub mod device_profiles; -use cosmic::{ - Apply, Element, Task, - iced::{Alignment, Length, window}, - surface, - widget::{self, settings, space::horizontal as horizontal_space}, -}; +use cosmic::iced::{Alignment, Length, window}; +use cosmic::widget::space::horizontal as horizontal_space; +use cosmic::widget::{self, settings}; +use cosmic::{Apply, Element, Task, surface}; use cosmic_config::{Config, ConfigGet, ConfigSet}; use cosmic_settings_page::{self as page, Section, section}; use cosmic_settings_sound_subscription as subscription; diff --git a/cosmic-settings/src/pages/system/info.rs b/cosmic-settings/src/pages/system/info.rs index be737fc..69b3540 100644 --- a/cosmic-settings/src/pages/system/info.rs +++ b/cosmic-settings/src/pages/system/info.rs @@ -3,7 +3,9 @@ #[cfg(feature = "wgpu")] use cosmic::iced::wgpu; -use std::{collections::HashMap, collections::HashSet, ffi::OsStr, process::Command}; +use std::collections::{HashMap, HashSet}; +use std::ffi::OsStr; +use std::process::Command; #[must_use] #[derive(Clone, Debug, Default)] diff --git a/cosmic-settings/src/pages/system/users/mod.rs b/cosmic-settings/src/pages/system/users/mod.rs index 5d23597..2e48195 100644 --- a/cosmic-settings/src/pages/system/users/mod.rs +++ b/cosmic-settings/src/pages/system/users/mod.rs @@ -4,25 +4,22 @@ mod getent; use crate::pages; -use cosmic::{ - Apply, Element, - dialog::file_chooser, - iced::{Alignment, Length}, - widget::{self, column, icon, list, row, settings, space::horizontal, text}, -}; +use cosmic::dialog::file_chooser; +use cosmic::iced::{Alignment, Length}; +use cosmic::widget::space::horizontal; +use cosmic::widget::{self, column, icon, list, row, settings, text}; +use cosmic::{Apply, Element}; use cosmic_settings_page::{self as page, Section, section}; use image::GenericImageView; use pwhash::{bcrypt, md5_crypt, sha256_crypt, sha512_crypt}; use regex::Regex; use slotmap::SlotMap; -use std::{ - collections::HashMap, - fs::File, - future::Future, - io::{BufRead, BufReader}, - path::{Path, PathBuf}, - sync::Arc, -}; +use std::collections::HashMap; +use std::fs::File; +use std::future::Future; +use std::io::{BufRead, BufReader}; +use std::path::{Path, PathBuf}; +use std::sync::Arc; use url::Url; use zbus_polkit::policykit1::CheckAuthorizationFlags; diff --git a/cosmic-settings/src/pages/time/date.rs b/cosmic-settings/src/pages/time/date.rs index 2ff4e67..8127127 100644 --- a/cosmic-settings/src/pages/time/date.rs +++ b/cosmic-settings/src/pages/time/date.rs @@ -2,24 +2,19 @@ // SPDX-License-Identifier: GPL-3.0-only use crate::widget::selection_context_item; -use cosmic::{ - Apply, Element, Task, - app::ContextDrawer, - cosmic_config::{self, ConfigGet, ConfigSet}, - iced::core::text::Wrapping, - surface, - widget::{self, dropdown, settings}, -}; +use cosmic::app::ContextDrawer; +use cosmic::cosmic_config::{self, ConfigGet, ConfigSet}; +use cosmic::iced::core::text::Wrapping; +use cosmic::widget::{self, dropdown, settings}; +use cosmic::{Apply, Element, Task, surface}; use cosmic_settings_page::{self as page, Section, section}; -use icu::{ - calendar::{Gregorian, types::Weekday, week}, - datetime::{ - DateTimeFormatter, DateTimeFormatterPreferences, fieldsets, - input::{Date, DateTime, Time}, - options::TimePrecision, - }, - locale::{Locale, preferences::extensions::unicode::keywords::HourCycle}, -}; +use icu::calendar::types::Weekday; +use icu::calendar::{Gregorian, week}; +use icu::datetime::input::{Date, DateTime, Time}; +use icu::datetime::options::TimePrecision; +use icu::datetime::{DateTimeFormatter, DateTimeFormatterPreferences, fieldsets}; +use icu::locale::Locale; +use icu::locale::preferences::extensions::unicode::keywords::HourCycle; use slotmap::{Key, SlotMap}; pub use timedate_zbus::TimeDateProxy; use tracing::error; diff --git a/cosmic-settings/src/pages/time/region.rs b/cosmic-settings/src/pages/time/region.rs index 5ff3192..7da958a 100644 --- a/cosmic-settings/src/pages/time/region.rs +++ b/cosmic-settings/src/pages/time/region.rs @@ -10,18 +10,15 @@ use cosmic::iced::{Alignment, Length}; use cosmic::widget::{self, button}; use cosmic::{Apply, Element}; use cosmic_config::{ConfigGet, ConfigSet}; -use cosmic_settings_page::Section; -use cosmic_settings_page::{self as page, section}; +use cosmic_settings_page::{self as page, Section, section}; use eyre::Context; -use icu::{ - calendar::{types::Weekday, week}, - datetime::{ - DateTimeFormatter, DateTimeFormatterPreferences, fieldsets, - input::{Date, DateTime, Time}, - }, - decimal::{DecimalFormatter, input::Decimal}, - locale::Locale, -}; +use icu::calendar::types::Weekday; +use icu::calendar::week; +use icu::datetime::input::{Date, DateTime, Time}; +use icu::datetime::{DateTimeFormatter, DateTimeFormatterPreferences, fieldsets}; +use icu::decimal::DecimalFormatter; +use icu::decimal::input::Decimal; +use icu::locale::Locale; use locales_rs as locale; use regex::Regex; use slotmap::{DefaultKey, SlotMap}; @@ -497,11 +494,8 @@ mod preferred_languages { use crate::pages::time::region::localized_iso_codes; use super::Message; - use cosmic::{ - Apply, - iced::{Alignment, Length}, - widget, - }; + use cosmic::iced::{Alignment, Length}; + use cosmic::{Apply, widget}; use cosmic_settings_page::Section; pub fn section() -> Section { diff --git a/cosmic-settings/src/subscription/daytime.rs b/cosmic-settings/src/subscription/daytime.rs index 00b8159..06915d3 100644 --- a/cosmic-settings/src/subscription/daytime.rs +++ b/cosmic-settings/src/subscription/daytime.rs @@ -2,11 +2,9 @@ use std::any::TypeId; use ashpd::desktop::location::{Location, LocationProxy}; use chrono::NaiveDate; -use cosmic::iced::{ - Subscription, - futures::{SinkExt, StreamExt, channel::mpsc::Sender, future}, - stream, -}; +use cosmic::iced::futures::channel::mpsc::Sender; +use cosmic::iced::futures::{SinkExt, StreamExt, future}; +use cosmic::iced::{Subscription, stream}; use sunrise::{Coordinates, SolarDay, SolarEvent}; use tokio::select; diff --git a/cosmic-settings/src/subscription/desktop_files.rs b/cosmic-settings/src/subscription/desktop_files.rs index 61b439d..2f04488 100644 --- a/cosmic-settings/src/subscription/desktop_files.rs +++ b/cosmic-settings/src/subscription/desktop_files.rs @@ -1,8 +1,5 @@ -use cosmic::iced::{ - Subscription, - futures::{self, SinkExt}, - stream, -}; +use cosmic::iced::futures::{self, SinkExt}; +use cosmic::iced::{Subscription, stream}; use notify::{Config, EventKind, RecommendedWatcher, RecursiveMode, Watcher}; use std::fmt::Debug; use std::hash::Hash; diff --git a/cosmic-settings/src/subscription/wallpapers.rs b/cosmic-settings/src/subscription/wallpapers.rs index 5e062b1..b424219 100644 --- a/cosmic-settings/src/subscription/wallpapers.rs +++ b/cosmic-settings/src/subscription/wallpapers.rs @@ -1,10 +1,8 @@ use std::path::PathBuf; -use cosmic::iced::{ - Subscription, - futures::{SinkExt, StreamExt, channel::mpsc::Sender, future}, - stream, -}; +use cosmic::iced::futures::channel::mpsc::Sender; +use cosmic::iced::futures::{SinkExt, StreamExt, future}; +use cosmic::iced::{Subscription, stream}; use image::{ImageBuffer, Rgba}; #[derive(Clone, Debug)] diff --git a/cosmic-settings/src/theme.rs b/cosmic-settings/src/theme.rs index df074d1..ab21f41 100644 --- a/cosmic-settings/src/theme.rs +++ b/cosmic-settings/src/theme.rs @@ -1,7 +1,8 @@ // Copyright 2023 System76 // SPDX-License-Identifier: GPL-3.0-only -use cosmic::{iced::Border, theme}; +use cosmic::iced::Border; +use cosmic::theme; #[must_use] pub fn display_container_frame() -> cosmic::theme::Container<'static> { diff --git a/cosmic-settings/src/utils.rs b/cosmic-settings/src/utils.rs index 6286b8b..ac1e413 100644 --- a/cosmic-settings/src/utils.rs +++ b/cosmic-settings/src/utils.rs @@ -1,4 +1,5 @@ -use std::{future::Future, io, process}; +use std::future::Future; +use std::{io, process}; use futures::future::select; diff --git a/cosmic-settings/src/widget/mod.rs b/cosmic-settings/src/widget/mod.rs index 5646dc6..e53b151 100644 --- a/cosmic-settings/src/widget/mod.rs +++ b/cosmic-settings/src/widget/mod.rs @@ -8,10 +8,9 @@ use cosmic::cosmic_theme::Spacing; use cosmic::iced::core::text::Wrapping; use cosmic::iced::{Alignment, Length}; use cosmic::widget::color_picker::ColorPickerUpdate; +use cosmic::widget::space::{horizontal, vertical}; use cosmic::widget::{ - self, ColorPickerModel, button, column, container, divider, icon, list, row, settings, - space::{horizontal, vertical}, - text, + self, ColorPickerModel, button, column, container, divider, icon, list, row, settings, text, }; use cosmic::{Apply, Element, theme}; use cosmic_settings_page as page; diff --git a/crates/cosmic-pipewire/src/lib.rs b/crates/cosmic-pipewire/src/lib.rs index 3aefd1e..9cf2538 100644 --- a/crates/cosmic-pipewire/src/lib.rs +++ b/crates/cosmic-pipewire/src/lib.rs @@ -21,20 +21,19 @@ pub use route::{Route, RouteProps}; mod spa_utils; pub use spa_utils::Channel; -use libspa::{ - param::{ParamType, format::FormatProperties}, - pod::{self, Pod, serialize::PodSerializer}, - utils::SpaTypes, -}; -use pipewire::{ - device::{DeviceChangeMask, DeviceListener}, - main_loop::MainLoopWeak, - metadata::MetadataListener, - node::NodeListener, - proxy::{ProxyListener, ProxyT}, - types::ObjectType, -}; -use std::{cell::RefCell, rc::Rc}; +use libspa::param::ParamType; +use libspa::param::format::FormatProperties; +use libspa::pod::serialize::PodSerializer; +use libspa::pod::{self, Pod}; +use libspa::utils::SpaTypes; +use pipewire::device::{DeviceChangeMask, DeviceListener}; +use pipewire::main_loop::MainLoopWeak; +use pipewire::metadata::MetadataListener; +use pipewire::node::NodeListener; +use pipewire::proxy::{ProxyListener, ProxyT}; +use pipewire::types::ObjectType; +use std::cell::RefCell; +use std::rc::Rc; pub type NodeId = u32; pub type RouteId = u32; diff --git a/crates/cosmic-pipewire/src/node.rs b/crates/cosmic-pipewire/src/node.rs index 5536f30..5bf7ff0 100644 --- a/crates/cosmic-pipewire/src/node.rs +++ b/crates/cosmic-pipewire/src/node.rs @@ -1,8 +1,10 @@ // Copyright 2025 System76 // SPDX-License-Identifier: MPL-2.0 -use crate::{Channel, spa_utils::array_from_pod}; -use libspa::{pod::Pod, utils::Id}; +use crate::Channel; +use crate::spa_utils::array_from_pod; +use libspa::pod::Pod; +use libspa::utils::Id; use pipewire::node::{NodeInfoRef, NodeState}; use std::ffi::c_float; diff --git a/crates/cosmic-pipewire/src/profile.rs b/crates/cosmic-pipewire/src/profile.rs index aabad61..c6bf75d 100644 --- a/crates/cosmic-pipewire/src/profile.rs +++ b/crates/cosmic-pipewire/src/profile.rs @@ -1,7 +1,8 @@ // Copyright 2025 System76 // SPDX-License-Identifier: MPL-2.0 -use crate::{Availability, spa_utils::string_from_pod}; +use crate::Availability; +use crate::spa_utils::string_from_pod; use libspa::pod::Pod; #[derive(Clone, Debug, Default)] diff --git a/crates/cosmic-pipewire/src/route.rs b/crates/cosmic-pipewire/src/route.rs index 961a7eb..cf370c6 100644 --- a/crates/cosmic-pipewire/src/route.rs +++ b/crates/cosmic-pipewire/src/route.rs @@ -3,11 +3,10 @@ use std::ffi::{c_float, c_int}; -use crate::{ - Availability, Channel, Direction, - spa_utils::{array_from_pod, string_from_pod}, -}; -use libspa::{pod::Pod, utils::Id}; +use crate::spa_utils::{array_from_pod, string_from_pod}; +use crate::{Availability, Channel, Direction}; +use libspa::pod::Pod; +use libspa::utils::Id; #[derive(Clone, Debug, Default)] pub struct Route { diff --git a/page/src/binder.rs b/page/src/binder.rs index b9aee2b..fe7f43e 100644 --- a/page/src/binder.rs +++ b/page/src/binder.rs @@ -3,15 +3,12 @@ use crate::section::{self, Section}; use crate::{Content, Info, Page}; -use cosmic::Element; -use cosmic::Task; use cosmic::app::ContextDrawer; +use cosmic::{Element, Task}; use regex::Regex; use slotmap::{SecondaryMap, SlotMap, SparseSecondaryMap}; -use std::{ - any::{Any, TypeId}, - collections::HashMap, -}; +use std::any::{Any, TypeId}; +use std::collections::HashMap; /// All settings pages are registered and managed by the [`Binder`]. pub struct Binder { diff --git a/page/src/lib.rs b/page/src/lib.rs index 23f894d..26335d5 100644 --- a/page/src/lib.rs +++ b/page/src/lib.rs @@ -5,7 +5,9 @@ mod binder; pub use binder::{AutoBind, Binder}; mod insert; -use cosmic::{Element, Task, app::ContextDrawer, iced::Subscription}; +use cosmic::app::ContextDrawer; +use cosmic::iced::Subscription; +use cosmic::{Element, Task}; use downcast_rs::{Downcast, impl_downcast}; pub use insert::Insert; diff --git a/pages/wallpapers/src/lib.rs b/pages/wallpapers/src/lib.rs index 921117c..a0b309b 100644 --- a/pages/wallpapers/src/lib.rs +++ b/pages/wallpapers/src/lib.rs @@ -6,16 +6,15 @@ use futures_util::StreamExt; use image::imageops::FilterType; use image::{DynamicImage, ImageBuffer, Rgba, RgbaImage}; use jxl_oxide::integration::JxlDecoder; +use std::borrow::Cow; +use std::collections::HashMap; +use std::collections::hash_map::DefaultHasher; use std::fs::File; +use std::hash::{Hash, Hasher}; +use std::io::Read; use std::os::unix::ffi::OsStrExt; -use std::{ - borrow::Cow, - collections::{HashMap, hash_map::DefaultHasher}, - hash::{Hash, Hasher}, - io::Read, - path::{Path, PathBuf}, - pin::Pin, -}; +use std::path::{Path, PathBuf}; +use std::pin::Pin; use walkdir::WalkDir; pub const DEFAULT_COLORS: &[Color] = &[ diff --git a/rustfmt.toml b/rustfmt.toml new file mode 100644 index 0000000..c1578aa --- /dev/null +++ b/rustfmt.toml @@ -0,0 +1 @@ +imports_granularity = "Module" diff --git a/subscriptions/a11y-manager/src/lib.rs b/subscriptions/a11y-manager/src/lib.rs index 0bcd849..ba9b8e4 100644 --- a/subscriptions/a11y-manager/src/lib.rs +++ b/subscriptions/a11y-manager/src/lib.rs @@ -1,17 +1,11 @@ use cosmic_protocols::a11y::v1::client::cosmic_a11y_manager_v1::{self, ActiveState}; use num_derive::{FromPrimitive, ToPrimitive}; -use sctk::{ - reexports::{ - calloop::{self, LoopSignal, channel}, - calloop_wayland_source::WaylandSource, - client::{ - ConnectError, Connection, Dispatch, Proxy, WEnum, - globals::{GlobalListContents, registry_queue_init}, - protocol::wl_registry, - }, - }, - registry::RegistryState, -}; +use sctk::reexports::calloop::{self, LoopSignal, channel}; +use sctk::reexports::calloop_wayland_source::WaylandSource; +use sctk::reexports::client::globals::{GlobalListContents, registry_queue_init}; +use sctk::reexports::client::protocol::wl_registry; +use sctk::reexports::client::{ConnectError, Connection, Dispatch, Proxy, WEnum}; +use sctk::registry::RegistryState; use tokio::sync::mpsc; #[derive(Debug, Clone, Copy)] diff --git a/subscriptions/airplane-mode/src/lib.rs b/subscriptions/airplane-mode/src/lib.rs index 1e326e7..48f4c8e 100644 --- a/subscriptions/airplane-mode/src/lib.rs +++ b/subscriptions/airplane-mode/src/lib.rs @@ -42,8 +42,9 @@ fn is_airplane_mode(rfkill_state: &HashMap) -> bool { mod rfkill { use futures::stream::Stream; + use std::collections::HashMap; use std::os::unix::fs::OpenOptionsExt; - use std::{collections::HashMap, fs, io, mem, slice}; + use std::{fs, io, mem, slice}; use tokio::io::unix::AsyncFd; // /usr/include/linux/rfkill.h diff --git a/subscriptions/bluetooth/src/adapter.rs b/subscriptions/bluetooth/src/adapter.rs index eb5de34..756f893 100644 --- a/subscriptions/bluetooth/src/adapter.rs +++ b/subscriptions/bluetooth/src/adapter.rs @@ -2,13 +2,11 @@ // SPDX-License-Identifier: MPL-2.0 use crate::{Active, Event}; -use std::{ - collections::HashMap, - convert::Infallible, - hash::{Hash, Hasher}, - path::PathBuf, - time::Duration, -}; +use std::collections::HashMap; +use std::convert::Infallible; +use std::hash::{Hash, Hasher}; +use std::path::PathBuf; +use std::time::Duration; use zbus::zvariant::OwnedObjectPath; #[derive(Default, Debug, Clone)] diff --git a/subscriptions/bluetooth/src/device.rs b/subscriptions/bluetooth/src/device.rs index aec4a72..2ba1854 100644 --- a/subscriptions/bluetooth/src/device.rs +++ b/subscriptions/bluetooth/src/device.rs @@ -3,11 +3,9 @@ use crate::{Active, Event}; use futures::join; -use std::{ - collections::HashMap, - hash::{Hash, Hasher}, - time::Duration, -}; +use std::collections::HashMap; +use std::hash::{Hash, Hasher}; +use std::time::Duration; use zbus::zvariant::OwnedObjectPath; const DEFAILT_DEVICE_ICON: &str = "bluetooth-symbolic"; diff --git a/subscriptions/bluetooth/src/subscription.rs b/subscriptions/bluetooth/src/subscription.rs index c88b98f..b92b262 100644 --- a/subscriptions/bluetooth/src/subscription.rs +++ b/subscriptions/bluetooth/src/subscription.rs @@ -5,9 +5,11 @@ use crate::{AdapterUpdate, Device, DeviceUpdate, Event}; use std::pin::Pin; use bluez_zbus::BluetoothDevice; -use futures::{channel::mpsc, stream::FusedStream}; +use futures::channel::mpsc; +use futures::stream::FusedStream; use iced_futures::futures::{SinkExt, StreamExt}; -use zbus::{fdo, zvariant::OwnedObjectPath}; +use zbus::fdo; +use zbus::zvariant::OwnedObjectPath; enum DevicePropertyWatcherTask { Add(OwnedObjectPath), diff --git a/subscriptions/network-manager/src/active_conns.rs b/subscriptions/network-manager/src/active_conns.rs index e902b2a..63af460 100644 --- a/subscriptions/network-manager/src/active_conns.rs +++ b/subscriptions/network-manager/src/active_conns.rs @@ -7,7 +7,8 @@ use super::Event; use cosmic_dbus_networkmanager::nm::NetworkManager; use futures::{SinkExt, StreamExt}; use iced_futures::{Subscription, stream}; -use std::{fmt::Debug, hash::Hash}; +use std::fmt::Debug; +use std::hash::Hash; use zbus::Connection; #[derive(Debug, Clone)] diff --git a/subscriptions/network-manager/src/available_wifi.rs b/subscriptions/network-manager/src/available_wifi.rs index f467092..0653ae1 100644 --- a/subscriptions/network-manager/src/available_wifi.rs +++ b/subscriptions/network-manager/src/available_wifi.rs @@ -1,14 +1,13 @@ // Copyright 2024 System76 // SPDX-License-Identifier: MPL-2.0 -use cosmic_dbus_networkmanager::{ - device::wireless::WirelessDevice, - interface::enums::{ApFlags, ApSecurityFlags, DeviceState}, -}; +use cosmic_dbus_networkmanager::device::wireless::WirelessDevice; +use cosmic_dbus_networkmanager::interface::enums::{ApFlags, ApSecurityFlags, DeviceState}; use futures::StreamExt; use itertools::Itertools; -use std::{collections::HashMap, sync::Arc}; +use std::collections::HashMap; +use std::sync::Arc; use zbus::zvariant::ObjectPath; use super::hw_address::HwAddress; diff --git a/subscriptions/network-manager/src/current_networks.rs b/subscriptions/network-manager/src/current_networks.rs index 2fc6b9b..45ac95d 100644 --- a/subscriptions/network-manager/src/current_networks.rs +++ b/subscriptions/network-manager/src/current_networks.rs @@ -1,10 +1,9 @@ // Copyright 2024 System76 // SPDX-License-Identifier: MPL-2.0 -use cosmic_dbus_networkmanager::{ - active_connection::ActiveConnection, device::SpecificDevice, - interface::enums::ActiveConnectionState, -}; +use cosmic_dbus_networkmanager::active_connection::ActiveConnection; +use cosmic_dbus_networkmanager::device::SpecificDevice; +use cosmic_dbus_networkmanager::interface::enums::ActiveConnectionState; use std::net::Ipv4Addr; pub async fn active_connections( diff --git a/subscriptions/network-manager/src/devices.rs b/subscriptions/network-manager/src/devices.rs index 235b0b5..4dbcdb6 100644 --- a/subscriptions/network-manager/src/devices.rs +++ b/subscriptions/network-manager/src/devices.rs @@ -10,8 +10,11 @@ use core::hash; use cosmic_dbus_networkmanager::nm::NetworkManager; use futures::{SinkExt, StreamExt}; use iced_futures::{self, Subscription, stream}; -use std::{fmt::Debug, hash::Hash, sync::Arc}; -use zbus::{Connection, zvariant::ObjectPath}; +use std::fmt::Debug; +use std::hash::Hash; +use std::sync::Arc; +use zbus::Connection; +use zbus::zvariant::ObjectPath; #[derive(Debug, Clone, Eq, PartialEq)] pub struct DeviceInfo { diff --git a/subscriptions/network-manager/src/lib.rs b/subscriptions/network-manager/src/lib.rs index 631eda9..675b7bf 100644 --- a/subscriptions/network-manager/src/lib.rs +++ b/subscriptions/network-manager/src/lib.rs @@ -9,34 +9,33 @@ pub mod hw_address; pub mod nm_secret_agent; pub mod wireless_enabled; -use std::{collections::HashMap, fmt::Debug, hash::Hash, sync::Arc, time::Duration}; +use std::collections::HashMap; +use std::fmt::Debug; +use std::hash::Hash; +use std::sync::Arc; +use std::time::Duration; use available_wifi::NetworkType; pub use cosmic_dbus_networkmanager as dbus; pub use dbus::settings::connection::Settings; -use cosmic_dbus_networkmanager::{ - device::SpecificDevice, - interface::{ - enums::{self, ActiveConnectionState, DeviceType, NmConnectivityState}, - settings::connection::ConnectionSettingsProxy, - }, - nm::NetworkManager, - settings::{NetworkManagerSettings, connection::Connection}, -}; -use futures::{ - FutureExt, SinkExt, StreamExt, - channel::mpsc::{UnboundedReceiver, UnboundedSender, unbounded}, +use cosmic_dbus_networkmanager::device::SpecificDevice; +use cosmic_dbus_networkmanager::interface::enums::{ + self, ActiveConnectionState, DeviceType, NmConnectivityState, }; +use cosmic_dbus_networkmanager::interface::settings::connection::ConnectionSettingsProxy; +use cosmic_dbus_networkmanager::nm::NetworkManager; +use cosmic_dbus_networkmanager::settings::NetworkManagerSettings; +use cosmic_dbus_networkmanager::settings::connection::Connection; +use futures::channel::mpsc::{UnboundedReceiver, UnboundedSender, unbounded}; +use futures::{FutureExt, SinkExt, StreamExt}; use iced_futures::{Subscription, stream}; use secure_string::SecureString; use tokio::process::Command; use zbus::zvariant::{self, ObjectPath, Value}; -use self::{ - available_wifi::{AccessPoint, handle_wireless_device}, - current_networks::{ActiveConnectionInfo, active_connections}, -}; +use self::available_wifi::{AccessPoint, handle_wireless_device}; +use self::current_networks::{ActiveConnectionInfo, active_connections}; pub type SSID = Arc; pub type UUID = Arc; diff --git a/subscriptions/network-manager/src/nm_secret_agent.rs b/subscriptions/network-manager/src/nm_secret_agent.rs index fa697c9..330c594 100644 --- a/subscriptions/network-manager/src/nm_secret_agent.rs +++ b/subscriptions/network-manager/src/nm_secret_agent.rs @@ -1,18 +1,14 @@ -use std::{ - collections::{HashMap, HashSet}, - fmt::Debug, - sync::Arc, -}; +use std::collections::{HashMap, HashSet}; +use std::fmt::Debug; +use std::sync::Arc; use bitflags::bitflags; use cosmic_dbus_networkmanager::interface::settings::connection::ConnectionSettingsProxy; use futures::{SinkExt, Stream}; use secure_string::SecureString; use tokio::sync::oneshot; -use zbus::{ - ObjectServer, fdo, - zvariant::{OwnedValue, Str}, -}; +use zbus::zvariant::{OwnedValue, Str}; +use zbus::{ObjectServer, fdo}; pub type SecretSender = Arc>>>; diff --git a/subscriptions/network-manager/src/wireless_enabled.rs b/subscriptions/network-manager/src/wireless_enabled.rs index 5ad940d..039bbf3 100644 --- a/subscriptions/network-manager/src/wireless_enabled.rs +++ b/subscriptions/network-manager/src/wireless_enabled.rs @@ -7,7 +7,8 @@ use super::Event; use cosmic_dbus_networkmanager::nm::NetworkManager; use futures::{SinkExt, StreamExt}; use iced_futures::{Subscription, stream}; -use std::{fmt::Debug, hash::Hash}; +use std::fmt::Debug; +use std::hash::Hash; use zbus::Connection; #[derive(Debug, Clone)] diff --git a/subscriptions/pulse/src/lib.rs b/subscriptions/pulse/src/lib.rs index 4220765..b2a7779 100644 --- a/subscriptions/pulse/src/lib.rs +++ b/subscriptions/pulse/src/lib.rs @@ -4,37 +4,30 @@ // Make sure not to fail if pulse not found, and reconnect? // change to device shouldn't send osd? -use futures::{SinkExt, executor::block_on}; +use futures::SinkExt; +use futures::executor::block_on; use iced_futures::{Subscription, stream}; -use libpulse_binding::{ - callbacks::ListResult, - channelmap::Map, - context::{ - Context, FlagSet, State, - introspect::{CardInfo, CardProfileInfo, Introspector, ServerInfo, SinkInfo, SourceInfo}, - subscribe::{Facility, InterestMaskSet, Operation}, - }, - def::{PortAvailable, Retval}, - mainloop::{ - api::MainloopApi, - events::io::IoEventInternal, - standard::{IterateResult, Mainloop}, - }, - volume::{ChannelVolumes, Volume}, -}; -use std::{ - borrow::Cow, - cell::{Cell, RefCell}, - convert::Infallible, - io::{Read, Write}, - os::{ - fd::{FromRawFd, IntoRawFd, RawFd}, - raw::c_void, - }, - rc::Rc, - str::FromStr, - sync::mpsc, +use libpulse_binding::callbacks::ListResult; +use libpulse_binding::channelmap::Map; +use libpulse_binding::context::introspect::{ + CardInfo, CardProfileInfo, Introspector, ServerInfo, SinkInfo, SourceInfo, }; +use libpulse_binding::context::subscribe::{Facility, InterestMaskSet, Operation}; +use libpulse_binding::context::{Context, FlagSet, State}; +use libpulse_binding::def::{PortAvailable, Retval}; +use libpulse_binding::mainloop::api::MainloopApi; +use libpulse_binding::mainloop::events::io::IoEventInternal; +use libpulse_binding::mainloop::standard::{IterateResult, Mainloop}; +use libpulse_binding::volume::{ChannelVolumes, Volume}; +use std::borrow::Cow; +use std::cell::{Cell, RefCell}; +use std::convert::Infallible; +use std::io::{Read, Write}; +use std::os::fd::{FromRawFd, IntoRawFd, RawFd}; +use std::os::raw::c_void; +use std::rc::Rc; +use std::str::FromStr; +use std::sync::mpsc; pub fn subscription() -> iced_futures::Subscription { Subscription::run_with("pulse", |_| { diff --git a/subscriptions/sound/src/lib.rs b/subscriptions/sound/src/lib.rs index adac229..f6a66d0 100644 --- a/subscriptions/sound/src/lib.rs +++ b/subscriptions/sound/src/lib.rs @@ -7,11 +7,9 @@ use cosmic_pipewire as pipewire; use futures::{SinkExt, Stream}; use intmap::IntMap; use pipewire::Availability; -use std::{ - process::Stdio, - sync::{Arc, Mutex}, - time::Duration, -}; +use std::process::Stdio; +use std::sync::{Arc, Mutex}; +use std::time::Duration; pub type DeviceId = u32; pub type NodeId = u32; diff --git a/subscriptions/upower/src/lib.rs b/subscriptions/upower/src/lib.rs index e594774..968bbe2 100644 --- a/subscriptions/upower/src/lib.rs +++ b/subscriptions/upower/src/lib.rs @@ -4,7 +4,8 @@ pub mod device { use futures::{FutureExt, Stream, StreamExt}; use iced_futures::Subscription; - use std::{fmt::Debug, hash::Hash}; + use std::fmt::Debug; + use std::hash::Hash; use upower_dbus::{BatteryType, DeviceProxy, UPowerProxy}; pub fn device_subscription( @@ -97,7 +98,8 @@ pub mod kbdbacklight { use futures::{FutureExt, Stream, StreamExt}; use iced_futures::Subscription; - use std::{fmt::Debug, hash::Hash}; + use std::fmt::Debug; + use std::hash::Hash; use tokio::sync::mpsc::{UnboundedSender, unbounded_channel}; use tokio_stream::wrappers::UnboundedReceiverStream; use upower_dbus::{BrightnessChanged, KbdBacklightProxy};