chore: Rust 2024 edition format
This commit is contained in:
parent
665e4e13b8
commit
1e5aaad61c
35 changed files with 243 additions and 216 deletions
|
|
@ -2,8 +2,8 @@
|
||||||
// SPDX-License-Identifier: GPL-3.0-only
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
|
||||||
use i18n_embed::{
|
use i18n_embed::{
|
||||||
fluent::{fluent_language_loader, FluentLanguageLoader},
|
|
||||||
DefaultLocalizer, LanguageLoader, Localizer,
|
DefaultLocalizer, LanguageLoader, Localizer,
|
||||||
|
fluent::{FluentLanguageLoader, fluent_language_loader},
|
||||||
};
|
};
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
use rust_embed::RustEmbed;
|
use rust_embed::RustEmbed;
|
||||||
|
|
|
||||||
|
|
@ -9,16 +9,15 @@ use std::{
|
||||||
};
|
};
|
||||||
|
|
||||||
use cosmic::{
|
use cosmic::{
|
||||||
surface,
|
Apply, Element, Task, surface,
|
||||||
widget::{self, dropdown, icon, settings},
|
widget::{self, dropdown, icon, settings},
|
||||||
Apply, Element, Task,
|
|
||||||
};
|
};
|
||||||
use cosmic_config::{ConfigGet, ConfigSet};
|
use cosmic_config::{ConfigGet, ConfigSet};
|
||||||
use cosmic_settings_config::shortcuts::action::System;
|
|
||||||
use cosmic_settings_config::shortcuts::SystemActions;
|
use cosmic_settings_config::shortcuts::SystemActions;
|
||||||
use cosmic_settings_page::{self as page, section, Section};
|
use cosmic_settings_config::shortcuts::action::System;
|
||||||
|
use cosmic_settings_page::{self as page, Section, section};
|
||||||
use freedesktop_desktop_entry::{
|
use freedesktop_desktop_entry::{
|
||||||
default_paths, get_languages_from_env, DesktopEntry, Iter as DesktopEntryIter,
|
DesktopEntry, Iter as DesktopEntryIter, default_paths, get_languages_from_env,
|
||||||
};
|
};
|
||||||
use mime_apps::App;
|
use mime_apps::App;
|
||||||
use slotmap::SlotMap;
|
use slotmap::SlotMap;
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,10 @@
|
||||||
// SPDX-License-Identifier: GPL-3.0-only
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
|
||||||
use cosmic::{
|
use cosmic::{
|
||||||
|
Apply, Element,
|
||||||
cosmic_config::{self, ConfigGet, ConfigSet},
|
cosmic_config::{self, ConfigGet, ConfigSet},
|
||||||
iced::Length,
|
iced::Length,
|
||||||
widget::{self, text},
|
widget::{self, text},
|
||||||
Apply, Element,
|
|
||||||
};
|
};
|
||||||
use cosmic_settings_page::Section;
|
use cosmic_settings_page::Section;
|
||||||
use cosmic_settings_page::{self as page, section};
|
use cosmic_settings_page::{self as page, section};
|
||||||
|
|
@ -95,26 +95,30 @@ pub fn legacy_application_scaling() -> Section<crate::pages::Message> {
|
||||||
let descriptions = §ion.descriptions;
|
let descriptions = §ion.descriptions;
|
||||||
widget::settings::section()
|
widget::settings::section()
|
||||||
.title(§ion.title)
|
.title(§ion.title)
|
||||||
.add(widget::settings::item_row(vec![widget::radio(
|
.add(widget::settings::item_row(vec![
|
||||||
widget::column()
|
widget::radio(
|
||||||
.push(text::body(&descriptions[system]))
|
widget::column()
|
||||||
.push(text::caption(&descriptions[system_desc])),
|
.push(text::body(&descriptions[system]))
|
||||||
false,
|
.push(text::caption(&descriptions[system_desc])),
|
||||||
Some(page.comp_config_descale_xwayland),
|
false,
|
||||||
Message::SetXwaylandDescaling,
|
Some(page.comp_config_descale_xwayland),
|
||||||
)
|
Message::SetXwaylandDescaling,
|
||||||
.width(Length::Fill)
|
)
|
||||||
.into()]))
|
.width(Length::Fill)
|
||||||
.add(widget::settings::item_row(vec![widget::radio(
|
.into(),
|
||||||
widget::column()
|
]))
|
||||||
.push(text::body(&descriptions[native]))
|
.add(widget::settings::item_row(vec![
|
||||||
.push(text::caption(&descriptions[native_desc])),
|
widget::radio(
|
||||||
true,
|
widget::column()
|
||||||
Some(page.comp_config_descale_xwayland),
|
.push(text::body(&descriptions[native]))
|
||||||
Message::SetXwaylandDescaling,
|
.push(text::caption(&descriptions[native_desc])),
|
||||||
)
|
true,
|
||||||
.width(Length::Fill)
|
Some(page.comp_config_descale_xwayland),
|
||||||
.into()]))
|
Message::SetXwaylandDescaling,
|
||||||
|
)
|
||||||
|
.width(Length::Fill)
|
||||||
|
.into(),
|
||||||
|
]))
|
||||||
.apply(Element::from)
|
.apply(Element::from)
|
||||||
.map(crate::pages::Message::LegacyApplications)
|
.map(crate::pages::Message::LegacyApplications)
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,14 @@
|
||||||
// Copyright 2024 System76 <info@system76.com>
|
// Copyright 2024 System76 <info@system76.com>
|
||||||
// SPDX-License-Identifier: GPL-3.0-only
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
|
||||||
use cosmic::iced::{color, Alignment, Length};
|
use cosmic::iced::{Alignment, Length, color};
|
||||||
use cosmic::iced_core::text::Wrapping;
|
use cosmic::iced_core::text::Wrapping;
|
||||||
use cosmic::widget::{self, settings, text};
|
use cosmic::widget::{self, settings, text};
|
||||||
use cosmic::{theme, Apply, Element, Task};
|
use cosmic::{Apply, Element, Task, theme};
|
||||||
use cosmic_settings_page::{self as page, section, Section};
|
use cosmic_settings_page::{self as page, Section, section};
|
||||||
use cosmic_settings_subscriptions::bluetooth::*;
|
use cosmic_settings_subscriptions::bluetooth::*;
|
||||||
use futures::channel::oneshot;
|
|
||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
|
use futures::channel::oneshot;
|
||||||
use slab::Slab;
|
use slab::Slab;
|
||||||
use slotmap::SlotMap;
|
use slotmap::SlotMap;
|
||||||
use std::collections::{HashMap, HashSet};
|
use std::collections::{HashMap, HashSet};
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,11 @@ use std::rc::Rc;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use cosmic::{
|
use cosmic::{
|
||||||
|
Apply, Element, Task,
|
||||||
config::{CosmicTk, FontConfig},
|
config::{CosmicTk, FontConfig},
|
||||||
iced_core::text::Wrapping,
|
iced_core::text::Wrapping,
|
||||||
theme,
|
theme,
|
||||||
widget::{self, settings, svg},
|
widget::{self, settings, svg},
|
||||||
Apply, Element, Task,
|
|
||||||
};
|
};
|
||||||
use cosmic_config::ConfigSet;
|
use cosmic_config::ConfigSet;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,9 @@ use std::{collections::BTreeMap, path::PathBuf};
|
||||||
|
|
||||||
use super::Message;
|
use super::Message;
|
||||||
use cosmic::{
|
use cosmic::{
|
||||||
|
Element,
|
||||||
iced::{Background, Length},
|
iced::{Background, Length},
|
||||||
widget::{button, icon, text},
|
widget::{button, icon, text},
|
||||||
Element,
|
|
||||||
};
|
};
|
||||||
use tokio::io::AsyncBufReadExt;
|
use tokio::io::AsyncBufReadExt;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
use cosmic::{
|
use cosmic::{
|
||||||
|
Apply, Element, Task,
|
||||||
cosmic_config::CosmicConfigEntry,
|
cosmic_config::CosmicConfigEntry,
|
||||||
iced::{Alignment, Length},
|
iced::{Alignment, Length},
|
||||||
widget::{button, container, row},
|
widget::{button, container, row},
|
||||||
Apply, Element, Task,
|
|
||||||
};
|
};
|
||||||
use cosmic_panel_config::CosmicPanelConfig;
|
use cosmic_panel_config::CosmicPanelConfig;
|
||||||
use cosmic_settings_page::{self as page, section, Section};
|
use cosmic_settings_page::{self as page, Section, section};
|
||||||
use slotmap::{Key, SlotMap};
|
use slotmap::{Key, SlotMap};
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
|
|
||||||
|
|
@ -13,7 +13,7 @@ use crate::{
|
||||||
app,
|
app,
|
||||||
pages::{
|
pages::{
|
||||||
self,
|
self,
|
||||||
desktop::panel::applets_inner::{self, lists, AppletsPage, ContextDrawer},
|
desktop::panel::applets_inner::{self, AppletsPage, ContextDrawer, lists},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,12 @@ use std::collections::HashMap;
|
||||||
|
|
||||||
use cosmic::Apply;
|
use cosmic::Apply;
|
||||||
use cosmic::{
|
use cosmic::{
|
||||||
|
Element, Task,
|
||||||
cosmic_config::{ConfigSet, CosmicConfigEntry},
|
cosmic_config::{ConfigSet, CosmicConfigEntry},
|
||||||
widget::{settings, text, toggler},
|
widget::{settings, text, toggler},
|
||||||
Element, Task,
|
|
||||||
};
|
};
|
||||||
use cosmic_panel_config::{CosmicPanelConfig, CosmicPanelContainerConfig};
|
use cosmic_panel_config::{CosmicPanelConfig, CosmicPanelContainerConfig};
|
||||||
use cosmic_settings_page::{self as page, section, Section};
|
use cosmic_settings_page::{self as page, Section, section};
|
||||||
use slab::Slab;
|
use slab::Slab;
|
||||||
use slotmap::SlotMap;
|
use slotmap::SlotMap;
|
||||||
use tracing::error;
|
use tracing::error;
|
||||||
|
|
|
||||||
|
|
@ -1,27 +1,27 @@
|
||||||
|
use cosmic::iced::Vector;
|
||||||
use cosmic::iced::clipboard::dnd::{
|
use cosmic::iced::clipboard::dnd::{
|
||||||
DndAction, DndDestinationRectangle, DndEvent, OfferEvent, SourceEvent,
|
DndAction, DndDestinationRectangle, DndEvent, OfferEvent, SourceEvent,
|
||||||
};
|
};
|
||||||
use cosmic::iced::clipboard::mime::AsMimeTypes;
|
use cosmic::iced::clipboard::mime::AsMimeTypes;
|
||||||
use cosmic::iced::id::Internal;
|
use cosmic::iced::id::Internal;
|
||||||
use cosmic::iced::Vector;
|
|
||||||
|
|
||||||
use cosmic::iced_core;
|
use cosmic::iced_core;
|
||||||
use cosmic::iced_core::clipboard::IconSurface;
|
use cosmic::iced_core::clipboard::IconSurface;
|
||||||
use cosmic::widget::{button, column, container, icon, list_column, row, text, text_input, Column};
|
use cosmic::widget::{Column, button, column, container, icon, list_column, row, text, text_input};
|
||||||
|
|
||||||
use cosmic::{
|
use cosmic::{
|
||||||
|
Apply, Element,
|
||||||
cosmic_config::{Config, CosmicConfigEntry},
|
cosmic_config::{Config, CosmicConfigEntry},
|
||||||
iced::{
|
iced::{
|
||||||
core::window, event, mouse, overlay, touch, Alignment, Color, Length, Point, Rectangle,
|
Alignment, Color, Length, Point, Rectangle, Size, core::window, event, mouse, overlay,
|
||||||
Size,
|
touch,
|
||||||
},
|
},
|
||||||
iced_runtime::{core::id::Id, Task},
|
iced_runtime::{Task, core::id::Id},
|
||||||
iced_widget::core::{
|
iced_widget::core::{
|
||||||
layout, renderer,
|
Clipboard, Shell, Widget, layout, renderer,
|
||||||
widget::{tree, Operation, Tree},
|
widget::{Operation, Tree, tree},
|
||||||
Clipboard, Shell, Widget,
|
|
||||||
},
|
},
|
||||||
theme, Apply, Element,
|
theme,
|
||||||
};
|
};
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
|
|
||||||
|
|
@ -30,7 +30,7 @@ use std::{borrow::Cow, fmt::Debug, mem, path::Path};
|
||||||
|
|
||||||
use crate::{app, pages};
|
use crate::{app, pages};
|
||||||
use cosmic_panel_config::CosmicPanelConfig;
|
use cosmic_panel_config::CosmicPanelConfig;
|
||||||
use cosmic_settings_page::{self as page, section, Section};
|
use cosmic_settings_page::{self as page, Section, section};
|
||||||
use freedesktop_desktop_entry::DesktopEntry;
|
use freedesktop_desktop_entry::DesktopEntry;
|
||||||
use slotmap::{Key, SlotMap};
|
use slotmap::{Key, SlotMap};
|
||||||
use tracing::error;
|
use tracing::error;
|
||||||
|
|
@ -110,7 +110,7 @@ impl page::Page<crate::pages::Message> for Page {
|
||||||
sections: &mut SlotMap<section::Entity, Section<crate::pages::Message>>,
|
sections: &mut SlotMap<section::Entity, Section<crate::pages::Message>>,
|
||||||
) -> Option<page::Content> {
|
) -> Option<page::Content> {
|
||||||
Some(vec![
|
Some(vec![
|
||||||
sections.insert(lists::<Page, _>(pages::Message::PanelApplet))
|
sections.insert(lists::<Page, _>(pages::Message::PanelApplet)),
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
use cosmic::{
|
use cosmic::{
|
||||||
cctk::sctk::reexports::client::{backend::ObjectId, protocol::wl_output::WlOutput, Proxy},
|
Element, Task,
|
||||||
|
cctk::sctk::reexports::client::{Proxy, backend::ObjectId, protocol::wl_output::WlOutput},
|
||||||
cosmic_config::{self, CosmicConfigEntry},
|
cosmic_config::{self, CosmicConfigEntry},
|
||||||
iced::{Alignment, Length},
|
iced::{Alignment, Length},
|
||||||
surface, theme,
|
surface, theme,
|
||||||
widget::{
|
widget::{
|
||||||
button, container, dropdown, horizontal_space, icon, row, settings, slider, text, toggler,
|
button, container, dropdown, horizontal_space, icon, row, settings, slider, text, toggler,
|
||||||
},
|
},
|
||||||
Element, Task,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use cosmic::Apply;
|
use cosmic::Apply;
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use cosmic::{cosmic_config::CosmicConfigEntry, Task};
|
use cosmic::{Task, cosmic_config::CosmicConfigEntry};
|
||||||
use cosmic_panel_config::{CosmicPanelConfig, CosmicPanelContainerConfig};
|
use cosmic_panel_config::{CosmicPanelConfig, CosmicPanelContainerConfig};
|
||||||
use cosmic_settings_page::{self as page, section, Section};
|
use cosmic_settings_page::{self as page, Section, section};
|
||||||
use slotmap::SlotMap;
|
use slotmap::SlotMap;
|
||||||
|
|
||||||
use crate::pages::desktop::panel::inner::{
|
use crate::pages::desktop::panel::inner::{
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,11 @@
|
||||||
use super::Message;
|
use super::Message;
|
||||||
use cosmic::iced::Radius;
|
use cosmic::iced::Radius;
|
||||||
use cosmic::iced_core::Border;
|
use cosmic::iced_core::Border;
|
||||||
use cosmic::iced_core::{self, gradient::Linear, Background, Color, Degrees, Length};
|
use cosmic::iced_core::{self, Background, Color, Degrees, Length, gradient::Linear};
|
||||||
use cosmic::iced_runtime::core::image::Handle as ImageHandle;
|
use cosmic::iced_runtime::core::image::Handle as ImageHandle;
|
||||||
use cosmic::prelude::*;
|
use cosmic::prelude::*;
|
||||||
use cosmic::widget::{button, container, Space};
|
use cosmic::widget::{Space, button, container};
|
||||||
use cosmic::{iced, Element};
|
use cosmic::{Element, iced};
|
||||||
use cosmic_settings_wallpaper as wallpaper;
|
use cosmic_settings_wallpaper as wallpaper;
|
||||||
use slotmap::DefaultKey;
|
use slotmap::DefaultKey;
|
||||||
use std::sync::OnceLock;
|
use std::sync::OnceLock;
|
||||||
|
|
|
||||||
|
|
@ -2,14 +2,14 @@
|
||||||
// SPDX-License-Identifier: GPL-3.0-only
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
|
||||||
use cosmic::{
|
use cosmic::{
|
||||||
|
Apply, Element,
|
||||||
iced::Length,
|
iced::Length,
|
||||||
surface,
|
surface,
|
||||||
widget::{self, settings, toggler},
|
widget::{self, settings, toggler},
|
||||||
Apply, Element,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use cosmic_config::{ConfigGet, ConfigSet};
|
use cosmic_config::{ConfigGet, ConfigSet};
|
||||||
use cosmic_settings_config::{shortcuts, Action, Binding, Shortcuts};
|
use cosmic_settings_config::{Action, Binding, Shortcuts, shortcuts};
|
||||||
use cosmic_settings_page::Section;
|
use cosmic_settings_page::Section;
|
||||||
use cosmic_settings_page::{self as page, section};
|
use cosmic_settings_page::{self as page, section};
|
||||||
use slab::Slab;
|
use slab::Slab;
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,10 @@
|
||||||
// TODO make settings work
|
// TODO make settings work
|
||||||
|
|
||||||
use cosmic::{
|
use cosmic::{
|
||||||
|
Apply, Element,
|
||||||
cosmic_config::{self, ConfigGet, ConfigSet},
|
cosmic_config::{self, ConfigGet, ConfigSet},
|
||||||
iced::Length,
|
iced::Length,
|
||||||
widget::{radio, settings, text},
|
widget::{radio, settings, text},
|
||||||
Apply, Element,
|
|
||||||
};
|
};
|
||||||
use cosmic_comp_config::workspace::{WorkspaceConfig, WorkspaceLayout, WorkspaceMode};
|
use cosmic_comp_config::workspace::{WorkspaceConfig, WorkspaceLayout, WorkspaceMode};
|
||||||
use cosmic_settings_page::Section;
|
use cosmic_settings_page::Section;
|
||||||
|
|
@ -136,22 +136,26 @@ fn multi_behavior() -> Section<crate::pages::Message> {
|
||||||
let descriptions = §ion.descriptions;
|
let descriptions = §ion.descriptions;
|
||||||
settings::section()
|
settings::section()
|
||||||
.title(§ion.title)
|
.title(§ion.title)
|
||||||
.add(settings::item_row(vec![radio(
|
.add(settings::item_row(vec![
|
||||||
text::body(&descriptions[span]),
|
radio(
|
||||||
WorkspaceMode::Global,
|
text::body(&descriptions[span]),
|
||||||
Some(page.comp_workspace_config.workspace_mode),
|
WorkspaceMode::Global,
|
||||||
Message::SetWorkspaceMode,
|
Some(page.comp_workspace_config.workspace_mode),
|
||||||
)
|
Message::SetWorkspaceMode,
|
||||||
.width(Length::Fill)
|
)
|
||||||
.into()]))
|
.width(Length::Fill)
|
||||||
.add(settings::item_row(vec![radio(
|
.into(),
|
||||||
text::body(&descriptions[separate]),
|
]))
|
||||||
WorkspaceMode::OutputBound,
|
.add(settings::item_row(vec![
|
||||||
Some(page.comp_workspace_config.workspace_mode),
|
radio(
|
||||||
Message::SetWorkspaceMode,
|
text::body(&descriptions[separate]),
|
||||||
)
|
WorkspaceMode::OutputBound,
|
||||||
.width(Length::Fill)
|
Some(page.comp_workspace_config.workspace_mode),
|
||||||
.into()]))
|
Message::SetWorkspaceMode,
|
||||||
|
)
|
||||||
|
.width(Length::Fill)
|
||||||
|
.into(),
|
||||||
|
]))
|
||||||
.apply(Element::from)
|
.apply(Element::from)
|
||||||
.map(crate::pages::Message::DesktopWorkspaces)
|
.map(crate::pages::Message::DesktopWorkspaces)
|
||||||
})
|
})
|
||||||
|
|
@ -170,22 +174,26 @@ fn workspace_orientation() -> Section<crate::pages::Message> {
|
||||||
let descriptions = §ion.descriptions;
|
let descriptions = §ion.descriptions;
|
||||||
settings::section()
|
settings::section()
|
||||||
.title(§ion.title)
|
.title(§ion.title)
|
||||||
.add(settings::item_row(vec![radio(
|
.add(settings::item_row(vec![
|
||||||
text::body(&descriptions[vertical]),
|
radio(
|
||||||
WorkspaceLayout::Vertical,
|
text::body(&descriptions[vertical]),
|
||||||
Some(page.comp_workspace_config.workspace_layout),
|
WorkspaceLayout::Vertical,
|
||||||
Message::SetWorkspaceLayout,
|
Some(page.comp_workspace_config.workspace_layout),
|
||||||
)
|
Message::SetWorkspaceLayout,
|
||||||
.width(Length::Fill)
|
)
|
||||||
.into()]))
|
.width(Length::Fill)
|
||||||
.add(settings::item_row(vec![radio(
|
.into(),
|
||||||
text::body(&descriptions[horizontal]),
|
]))
|
||||||
WorkspaceLayout::Horizontal,
|
.add(settings::item_row(vec![
|
||||||
Some(page.comp_workspace_config.workspace_layout),
|
radio(
|
||||||
Message::SetWorkspaceLayout,
|
text::body(&descriptions[horizontal]),
|
||||||
)
|
WorkspaceLayout::Horizontal,
|
||||||
.width(Length::Fill)
|
Some(page.comp_workspace_config.workspace_layout),
|
||||||
.into()]))
|
Message::SetWorkspaceLayout,
|
||||||
|
)
|
||||||
|
.width(Length::Fill)
|
||||||
|
.into(),
|
||||||
|
]))
|
||||||
.apply(Element::from)
|
.apply(Element::from)
|
||||||
.map(crate::pages::Message::DesktopWorkspaces)
|
.map(crate::pages::Message::DesktopWorkspaces)
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,16 @@
|
||||||
// Copyright 2023 System76 <info@system76.com>
|
// Copyright 2023 System76 <info@system76.com>
|
||||||
// SPDX-License-Identifier: MPL-2.0
|
// SPDX-License-Identifier: MPL-2.0
|
||||||
|
|
||||||
|
use cosmic::Renderer;
|
||||||
use cosmic::iced_core::renderer::Quad;
|
use cosmic::iced_core::renderer::Quad;
|
||||||
use cosmic::iced_core::widget::{tree, Tree};
|
use cosmic::iced_core::widget::{Tree, tree};
|
||||||
use cosmic::iced_core::{
|
use cosmic::iced_core::{
|
||||||
self as core, Border, Clipboard, Element, Layout, Length, Rectangle, Renderer as IcedRenderer,
|
self as core, Border, Clipboard, Element, Layout, Length, Rectangle, Renderer as IcedRenderer,
|
||||||
Shell, Size, Widget,
|
Shell, Size, Widget,
|
||||||
};
|
};
|
||||||
|
use cosmic::iced_core::{Point, layout, mouse, renderer, touch};
|
||||||
use cosmic::iced_core::{alignment, event, text};
|
use cosmic::iced_core::{alignment, event, text};
|
||||||
use cosmic::iced_core::{layout, mouse, renderer, touch, Point};
|
|
||||||
use cosmic::widget::segmented_button::{self, SingleSelectModel};
|
use cosmic::widget::segmented_button::{self, SingleSelectModel};
|
||||||
use cosmic::Renderer;
|
|
||||||
use cosmic_randr_shell::{self as randr, OutputKey};
|
use cosmic_randr_shell::{self as randr, OutputKey};
|
||||||
use randr::Transform;
|
use randr::Transform;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,16 +6,16 @@ pub mod arrangement;
|
||||||
|
|
||||||
use crate::{app, pages};
|
use crate::{app, pages};
|
||||||
use arrangement::Arrangement;
|
use arrangement::Arrangement;
|
||||||
use cosmic::iced::{time, Alignment, Length};
|
use cosmic::iced::{Alignment, Length, time};
|
||||||
use cosmic::iced_widget::scrollable::{Direction, RelativeOffset, Scrollbar};
|
use cosmic::iced_widget::scrollable::{Direction, RelativeOffset, Scrollbar};
|
||||||
use cosmic::widget::{
|
use cosmic::widget::{
|
||||||
self, column, container, dropdown, list_column, segmented_button, tab_bar, text, toggler,
|
self, column, container, dropdown, list_column, segmented_button, tab_bar, text, toggler,
|
||||||
};
|
};
|
||||||
use cosmic::{surface, Apply, Element, Task};
|
use cosmic::{Apply, Element, Task, surface};
|
||||||
use cosmic_randr_shell::{
|
use cosmic_randr_shell::{
|
||||||
AdaptiveSyncAvailability, AdaptiveSyncState, List, Output, OutputKey, Transform,
|
AdaptiveSyncAvailability, AdaptiveSyncState, List, Output, OutputKey, Transform,
|
||||||
};
|
};
|
||||||
use cosmic_settings_page::{self as page, section, Section};
|
use cosmic_settings_page::{self as page, Section, section};
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
use slab::Slab;
|
use slab::Slab;
|
||||||
use slotmap::{Key, SecondaryMap, SlotMap};
|
use slotmap::{Key, SecondaryMap, SlotMap};
|
||||||
|
|
|
||||||
|
|
@ -6,15 +6,15 @@ pub mod shortcuts;
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
|
|
||||||
use cosmic::{
|
use cosmic::{
|
||||||
|
Apply, Element, Task,
|
||||||
cosmic_config::{self, ConfigSet},
|
cosmic_config::{self, ConfigSet},
|
||||||
iced::{Alignment, Color, Length},
|
iced::{Alignment, Color, Length},
|
||||||
iced_core::Border,
|
iced_core::Border,
|
||||||
theme,
|
theme,
|
||||||
widget::{self, button, container, icon, radio, row, settings, ListColumn},
|
widget::{self, ListColumn, button, container, icon, radio, row, settings},
|
||||||
Apply, Element, Task,
|
|
||||||
};
|
};
|
||||||
use cosmic_comp_config::{KeyboardConfig, NumlockState, XkbConfig};
|
use cosmic_comp_config::{KeyboardConfig, NumlockState, XkbConfig};
|
||||||
use cosmic_settings_page::{self as page, section, Section};
|
use cosmic_settings_page::{self as page, Section, section};
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
use slab::Slab;
|
use slab::Slab;
|
||||||
use slotmap::{DefaultKey, Key, SlotMap};
|
use slotmap::{DefaultKey, Key, SlotMap};
|
||||||
|
|
@ -262,11 +262,13 @@ fn special_char_radio_row<'a>(
|
||||||
value: Option<&'static str>,
|
value: Option<&'static str>,
|
||||||
current_value: Option<&'a str>,
|
current_value: Option<&'a str>,
|
||||||
) -> cosmic::Element<'a, Message> {
|
) -> cosmic::Element<'a, Message> {
|
||||||
settings::item_row(vec![radio(desc, value, Some(current_value), |_| {
|
settings::item_row(vec![
|
||||||
Message::SpecialCharacterSelect(value)
|
radio(desc, value, Some(current_value), |_| {
|
||||||
})
|
Message::SpecialCharacterSelect(value)
|
||||||
.width(Length::Fill)
|
})
|
||||||
.into()])
|
.width(Length::Fill)
|
||||||
|
.into(),
|
||||||
|
])
|
||||||
.into()
|
.into()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -651,14 +653,16 @@ impl Page {
|
||||||
|
|
||||||
let mut list = cosmic::widget::list_column();
|
let mut list = cosmic::widget::list_column();
|
||||||
for (desc, state) in options {
|
for (desc, state) in options {
|
||||||
list = list.add(settings::item_row(vec![radio(
|
list = list.add(settings::item_row(vec![
|
||||||
cosmic::widget::text(desc),
|
radio(
|
||||||
Some(state),
|
cosmic::widget::text(desc),
|
||||||
Some(Some(current)),
|
Some(state),
|
||||||
|_| Message::SetNumlockState(state),
|
Some(Some(current)),
|
||||||
)
|
|_| Message::SetNumlockState(state),
|
||||||
.width(Length::Fill)
|
)
|
||||||
.into()]));
|
.width(Length::Fill)
|
||||||
|
.into(),
|
||||||
|
]));
|
||||||
}
|
}
|
||||||
|
|
||||||
cosmic::widget::container(list).padding(24).into()
|
cosmic::widget::container(list).padding(24).into()
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,9 @@ use super::{ShortcutBinding, ShortcutMessage, ShortcutModel};
|
||||||
use cosmic::iced::{Alignment, Length};
|
use cosmic::iced::{Alignment, Length};
|
||||||
use cosmic::widget::{self, button, icon};
|
use cosmic::widget::{self, button, icon};
|
||||||
use cosmic::{Apply, Element, Task};
|
use cosmic::{Apply, Element, Task};
|
||||||
use cosmic_settings_config::shortcuts::{Action, Shortcuts};
|
|
||||||
use cosmic_settings_config::Binding;
|
use cosmic_settings_config::Binding;
|
||||||
use cosmic_settings_page::{self as page, section, Section};
|
use cosmic_settings_config::shortcuts::{Action, Shortcuts};
|
||||||
|
use cosmic_settings_page::{self as page, Section, section};
|
||||||
use slab::Slab;
|
use slab::Slab;
|
||||||
use slotmap::{Key, SlotMap};
|
use slotmap::{Key, SlotMap};
|
||||||
|
|
||||||
|
|
@ -441,11 +441,9 @@ fn shortcuts() -> Section<crate::pages::Message> {
|
||||||
.view::<Page>(move |_binder, page, _section| {
|
.view::<Page>(move |_binder, page, _section| {
|
||||||
let content = if page.model.shortcut_models.is_empty() {
|
let content = if page.model.shortcut_models.is_empty() {
|
||||||
widget::settings::section()
|
widget::settings::section()
|
||||||
.add(widget::settings::item_row(vec![widget::text::body(fl!(
|
.add(widget::settings::item_row(vec![
|
||||||
"custom-shortcuts",
|
widget::text::body(fl!("custom-shortcuts", "none")).into(),
|
||||||
"none"
|
]))
|
||||||
))
|
|
||||||
.into()]))
|
|
||||||
.into()
|
.into()
|
||||||
} else {
|
} else {
|
||||||
page.model.view().map(Message::Shortcut)
|
page.model.view().map(Message::Shortcut)
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,9 @@
|
||||||
|
|
||||||
use super::{ShortcutMessage, ShortcutModel};
|
use super::{ShortcutMessage, ShortcutModel};
|
||||||
use cosmic::{Element, Task};
|
use cosmic::{Element, Task};
|
||||||
use cosmic_settings_config::shortcuts::action::ResizeDirection;
|
|
||||||
use cosmic_settings_config::shortcuts::Action;
|
use cosmic_settings_config::shortcuts::Action;
|
||||||
use cosmic_settings_page::{self as page, section, Section};
|
use cosmic_settings_config::shortcuts::action::ResizeDirection;
|
||||||
|
use cosmic_settings_page::{self as page, Section, section};
|
||||||
use slab::Slab;
|
use slab::Slab;
|
||||||
|
|
||||||
pub struct Page {
|
pub struct Page {
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,9 @@
|
||||||
//
|
//
|
||||||
use super::{ShortcutMessage, ShortcutModel};
|
use super::{ShortcutMessage, ShortcutModel};
|
||||||
use cosmic::{Element, Task};
|
use cosmic::{Element, Task};
|
||||||
use cosmic_settings_config::shortcuts::action::Direction;
|
|
||||||
use cosmic_settings_config::shortcuts::Action;
|
use cosmic_settings_config::shortcuts::Action;
|
||||||
use cosmic_settings_page::{self as page, section, Section};
|
use cosmic_settings_config::shortcuts::action::Direction;
|
||||||
|
use cosmic_settings_page::{self as page, Section, section};
|
||||||
use slab::Slab;
|
use slab::Slab;
|
||||||
|
|
||||||
pub struct Page {
|
pub struct Page {
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,9 @@
|
||||||
|
|
||||||
use super::{ShortcutMessage, ShortcutModel};
|
use super::{ShortcutMessage, ShortcutModel};
|
||||||
use cosmic::{Element, Task};
|
use cosmic::{Element, Task};
|
||||||
use cosmic_settings_config::shortcuts::action::{Direction, FocusDirection};
|
|
||||||
use cosmic_settings_config::shortcuts::Action;
|
use cosmic_settings_config::shortcuts::Action;
|
||||||
use cosmic_settings_page::{self as page, section, Section};
|
use cosmic_settings_config::shortcuts::action::{Direction, FocusDirection};
|
||||||
|
use cosmic_settings_page::{self as page, Section, section};
|
||||||
use slab::Slab;
|
use slab::Slab;
|
||||||
|
|
||||||
pub struct Page {
|
pub struct Page {
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,9 @@
|
||||||
|
|
||||||
use super::{ShortcutMessage, ShortcutModel};
|
use super::{ShortcutMessage, ShortcutModel};
|
||||||
use cosmic::{Element, Task};
|
use cosmic::{Element, Task};
|
||||||
use cosmic_settings_config::shortcuts::action::System as SystemAction;
|
|
||||||
use cosmic_settings_config::shortcuts::Action;
|
use cosmic_settings_config::shortcuts::Action;
|
||||||
use cosmic_settings_page::{self as page, section, Section};
|
use cosmic_settings_config::shortcuts::action::System as SystemAction;
|
||||||
|
use cosmic_settings_page::{self as page, Section, section};
|
||||||
use slab::Slab;
|
use slab::Slab;
|
||||||
|
|
||||||
pub struct Page {
|
pub struct Page {
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,9 @@
|
||||||
|
|
||||||
use super::{ShortcutMessage, ShortcutModel};
|
use super::{ShortcutMessage, ShortcutModel};
|
||||||
use cosmic::{Element, Task};
|
use cosmic::{Element, Task};
|
||||||
use cosmic_settings_config::shortcuts::action::Orientation;
|
|
||||||
use cosmic_settings_config::shortcuts::Action;
|
use cosmic_settings_config::shortcuts::Action;
|
||||||
use cosmic_settings_page::{self as page, section, Section};
|
use cosmic_settings_config::shortcuts::action::Orientation;
|
||||||
|
use cosmic_settings_page::{self as page, Section, section};
|
||||||
use slab::Slab;
|
use slab::Slab;
|
||||||
|
|
||||||
pub struct Page {
|
pub struct Page {
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@
|
||||||
|
|
||||||
use crate::app;
|
use crate::app;
|
||||||
use cosmic::{
|
use cosmic::{
|
||||||
cosmic_config::{self, ConfigGet, ConfigSet},
|
|
||||||
Task,
|
Task,
|
||||||
|
cosmic_config::{self, ConfigGet, ConfigSet},
|
||||||
};
|
};
|
||||||
use cosmic_comp_config::input::{
|
use cosmic_comp_config::input::{
|
||||||
AccelConfig, AccelProfile, ClickMethod, InputConfig, ScrollConfig, ScrollMethod, TapButtonMap,
|
AccelConfig, AccelProfile, ClickMethod, InputConfig, ScrollConfig, ScrollMethod, TapButtonMap,
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,9 @@ use cosmic::cosmic_config::ConfigGet;
|
||||||
use cosmic::iced::{Alignment, Length};
|
use cosmic::iced::{Alignment, Length};
|
||||||
use cosmic::widget::{self, row, settings, text};
|
use cosmic::widget::{self, row, settings, text};
|
||||||
use cosmic::{Apply, Element};
|
use cosmic::{Apply, Element};
|
||||||
|
use cosmic_comp_config::CosmicCompConfig;
|
||||||
use cosmic_comp_config::input::{AccelProfile, ClickMethod, ScrollMethod};
|
use cosmic_comp_config::input::{AccelProfile, ClickMethod, ScrollMethod};
|
||||||
use cosmic_comp_config::workspace::{WorkspaceConfig, WorkspaceLayout};
|
use cosmic_comp_config::workspace::{WorkspaceConfig, WorkspaceLayout};
|
||||||
use cosmic_comp_config::CosmicCompConfig;
|
|
||||||
use cosmic_settings_page::Section;
|
use cosmic_settings_page::Section;
|
||||||
use cosmic_settings_page::{self as page, section};
|
use cosmic_settings_page::{self as page, section};
|
||||||
use slab::Slab;
|
use slab::Slab;
|
||||||
|
|
@ -167,23 +167,27 @@ fn click_behavior() -> Section<crate::pages::Message> {
|
||||||
settings::section()
|
settings::section()
|
||||||
.title(&*section.title)
|
.title(&*section.title)
|
||||||
// Secondary click via two fingers, and middle-click via three fingers
|
// Secondary click via two fingers, and middle-click via three fingers
|
||||||
.add(settings::item_row(vec![widget::radio(
|
.add(settings::item_row(vec![
|
||||||
text::body(&descriptions[click_finger]),
|
widget::radio(
|
||||||
ClickMethod::Clickfinger,
|
text::body(&descriptions[click_finger]),
|
||||||
page.input_touchpad.click_method,
|
ClickMethod::Clickfinger,
|
||||||
|option| Message::SetSecondaryClickBehavior(Some(option), true),
|
page.input_touchpad.click_method,
|
||||||
)
|
|option| Message::SetSecondaryClickBehavior(Some(option), true),
|
||||||
.width(Length::Fill)
|
)
|
||||||
.into()]))
|
.width(Length::Fill)
|
||||||
|
.into(),
|
||||||
|
]))
|
||||||
// Secondary and middle-click via button areas.
|
// Secondary and middle-click via button areas.
|
||||||
.add(settings::item_row(vec![widget::radio(
|
.add(settings::item_row(vec![
|
||||||
text::body(&descriptions[button_areas]),
|
widget::radio(
|
||||||
ClickMethod::ButtonAreas,
|
text::body(&descriptions[button_areas]),
|
||||||
page.input_touchpad.click_method,
|
ClickMethod::ButtonAreas,
|
||||||
|option| Message::SetSecondaryClickBehavior(Some(option), true),
|
page.input_touchpad.click_method,
|
||||||
)
|
|option| Message::SetSecondaryClickBehavior(Some(option), true),
|
||||||
.width(Length::Fill)
|
)
|
||||||
.into()]))
|
.width(Length::Fill)
|
||||||
|
.into(),
|
||||||
|
]))
|
||||||
.add(
|
.add(
|
||||||
settings::item::builder(&descriptions[tap_to_click]).toggler(
|
settings::item::builder(&descriptions[tap_to_click]).toggler(
|
||||||
page.input_touchpad
|
page.input_touchpad
|
||||||
|
|
@ -219,29 +223,33 @@ fn scrolling() -> Section<crate::pages::Message> {
|
||||||
settings::section()
|
settings::section()
|
||||||
.title(§ion.title)
|
.title(§ion.title)
|
||||||
// Two-finger scrolling toggle
|
// Two-finger scrolling toggle
|
||||||
.add(settings::item_row(vec![widget::radio(
|
.add(settings::item_row(vec![
|
||||||
text::body(&descriptions[two_finger]),
|
widget::radio(
|
||||||
ScrollMethod::TwoFinger,
|
text::body(&descriptions[two_finger]),
|
||||||
page.input_touchpad
|
ScrollMethod::TwoFinger,
|
||||||
.scroll_config
|
page.input_touchpad
|
||||||
.as_ref()
|
.scroll_config
|
||||||
.and_then(|x| x.method),
|
.as_ref()
|
||||||
|option| Message::SetScrollMethod(Some(option), true),
|
.and_then(|x| x.method),
|
||||||
)
|
|option| Message::SetScrollMethod(Some(option), true),
|
||||||
.width(Length::Fill)
|
)
|
||||||
.into()]))
|
.width(Length::Fill)
|
||||||
|
.into(),
|
||||||
|
]))
|
||||||
// Edge scrolling toggle
|
// Edge scrolling toggle
|
||||||
.add(settings::item_row(vec![widget::radio(
|
.add(settings::item_row(vec![
|
||||||
text::body(&descriptions[edge]),
|
widget::radio(
|
||||||
ScrollMethod::Edge,
|
text::body(&descriptions[edge]),
|
||||||
page.input_touchpad
|
ScrollMethod::Edge,
|
||||||
.scroll_config
|
page.input_touchpad
|
||||||
.as_ref()
|
.scroll_config
|
||||||
.and_then(|x| x.method),
|
.as_ref()
|
||||||
|option| Message::SetScrollMethod(Some(option), true),
|
.and_then(|x| x.method),
|
||||||
)
|
|option| Message::SetScrollMethod(Some(option), true),
|
||||||
.width(Length::Fill)
|
)
|
||||||
.into()]))
|
.width(Length::Fill)
|
||||||
|
.into(),
|
||||||
|
]))
|
||||||
// Scroll speed slider
|
// Scroll speed slider
|
||||||
.add(settings::item(&descriptions[scroll_speed], {
|
.add(settings::item(&descriptions[scroll_speed], {
|
||||||
let value = page
|
let value = page
|
||||||
|
|
|
||||||
|
|
@ -8,12 +8,12 @@ pub mod wired;
|
||||||
use std::{ffi::OsStr, process::Stdio, sync::Arc};
|
use std::{ffi::OsStr, process::Stdio, sync::Arc};
|
||||||
|
|
||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
use cosmic::{widget, Apply, Element, Task};
|
use cosmic::{Apply, Element, Task, widget};
|
||||||
use cosmic_dbus_networkmanager::{
|
use cosmic_dbus_networkmanager::{
|
||||||
interface::enums::{DeviceState, DeviceType},
|
interface::enums::{DeviceState, DeviceType},
|
||||||
nm::NetworkManager,
|
nm::NetworkManager,
|
||||||
};
|
};
|
||||||
use cosmic_settings_page::{self as page, section, Section};
|
use cosmic_settings_page::{self as page, Section, section};
|
||||||
use cosmic_settings_subscriptions::network_manager;
|
use cosmic_settings_subscriptions::network_manager;
|
||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
use slotmap::SlotMap;
|
use slotmap::SlotMap;
|
||||||
|
|
@ -322,17 +322,17 @@ impl Page {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut devices_changed = std::pin::pin!(network_manager
|
let mut devices_changed =
|
||||||
.receive_devices_changed()
|
std::pin::pin!(network_manager.receive_devices_changed().await.then(
|
||||||
.await
|
|_| async {
|
||||||
.then(|_| async {
|
match network_manager::devices::list(&conn, |_| true).await {
|
||||||
match network_manager::devices::list(&conn, |_| true).await {
|
Ok(devices) => Message::UpdateDevices(
|
||||||
Ok(devices) => {
|
devices.into_iter().map(Arc::new).collect(),
|
||||||
Message::UpdateDevices(devices.into_iter().map(Arc::new).collect())
|
),
|
||||||
|
Err(why) => Message::Error(why.to_string()),
|
||||||
}
|
}
|
||||||
Err(why) => Message::Error(why.to_string()),
|
|
||||||
}
|
}
|
||||||
}));
|
));
|
||||||
|
|
||||||
while let Some(message) = devices_changed.next().await {
|
while let Some(message) = devices_changed.next().await {
|
||||||
_ = emitter
|
_ = emitter
|
||||||
|
|
|
||||||
|
|
@ -8,14 +8,14 @@ use std::sync::Arc;
|
||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
use cosmic::dialog::file_chooser::FileFilter;
|
use cosmic::dialog::file_chooser::FileFilter;
|
||||||
use cosmic::{
|
use cosmic::{
|
||||||
|
Apply, Element, Task,
|
||||||
iced::{Alignment, Length},
|
iced::{Alignment, Length},
|
||||||
iced_core::text::Wrapping,
|
iced_core::text::Wrapping,
|
||||||
widget::{self, icon},
|
widget::{self, icon},
|
||||||
Apply, Element, Task,
|
|
||||||
};
|
};
|
||||||
use cosmic_settings_page::{self as page, section, Section};
|
use cosmic_settings_page::{self as page, Section, section};
|
||||||
use cosmic_settings_subscriptions::network_manager::{
|
use cosmic_settings_subscriptions::network_manager::{
|
||||||
self, current_networks::ActiveConnectionInfo, NetworkManagerState, UUID,
|
self, NetworkManagerState, UUID, current_networks::ActiveConnectionInfo,
|
||||||
};
|
};
|
||||||
use futures::{FutureExt, StreamExt};
|
use futures::{FutureExt, StreamExt};
|
||||||
use indexmap::IndexMap;
|
use indexmap::IndexMap;
|
||||||
|
|
|
||||||
|
|
@ -5,15 +5,15 @@ use std::{collections::BTreeSet, sync::Arc};
|
||||||
|
|
||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
use cosmic::{
|
use cosmic::{
|
||||||
|
Apply, Element, Task,
|
||||||
iced::{Alignment, Length},
|
iced::{Alignment, Length},
|
||||||
iced_core::text::Wrapping,
|
iced_core::text::Wrapping,
|
||||||
widget::{self, icon},
|
widget::{self, icon},
|
||||||
Apply, Element, Task,
|
|
||||||
};
|
};
|
||||||
use cosmic_dbus_networkmanager::interface::enums::DeviceState;
|
use cosmic_dbus_networkmanager::interface::enums::DeviceState;
|
||||||
use cosmic_settings_page::{self as page, section, Section};
|
use cosmic_settings_page::{self as page, Section, section};
|
||||||
use cosmic_settings_subscriptions::network_manager::{
|
use cosmic_settings_subscriptions::network_manager::{
|
||||||
self, current_networks::ActiveConnectionInfo, NetworkManagerState,
|
self, NetworkManagerState, current_networks::ActiveConnectionInfo,
|
||||||
};
|
};
|
||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use chrono::{Duration, TimeDelta};
|
use chrono::{Duration, TimeDelta};
|
||||||
use futures::{future::join_all, FutureExt, Stream, StreamExt};
|
use futures::{FutureExt, Stream, StreamExt, future::join_all};
|
||||||
use upower_dbus::{BatteryState, BatteryType, DeviceProxy};
|
use upower_dbus::{BatteryState, BatteryType, DeviceProxy};
|
||||||
use zbus::{zvariant::ObjectPath, Connection};
|
use zbus::{Connection, zvariant::ObjectPath};
|
||||||
|
|
||||||
mod ppdaemon;
|
mod ppdaemon;
|
||||||
mod s76powerdaemon;
|
mod s76powerdaemon;
|
||||||
|
|
@ -284,7 +284,9 @@ async fn enumerate_devices<'a>() -> Result<Vec<upower_dbus::DeviceProxy<'a>>, zb
|
||||||
.filter_map(std::result::Result::err)
|
.filter_map(std::result::Result::err)
|
||||||
.collect();
|
.collect();
|
||||||
if errors.len() > 1 {
|
if errors.len() > 1 {
|
||||||
eprintln!("Multiple errors occurs when fetching connected device: {errors:?}. Only the last one will be returned.");
|
eprintln!(
|
||||||
|
"Multiple errors occurs when fetching connected device: {errors:?}. Only the last one will be returned."
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return Err(errors.pop().unwrap());
|
return Err(errors.pop().unwrap());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,14 +4,14 @@ use self::backend::{GetCurrentPowerProfile, SetPowerProfile};
|
||||||
use backend::{Battery, ConnectedDevice, PowerProfile};
|
use backend::{Battery, ConnectedDevice, PowerProfile};
|
||||||
|
|
||||||
use chrono::TimeDelta;
|
use chrono::TimeDelta;
|
||||||
|
use cosmic::Task;
|
||||||
use cosmic::iced::{Alignment, Length};
|
use cosmic::iced::{Alignment, Length};
|
||||||
use cosmic::iced_widget::{column, row};
|
use cosmic::iced_widget::{column, row};
|
||||||
use cosmic::widget::{self, radio, settings, text};
|
use cosmic::widget::{self, radio, settings, text};
|
||||||
use cosmic::Task;
|
use cosmic::{Apply, surface};
|
||||||
use cosmic::{surface, Apply};
|
|
||||||
use cosmic_config::{Config, CosmicConfigEntry};
|
use cosmic_config::{Config, CosmicConfigEntry};
|
||||||
use cosmic_idle_config::CosmicIdleConfig;
|
use cosmic_idle_config::CosmicIdleConfig;
|
||||||
use cosmic_settings_page::{self as page, section, Section};
|
use cosmic_settings_page::{self as page, Section, section};
|
||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
use slab::Slab;
|
use slab::Slab;
|
||||||
|
|
@ -383,16 +383,18 @@ fn profiles() -> Section<crate::pages::Message> {
|
||||||
section = profiles
|
section = profiles
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|profile| {
|
.map(|profile| {
|
||||||
settings::item_row(vec![radio(
|
settings::item_row(vec![
|
||||||
widget::column::with_capacity(2)
|
radio(
|
||||||
.push(text::body(profile.title()))
|
widget::column::with_capacity(2)
|
||||||
.push(text::caption(profile.description())),
|
.push(text::body(profile.title()))
|
||||||
profile,
|
.push(text::caption(profile.description())),
|
||||||
Some(current_profile),
|
profile,
|
||||||
Message::PowerProfileChange,
|
Some(current_profile),
|
||||||
)
|
Message::PowerProfileChange,
|
||||||
.width(Length::Fill)
|
)
|
||||||
.into()])
|
.width(Length::Fill)
|
||||||
|
.into(),
|
||||||
|
])
|
||||||
})
|
})
|
||||||
.fold(section, settings::Section::add);
|
.fold(section, settings::Section::add);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
// Copyright 2023 System76 <info@system76.com>
|
// Copyright 2023 System76 <info@system76.com>
|
||||||
// SPDX-License-Identifier: GPL-3.0-only
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
|
||||||
use cosmic_settings_page::{self as page, section, Section};
|
use cosmic_settings_page::{self as page, Section, section};
|
||||||
|
|
||||||
use cosmic::widget::{editable_input, list_column, settings, text};
|
use cosmic::widget::{editable_input, list_column, settings, text};
|
||||||
use cosmic::{Apply, Task};
|
use cosmic::{Apply, Task};
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,13 @@ use std::str::FromStr;
|
||||||
|
|
||||||
use chrono::{Datelike, Timelike};
|
use chrono::{Datelike, Timelike};
|
||||||
use cosmic::{
|
use cosmic::{
|
||||||
|
Apply, Element, Task,
|
||||||
cosmic_config::{self, ConfigGet, ConfigSet},
|
cosmic_config::{self, ConfigGet, ConfigSet},
|
||||||
iced_core::text::Wrapping,
|
iced_core::text::Wrapping,
|
||||||
surface,
|
surface,
|
||||||
widget::{self, dropdown, settings},
|
widget::{self, dropdown, settings},
|
||||||
Apply, Element, Task,
|
|
||||||
};
|
};
|
||||||
use cosmic_settings_page::{self as page, section, Section};
|
use cosmic_settings_page::{self as page, Section, section};
|
||||||
use icu::{
|
use icu::{
|
||||||
calendar::{DateTime, Iso},
|
calendar::{DateTime, Iso},
|
||||||
datetime::DateTimeFormatter,
|
datetime::DateTimeFormatter,
|
||||||
|
|
|
||||||
|
|
@ -9,18 +9,18 @@ use std::sync::Arc;
|
||||||
use cosmic::iced::{Alignment, Border, Color, Length};
|
use cosmic::iced::{Alignment, Border, Color, Length};
|
||||||
use cosmic::iced_core::text::Wrapping;
|
use cosmic::iced_core::text::Wrapping;
|
||||||
use cosmic::widget::{self, button, container};
|
use cosmic::widget::{self, button, container};
|
||||||
use cosmic::{theme, Apply, Element};
|
use cosmic::{Apply, Element, theme};
|
||||||
use cosmic_config::{ConfigGet, ConfigSet};
|
use cosmic_config::{ConfigGet, ConfigSet};
|
||||||
use cosmic_settings_page::Section;
|
use cosmic_settings_page::Section;
|
||||||
use cosmic_settings_page::{self as page, section};
|
use cosmic_settings_page::{self as page, section};
|
||||||
use eyre::Context;
|
use eyre::Context;
|
||||||
use fixed_decimal::FixedDecimal;
|
use fixed_decimal::FixedDecimal;
|
||||||
use icu::calendar::DateTime;
|
use icu::calendar::DateTime;
|
||||||
|
use icu::datetime::DateTimeFormatter;
|
||||||
use icu::datetime::options::components::{self, Bag};
|
use icu::datetime::options::components::{self, Bag};
|
||||||
use icu::datetime::options::preferences;
|
use icu::datetime::options::preferences;
|
||||||
use icu::datetime::DateTimeFormatter;
|
|
||||||
use icu::decimal::options::FixedDecimalFormatterOptions;
|
|
||||||
use icu::decimal::FixedDecimalFormatter;
|
use icu::decimal::FixedDecimalFormatter;
|
||||||
|
use icu::decimal::options::FixedDecimalFormatterOptions;
|
||||||
use locales_rs as locale;
|
use locales_rs as locale;
|
||||||
use slotmap::{DefaultKey, SlotMap};
|
use slotmap::{DefaultKey, SlotMap};
|
||||||
|
|
||||||
|
|
@ -228,7 +228,7 @@ impl Page {
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
Message::Refresh(Arc::new(page_reload().await))
|
Message::Refresh(Arc::new(page_reload().await))
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Message::Refresh(result) => match Arc::into_inner(result).unwrap() {
|
Message::Refresh(result) => match Arc::into_inner(result).unwrap() {
|
||||||
|
|
@ -588,8 +588,9 @@ mod preferred_languages {
|
||||||
|
|
||||||
use super::Message;
|
use super::Message;
|
||||||
use cosmic::{
|
use cosmic::{
|
||||||
|
Apply,
|
||||||
iced::{Alignment, Length},
|
iced::{Alignment, Length},
|
||||||
widget, Apply,
|
widget,
|
||||||
};
|
};
|
||||||
use cosmic_settings_page::Section;
|
use cosmic_settings_page::Section;
|
||||||
|
|
||||||
|
|
@ -646,7 +647,7 @@ mod preferred_languages {
|
||||||
|
|
||||||
mod formatting {
|
mod formatting {
|
||||||
use super::Message;
|
use super::Message;
|
||||||
use cosmic::{widget, Apply};
|
use cosmic::{Apply, widget};
|
||||||
use cosmic_settings_page::Section;
|
use cosmic_settings_page::Section;
|
||||||
|
|
||||||
pub fn section() -> Section<crate::pages::Message> {
|
pub fn section() -> Section<crate::pages::Message> {
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,9 @@ use std::any::TypeId;
|
||||||
use ashpd::desktop::location::{Location, LocationProxy};
|
use ashpd::desktop::location::{Location, LocationProxy};
|
||||||
use chrono::Datelike;
|
use chrono::Datelike;
|
||||||
use cosmic::iced::{
|
use cosmic::iced::{
|
||||||
futures::{channel::mpsc::Sender, future, SinkExt, StreamExt},
|
Subscription,
|
||||||
stream, Subscription,
|
futures::{SinkExt, StreamExt, channel::mpsc::Sender, future},
|
||||||
|
stream,
|
||||||
};
|
};
|
||||||
use sunrise::sunrise_sunset;
|
use sunrise::sunrise_sunset;
|
||||||
use tokio::select;
|
use tokio::select;
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
use cosmic::{
|
use cosmic::{
|
||||||
iced::{stream, Subscription},
|
iced::{Subscription, stream},
|
||||||
iced_futures::futures::{self, SinkExt},
|
iced_futures::futures::{self, SinkExt},
|
||||||
};
|
};
|
||||||
use notify::{Config, Event, RecommendedWatcher, RecursiveMode, Watcher};
|
use notify::{Config, Event, RecommendedWatcher, RecursiveMode, Watcher};
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
use std::hash::Hash;
|
use std::hash::Hash;
|
||||||
use tokio::sync::mpsc::{unbounded_channel, UnboundedReceiver};
|
use tokio::sync::mpsc::{UnboundedReceiver, unbounded_channel};
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum State {
|
pub enum State {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue