chore: update libcosmic

This commit is contained in:
Ashley Wulber 2024-02-02 16:16:32 -05:00 • committed by Ashley Wulber
parent c71420ccf9
commit 0ab6f724fb
9 changed files with 613 additions and 575 deletions

842
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -44,10 +44,13 @@ tracing-log = "0.2.0"
lto = "thin" lto = "thin"
# lto = "fat" # lto = "fat"
# [patch."https://github.com/pop-os/cosmic-time"] [patch."https://github.com/pop-os/cosmic-time"]
cosmic-time = { git = "https://github.com/pop-os/cosmic-time//", branch = "wip-iced-update" }
# cosmic-time = { path = "../cosmic-time" } # cosmic-time = { path = "../cosmic-time" }
# [patch."https://github.com/pop-os/libcosmic"] [patch."https://github.com/pop-os/libcosmic"]
# libcosmic = { git = "https://github.com/pop-os/libcosmic//", branch = "refactor-config-watch" } libcosmic = { git = "https://github.com/pop-os/libcosmic//", branch = "update-iced-latest" }
# cosmic-config = { git = "https://github.com/pop-os/libcosmic//", branch = "refactor-config-watch" } cosmic-config = { git = "https://github.com/pop-os/libcosmic//", branch = "update-iced-latest" }
# libcosmic = { path = "../libcosmic"}
# cosmic-config = { path = "../libcosmic/cosmic-config"}
[patch."https://github.com/Smithay/client-toolkit"] [patch."https://github.com/Smithay/client-toolkit"]
sctk = { git = "https://github.com/smithay/client-toolkit//", package = "smithay-client-toolkit", rev = "e63ab5f" } sctk = { git = "https://github.com/smithay/client-toolkit//", package = "smithay-client-toolkit", rev = "e63ab5f" }

View file

@ -25,7 +25,10 @@ use cosmic::iced::widget::vertical_space;
use cosmic::iced::widget::{column, dnd_source, mouse_area, row, Column, Row}; use cosmic::iced::widget::{column, dnd_source, mouse_area, row, Column, Row};
use cosmic::iced::Color; use cosmic::iced::Color;
use cosmic::iced::{window, Subscription}; use cosmic::iced::{window, Subscription};
use cosmic::iced_core::window::Icon;
use cosmic::iced_core::Border;
use cosmic::iced_core::Padding; use cosmic::iced_core::Padding;
use cosmic::iced_core::Shadow;
use cosmic::iced_runtime::core::alignment::Horizontal; use cosmic::iced_runtime::core::alignment::Horizontal;
use cosmic::iced_runtime::core::event; use cosmic::iced_runtime::core::event;
use cosmic::iced_sctk::commands::data_device::accept_mime_type; use cosmic::iced_sctk::commands::data_device::accept_mime_type;
@ -132,9 +135,12 @@ impl DockItem {
background: Some(Background::Color( background: Some(Background::Color(
theme.cosmic().on_bg_color().into(), theme.cosmic().on_bg_color().into(),
)), )),
border_radius: 4.0.into(), border: Border {
border_width: 0.0, radius: 4.0.into(),
border_color: Color::TRANSPARENT, width: 0.0,
color: Color::TRANSPARENT,
},
shadow: Shadow::default(),
icon_color: Some(Color::TRANSPARENT), icon_color: Some(Color::TRANSPARENT),
}, },
))) )))

View file

@ -778,7 +778,7 @@ fn revealer(
options: Vec<(String, String)>, options: Vec<(String, String)>,
toggle: Message, toggle: Message,
mut change: impl FnMut(String) -> Message + 'static, mut change: impl FnMut(String) -> Message + 'static,
) -> widget::Column<'static, Message, Renderer> { ) -> widget::Column<'static, Message, crate::Theme, Renderer> {
if open { if open {
options.iter().fold( options.iter().fold(
column![revealer_head(open, title, selected, toggle)].width(Length::Fill), column![revealer_head(open, title, selected, toggle)].width(Length::Fill),

View file

@ -353,7 +353,7 @@ impl cosmic::Application for Window {
fn button_icon<'a>( fn button_icon<'a>(
cur_mode: Option<GraphicsMode>, cur_mode: Option<GraphicsMode>,
button_mode: Graphics, button_mode: Graphics,
) -> Container<'a, Message, cosmic::Renderer> { ) -> Container<'a, Message, cosmic::Theme, cosmic::Renderer> {
match cur_mode { match cur_mode {
Some(GraphicsMode::Selected { prev: _, new }) if new == button_mode => { Some(GraphicsMode::Selected { prev: _, new }) if new == button_mode => {
cosmic::widget::container( cosmic::widget::container(

View file

@ -10,6 +10,7 @@ use cosmic::iced::event::{listen_with, PlatformSpecific};
use cosmic::iced::time; use cosmic::iced::time;
use cosmic::iced::wayland::actions::layer_surface::SctkLayerSurfaceSettings; use cosmic::iced::wayland::actions::layer_surface::SctkLayerSurfaceSettings;
use cosmic::iced::wayland::popup::{destroy_popup, get_popup}; use cosmic::iced::wayland::popup::{destroy_popup, get_popup};
use cosmic::iced_core::{Border, Shadow};
use cosmic::iced_runtime::core::layout::Limits; use cosmic::iced_runtime::core::layout::Limits;
use cosmic::iced_sctk::commands::layer_surface::{ use cosmic::iced_sctk::commands::layer_surface::{
destroy_layer_surface, get_layer_surface, Anchor, KeyboardInteractivity, destroy_layer_surface, get_layer_surface, Anchor, KeyboardInteractivity,
@ -323,9 +324,12 @@ impl cosmic::Application for Power {
background: Some( background: Some(
Color::from(theme.cosmic().background.base).into(), Color::from(theme.cosmic().background.base).into(),
), ),
border_radius: 12.0.into(), border: Border {
border_width: 2.0, radius: 12.0.into(),
border_color: theme.cosmic().bg_divider().into(), width: 2.0,
color: theme.cosmic().bg_divider().into(),
},
shadow: Shadow::default(),
} }
})) }))
.width(Length::Shrink) .width(Length::Shrink)

View file

@ -8,7 +8,7 @@ use cosmic::{
}, },
window, Subscription, window, Subscription,
}, },
iced_style::application, iced_style::{application, menu},
Theme, Theme,
}; };
use std::collections::BTreeMap; use std::collections::BTreeMap;
@ -173,18 +173,13 @@ impl cosmic::Application for App {
fn view(&self) -> cosmic::Element<'_, Msg> { fn view(&self) -> cosmic::Element<'_, Msg> {
// XXX connect open event // XXX connect open event
iced::widget::row( iced::widget::row(self.menus.iter().map(|(id, menu)| {
self.menus
.iter()
.map(|(id, menu)| {
self.core self.core
.applet .applet
.icon_button(menu.icon_name()) .icon_button(menu.icon_name())
.on_press(Msg::TogglePopup(*id)) .on_press(Msg::TogglePopup(*id))
.into() .into()
}) }))
.collect(),
)
.into() .into()
} }

View file

@ -79,11 +79,7 @@ impl State {
} }
fn layout_view(layout: &Layout, expanded: Option<i32>) -> cosmic::Element<Msg> { fn layout_view(layout: &Layout, expanded: Option<i32>) -> cosmic::Element<Msg> {
iced::widget::column( iced::widget::column(layout.children().iter().filter_map(|i| {
layout
.children()
.iter()
.filter_map(|i| {
if !i.visible() { if !i.visible() {
None None
} else if i.type_() == Some("separator") { } else if i.type_() == Some("separator") {
@ -139,12 +135,10 @@ fn layout_view(layout: &Layout, expanded: Option<i32>) -> cosmic::Element<Msg> {
iced::widget::column![ iced::widget::column![
button, button,
// XXX nested // XXX nested
iced::widget::container(layout_view(i, None)).padding( iced::widget::container(layout_view(i, None)).padding(iced::Padding {
iced::Padding {
left: 12., left: 12.,
..iced::Padding::ZERO ..iced::Padding::ZERO
} })
)
] ]
.into(), .into(),
) )
@ -154,9 +148,7 @@ fn layout_view(layout: &Layout, expanded: Option<i32>) -> cosmic::Element<Msg> {
} else { } else {
None None
} }
}) }))
.collect(),
)
.into() .into()
} }

View file

@ -4,7 +4,7 @@ use cosmic::iced::event;
use cosmic::iced::mouse::{self, ScrollDelta}; use cosmic::iced::mouse::{self, ScrollDelta};
use cosmic::iced::widget::{button, column, container, row, text}; use cosmic::iced::widget::{button, column, container, row, text};
use cosmic::iced::{Event::Mouse, Length, Subscription}; use cosmic::iced::{Event::Mouse, Length, Subscription};
use cosmic::iced_core::Background; use cosmic::iced_core::{Background, Border};
use cosmic::iced_style::application; use cosmic::iced_style::application;
use cosmic::{applet::cosmic_panel_config::PanelAnchor, font::FONT_BOLD, Command}; use cosmic::{applet::cosmic_panel_config::PanelAnchor, font::FONT_BOLD, Command};
use cosmic::{Element, Theme}; use cosmic::{Element, Theme};
@ -121,10 +121,7 @@ impl cosmic::Application for IcedWorkspacesApplet {
if self.workspaces.is_empty() { if self.workspaces.is_empty() {
return row![].padding(8).into(); return row![].padding(8).into();
} }
let buttons = self let buttons = self.workspaces.iter().filter_map(|w| {
.workspaces
.iter()
.filter_map(|w| {
let btn = button( let btn = button(
text(w.0.clone()) text(w.0.clone())
.font(FONT_BOLD) .font(FONT_BOLD)
@ -157,13 +154,20 @@ impl cosmic::Application for IcedWorkspacesApplet {
cosmic::theme::iced::Button::Primary cosmic::theme::iced::Button::Primary
} }
Some(zcosmic_workspace_handle_v1::State::Urgent) => { Some(zcosmic_workspace_handle_v1::State::Urgent) => {
let appearance = |theme: &Theme| button::Appearance { let appearance = |theme: &Theme| {
let cosmic = theme.cosmic();
button::Appearance {
background: Some(Background::Color( background: Some(Background::Color(
theme.cosmic().palette.neutral_3.into(), cosmic.palette.neutral_3.into(),
)), )),
border: Border {
radius: cosmic.radius_xl().into(),
..Default::default()
},
border_radius: theme.cosmic().radius_xl().into(), border_radius: theme.cosmic().radius_xl().into(),
text_color: theme.cosmic().destructive_button.base.into(), text_color: theme.cosmic().destructive_button.base.into(),
..button::Appearance::default() ..button::Appearance::default()
}
}; };
cosmic::theme::iced::Button::Custom { cosmic::theme::iced::Button::Custom {
active: Box::new(appearance), active: Box::new(appearance),
@ -171,16 +175,27 @@ impl cosmic::Application for IcedWorkspacesApplet {
background: Some(Background::Color( background: Some(Background::Color(
theme.current_container().component.hover.into(), theme.current_container().component.hover.into(),
)), )),
border: Border {
radius: theme.cosmic().radius_xl().into(),
..Default::default()
},
..appearance(theme) ..appearance(theme)
}), }),
} }
} }
None => { None => {
let appearance = |theme: &Theme| button::Appearance { let appearance = |theme: &Theme| {
let cosmic = theme.cosmic();
button::Appearance {
background: None, background: None,
border_radius: theme.cosmic().radius_xl().into(), border: Border {
radius: cosmic.radius_xl().into(),
..Default::default()
},
border_radius: cosmic.radius_xl().into(),
text_color: theme.current_container().component.on.into(), text_color: theme.current_container().component.on.into(),
..button::Appearance::default() ..button::Appearance::default()
}
}; };
cosmic::theme::iced::Button::Custom { cosmic::theme::iced::Button::Custom {
active: Box::new(appearance), active: Box::new(appearance),
@ -188,6 +203,10 @@ impl cosmic::Application for IcedWorkspacesApplet {
background: Some(Background::Color( background: Some(Background::Color(
theme.current_container().component.hover.into(), theme.current_container().component.hover.into(),
)), )),
border: Border {
radius: theme.cosmic().radius_xl().into(),
..Default::default()
},
..appearance(theme) ..appearance(theme)
}), }),
} }
@ -196,8 +215,7 @@ impl cosmic::Application for IcedWorkspacesApplet {
}) })
.into(), .into(),
) )
}) });
.collect();
let layout_section: Element<_> = match self.layout { let layout_section: Element<_> = match self.layout {
Layout::Row => row(buttons) Layout::Row => row(buttons)
.width(Length::Shrink) .width(Length::Shrink)