This commit is contained in:
Ashley Wulber 2024-10-23 09:23:29 -04:00 committed by Ashley Wulber
parent 35717797b7
commit 88fbd8f96b
12 changed files with 741 additions and 742 deletions

1363
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -46,8 +46,7 @@ package = "smithay-client-toolkit"
# rev = "c583de8"
[profile.release]
opt-level = 1
# lto = "thin"
lto = "thin"
# [patch.'https://github.com/smithay/client-toolkit/']
# smithay-client-toolkit = { git = "https://github.com/smithay/client-toolkit//", rev = "c583de8" }

View file

@ -52,7 +52,7 @@ pub struct SettingsApp {
}
impl SettingsApp {
fn subTask_to_page(&self, cmd: &PageCommands) -> Option<Entity> {
fn subtask_to_page(&self, cmd: &PageCommands) -> Option<Entity> {
match cmd {
PageCommands::About => self.pages.page_id::<system::about::Page>(),
PageCommands::Appearance => self.pages.page_id::<desktop::appearance::Page>(),
@ -153,7 +153,7 @@ impl cosmic::Application for SettingsApp {
app.insert_page::<system::Page>();
let active_id = match flags.sub_command {
Some(p) => app.subTask_to_page(&p),
Some(p) => app.subtask_to_page(&p),
None => app
.pages
.find_page_by_id(&app.config.active_page)
@ -517,7 +517,7 @@ impl cosmic::Application for SettingsApp {
.map(Into::into),
);
}
return Command::batch(commands);
return Task::batch(commands);
}
Message::OutputRemoved(output) => {
@ -537,7 +537,7 @@ impl cosmic::Application for SettingsApp {
.map(Into::into),
);
}
return Command::batch(commands);
return Task::batch(commands);
}
Message::PanelConfig(config) if config.name.to_lowercase().contains("panel") => {
@ -644,7 +644,7 @@ impl cosmic::Application for SettingsApp {
cosmic::app::DbusActivationDetails::ActivateAction { action, .. } => {
PageCommands::from_str(&action)
.ok()
.and_then(|action| self.subTask_to_page(&action))
.and_then(|action| self.subtask_to_page(&action))
.map(|e| self.activate_page(e))
}
}

View file

@ -92,7 +92,7 @@ pub async fn watch(
.receive_interfaces_removed()
.await?;
let (mut property_watcher, mut property_watcher_Task) = DevicePropertyWatcher::new();
let (mut property_watcher, mut property_watcher_task) = DevicePropertyWatcher::new();
for (path, interfaces) in managed_object_proxy.get_managed_objects().await? {
if interfaces.contains_key("org.bluez.Device1")
@ -105,7 +105,7 @@ pub async fn watch(
while !property_watcher.rx.is_terminated() {
futures::select! {
Task = property_watcher.rx.next() => match Task {
task = property_watcher.rx.next() => match task {
Some(DevicePropertyWatcherTask::Add(path)) => {
property_watcher.insert(&connection, path).await?;
}
@ -144,7 +144,7 @@ pub async fn watch(
Ok(device) => {
match bluetooth::Device::from_device(&device).await {
Ok(device) => {
property_watcher_Task
property_watcher_task
.send(DevicePropertyWatcherTask::Add(args.object_path.to_owned().into())).await.map_err(|e| zbus::Error::Failure(e.to_string()))?;
tx
@ -170,7 +170,7 @@ pub async fn watch(
Some(signal) => {
let args = signal.args()?;
if args.interfaces.contains(&"org.bluez.Device1") {
property_watcher_Task.send(DevicePropertyWatcherTask::Removed(
property_watcher_task.send(DevicePropertyWatcherTask::Removed(
args.object_path.to_owned().into(),
)).await.map_err(|e| zbus::Error::Failure(e.to_string()))?;
tx

View file

@ -7,11 +7,10 @@ use std::sync::Arc;
use cosmic::{
config::{CosmicTk, FontConfig},
iced::Length,
iced_core::text::Wrap,
iced_style::svg::Appearance,
iced_core::text::Wrapping,
theme,
widget::{self, settings},
Apply, Command, Element,
widget::{self, settings, svg},
Apply, Element, Task,
};
use cosmic_config::ConfigSet;
use ustr::Ustr;
@ -76,7 +75,7 @@ pub fn selection_context<'a>(
let svg_accent = Rc::new(|theme: &cosmic::Theme| {
let color = theme.cosmic().accent_color().into();
Appearance { color: Some(color) }
svg::Style { color: Some(color) }
});
let search_input = widget::search_input(fl!("type-to-search"), search)
@ -87,22 +86,24 @@ pub fn selection_context<'a>(
let selected = &**family == current_font;
list.add(
settings::item_row(vec![
widget::text::body(&**family).wrap(Wrap::Word).into(),
widget::horizontal_space(Length::Fill).into(),
widget::text::body(&**family)
.wrapping(Wrapping::Word)
.into(),
widget::horizontal_space().width(Length::Fill).into(),
if selected {
widget::icon::from_name("object-select-symbolic")
.size(16)
.icon()
.style(cosmic::theme::Svg::Custom(svg_accent.clone()))
.class(cosmic::theme::Svg::Custom(svg_accent.clone()))
.into()
} else {
widget::horizontal_space(16).into()
widget::horizontal_space().width(16).into()
},
])
.apply(widget::container)
.style(cosmic::theme::Container::List)
.class(cosmic::theme::Container::List)
.apply(widget::button::custom)
.style(cosmic::theme::Button::Transparent)
.class(cosmic::theme::Button::Transparent)
.on_press(super::Message::FontSelect(system, family.clone())),
)
});
@ -148,7 +149,7 @@ impl Model {
}
}
pub fn update(&mut self, message: Message) -> Command<crate::app::Message> {
pub fn update(&mut self, message: Message) -> Task<crate::app::Message> {
match message {
Message::InterfaceFontFamily(id) => {
if let Some(family) = self.interface_font_families.get(id) {
@ -203,7 +204,7 @@ impl Model {
}
}
Command::none()
Task::none()
}
}

View file

@ -6,7 +6,6 @@ use std::{collections::BTreeMap, path::PathBuf};
use super::Message;
use cosmic::{
iced::{Background, Length},
prelude::CollectionWidget,
widget::{button, icon, text},
Element,
};
@ -43,7 +42,7 @@ pub fn button(
.take(ICON_PREV_ROW)
.cloned()
// TODO: Maybe allow choosable sizes/zooming
.map(|handle| handle.icon().size(ICON_THUMB_SIZE)),
.map(|handle| handle.icon().size(ICON_THUMB_SIZE).into()),
)
.spacing(theme.space_xxxs())
.into(),
@ -54,7 +53,7 @@ pub fn button(
.skip(ICON_PREV_ROW)
.cloned()
// TODO: Maybe allow choosable sizes/zooming
.map(|handle| handle.icon().size(ICON_THUMB_SIZE)),
.map(|handle| handle.icon().size(ICON_THUMB_SIZE).into()),
)
.spacing(theme.space_xxxs())
.into(),
@ -66,9 +65,9 @@ pub fn button(
.selected(selected)
.padding([theme.space_xs(), theme.space_xs() + 1])
// Image button's style mostly works, but it needs a background to fit the design
.style(button::Style::Custom {
.class(button::ButtonClass::Custom {
active: Box::new(move |focused, theme| {
let mut appearance = <cosmic::theme::Theme as button::StyleSheet>::active(
let mut appearance = <cosmic::theme::Theme as button::Catalog>::active(
theme,
focused,
selected,
@ -78,7 +77,7 @@ pub fn button(
appearance
}),
disabled: Box::new(move |theme| {
let mut appearance = <cosmic::theme::Theme as button::StyleSheet>::disabled(
let mut appearance = <cosmic::theme::Theme as button::Catalog>::disabled(
theme,
&cosmic::theme::Button::Image,
);
@ -86,7 +85,7 @@ pub fn button(
appearance
}),
hovered: Box::new(move |focused, theme| {
let mut appearance = <cosmic::theme::Theme as button::StyleSheet>::hovered(
let mut appearance = <cosmic::theme::Theme as button::Catalog>::hovered(
theme,
focused,
selected,
@ -96,7 +95,7 @@ pub fn button(
appearance
}),
pressed: Box::new(move |focused, theme| {
let mut appearance = <cosmic::theme::Theme as button::StyleSheet>::pressed(
let mut appearance = <cosmic::theme::Theme as button::Catalog>::pressed(
theme,
focused,
selected,

View file

@ -16,7 +16,7 @@ use cosmic::cosmic_theme::{
LIGHT_THEME_BUILDER_ID,
};
use cosmic::iced_core::{alignment, Color, Length};
use cosmic::iced_widget::scrollable;
use cosmic::iced_widget::scrollable::{Direction, Scrollbar};
use cosmic::widget::icon::{from_name, icon};
use cosmic::widget::{
button, color_picker::ColorPickerUpdate, container, flex_row, horizontal_space, radio, row,
@ -1407,11 +1407,11 @@ impl page::Page<crate::pages::Message> for Page {
_: page::Entity,
_sender: tokio::sync::mpsc::Sender<crate::pages::Message>,
) -> Task<crate::pages::Message> {
task::batch(vec![
cosmic::command::batch(vec![
// Load icon themes
task::future(icon_themes::fetch()).map(crate::pages::Message::Appearance),
cosmic::command::future(icon_themes::fetch()).map(crate::pages::Message::Appearance),
// Load font families
task::future(async move {
cosmic::command::future(async move {
let (mono, interface) = font_config::load_font_families();
Message::FontConfig(font_config::Message::LoadedFonts(mono, interface))
})
@ -1690,7 +1690,7 @@ pub fn mode_and_colors() -> Section<crate::pages::Message> {
.padding([0, 0, 16, 0])
.spacing(16)
)
.direction(scrollable::Direction::Horizontal(Scrollbar::new()))
.direction(Direction::Horizontal(Scrollbar::new()))
]
.padding([16, space_s, 0, space_s])
.spacing(space_xxs),

View file

@ -13,9 +13,7 @@ use crate::{
app,
pages::{
self,
desktop::panel::applets_inner::{
self, lists, AppletsPage, ContextDrawer,
},
desktop::panel::applets_inner::{self, lists, AppletsPage, ContextDrawer},
},
};

View file

@ -12,14 +12,9 @@ use cosmic_settings_page as page;
#[derive(Debug)]
#[allow(clippy::struct_excessive_bools)]
#[derive(Default)]
pub struct Page {}
impl Default for Page {
fn default() -> Self {
Self {}
}
}
impl page::Page<crate::pages::Message> for Page {
fn info(&self) -> page::Info {
page::Info::new("desktop", "video-display-symbolic").title(fl!("desktop"))

View file

@ -242,23 +242,15 @@ pub fn window_controls() -> Section<crate::pages::Message> {
.title(&section.title)
.add(settings::item(
&descriptions[active_window_hint],
toggler(None, page.show_active_hint, Message::ShowActiveWindowHint),
toggler(page.show_active_hint).on_toggle(Message::ShowActiveWindowHint),
))
.add(settings::item(
&descriptions[maximize],
toggler(
None,
cosmic::config::show_maximize(),
Message::ShowMaximizeButton,
),
toggler(cosmic::config::show_maximize()).on_toggle(Message::ShowMaximizeButton),
))
.add(settings::item(
&descriptions[minimize],
toggler(
None,
cosmic::config::show_minimize(),
Message::ShowMinimizeButton,
),
toggler(cosmic::config::show_minimize()).on_toggle(Message::ShowMinimizeButton),
))
.apply(Element::from)
.map(crate::pages::Message::WindowManagement)

View file

@ -508,12 +508,10 @@ impl Page {
.on_input(Message::InputSourceSearch)
.on_clear(Message::InputSourceSearch(String::new()));
let toggler = settings::item::builder(fl!("show-extended-input-sources"))
.toggler(
self.show_extended_input_sources,
Message::SetShowExtendedInputSources,
)
.label(fl!("show-extended-input-sources"));
let toggler = settings::item::builder(fl!("show-extended-input-sources")).toggler(
self.show_extended_input_sources,
Message::SetShowExtendedInputSources,
);
let mut list = widget::list_column();

View file

@ -147,7 +147,7 @@ pub fn page_list_item<'a, Message: 'static + Clone>(
row::with_capacity(2)
.push(text::body(info))
.push(container(icon::from_name("go-next-symbolic").size(20)).padding(8))
.align_items(alignment::Alignment::Center),
.align_y(alignment::Alignment::Center),
)
.padding(0)
.spacing(space_xxs)
@ -206,19 +206,19 @@ pub fn go_next_with_item<'a, Msg: Clone + 'static>(
msg: Msg,
) -> cosmic::Element<'_, Msg> {
settings::item_row(vec![
text::body(description).wrap(Wrap::Word).into(),
horizontal_space(Length::Fill).into(),
text::body(description).wrapping(Wrapping::Word).into(),
horizontal_space().width(Length::Fill).into(),
widget::row::with_capacity(2)
.push(item)
.push(icon::from_name("go-next-symbolic").size(16).icon())
.align_items(alignment::Alignment::Center)
.align_y(alignment::Alignment::Center)
.spacing(cosmic::theme::active().cosmic().spacing.space_s)
.into(),
])
.apply(widget::container)
.style(cosmic::theme::Container::List)
.class(cosmic::theme::Container::List)
.apply(button::custom)
.style(theme::Button::Transparent)
.class(theme::Button::Transparent)
.on_press(msg)
.into()
}