Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
wash2 committed Oct 23, 2024
1 parent 7808b68 commit 485b736
Show file tree
Hide file tree
Showing 12 changed files with 738 additions and 739 deletions.
1,357 changes: 687 additions & 670 deletions Cargo.lock

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
10 changes: 5 additions & 5 deletions cosmic-settings/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>(),
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -517,7 +517,7 @@ impl cosmic::Application for SettingsApp {
.map(Into::into),
);
}
return Command::batch(commands);
return Task::batch(commands);
}

Message::OutputRemoved(output) => {
Expand All @@ -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") => {
Expand Down Expand Up @@ -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))
}
}
Expand Down
8 changes: 4 additions & 4 deletions cosmic-settings/src/pages/bluetooth/subscription.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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?;
}
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
27 changes: 14 additions & 13 deletions cosmic-settings/src/pages/desktop/appearance/font_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand All @@ -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())),
)
});
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -203,7 +204,7 @@ impl Model {
}
}

Command::none()
Task::none()
}
}

Expand Down
15 changes: 7 additions & 8 deletions cosmic-settings/src/pages/desktop/appearance/icon_themes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down Expand Up @@ -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(),
Expand All @@ -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(),
Expand All @@ -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,
Expand All @@ -78,15 +77,15 @@ 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,
);
appearance.background = Some(background);
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,
Expand All @@ -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,
Expand Down
10 changes: 5 additions & 5 deletions cosmic-settings/src/pages/desktop/appearance/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -1393,11 +1393,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))
})
Expand Down Expand Up @@ -1676,7 +1676,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),
Expand Down
4 changes: 1 addition & 3 deletions cosmic-settings/src/pages/desktop/dock/applets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
},
};

Expand Down
7 changes: 1 addition & 6 deletions cosmic-settings/src/pages/desktop/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
14 changes: 3 additions & 11 deletions cosmic-settings/src/pages/desktop/window_management.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 4 additions & 6 deletions cosmic-settings/src/pages/input/keyboard/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
12 changes: 6 additions & 6 deletions cosmic-settings/src/widget/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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()
}

0 comments on commit 485b736

Please sign in to comment.