update to use latest libcosmic

This commit is contained in:
Ashley Wulber 2022-12-07 12:13:44 -05:00
parent f2d3dbec5c
commit 092fc40426
No known key found for this signature in database
GPG key ID: 5216D4F46A90A820
3 changed files with 12 additions and 17 deletions

View file

@ -450,7 +450,7 @@ dependencies = [
[[package]] [[package]]
name = "cosmic-panel-config" name = "cosmic-panel-config"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/pop-os/cosmic-panel#a452fc323b574c28aef832951edd413a1d87bc3d" source = "git+https://github.com/pop-os/cosmic-panel#35d61a3a617b2ef552931645ec35c545a3a688f6"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"ron", "ron",
@ -1531,7 +1531,7 @@ checksum = "db6d7e329c562c5dfab7a46a2afabc8b987ab9a4834c9d1ca04dc54c1546cef8"
[[package]] [[package]]
name = "libcosmic" name = "libcosmic"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/pop-os/libcosmic/?branch=sctk-cosmic-design-system#0f857b18ea0987a192b99a2dc34d29b9e41e5bf8" source = "git+https://github.com/pop-os/libcosmic/?branch=fix/applets#9d75dc8830f7ed8a21af790e2b11c93b90629b1f"
dependencies = [ dependencies = [
"apply", "apply",
"cosmic-panel-config", "cosmic-panel-config",

View file

@ -7,9 +7,8 @@ edition = "2021"
[dependencies] [dependencies]
zbus = "3.4" zbus = "3.4"
libcosmic = { git = "https://github.com/pop-os/libcosmic/", branch = "sctk-cosmic-design-system", default-features = false, features = ["wayland", "applet"] } libcosmic = { git = "https://github.com/pop-os/libcosmic/", branch = "fix/applets", default-features = false, features = ["wayland", "applet"] }
cosmic-panel-config = {git = "https://github.com/pop-os/cosmic-panel", default-features = false } cosmic-panel-config = {git = "https://github.com/pop-os/cosmic-panel", default-features = false }
iced_sctk = { git = "https://github.com/pop-os/iced-sctk" } iced_sctk = { git = "https://github.com/pop-os/iced-sctk" }
# iced_sctk = { path = "../../../fork/iced-sctk" }
sctk = { package = "smithay-client-toolkit", git = "https://github.com/Smithay/client-toolkit" } sctk = { package = "smithay-client-toolkit", git = "https://github.com/Smithay/client-toolkit" }

View file

@ -1,15 +1,14 @@
use crate::dbus::{self, PowerDaemonProxy}; use crate::dbus::{self, PowerDaemonProxy};
use crate::graphics::{get_current_graphics, set_graphics, Graphics}; use crate::graphics::{get_current_graphics, set_graphics, Graphics};
use cosmic::applet::{get_popup_settings, icon_button, popup_container}; use cosmic::applet::{CosmicAppletHelper};
use cosmic::iced_style::application::{self, Appearance}; use cosmic::iced_style::application::{self, Appearance};
use cosmic::iced_style::svg; use cosmic::theme::Button;
use cosmic::separator;
use cosmic::theme::{Button, Svg};
use cosmic::{ use cosmic::{
iced::widget::{column, radio, text}, iced::widget::{column, radio, text},
iced::{self, Application, Command, Length}, iced::{self, Application, Command, Length},
iced_native::window, iced_native::window,
theme::{self, Theme}, theme::Theme,
widget::{horizontal_rule},
Element, Element,
}; };
use cosmic_panel_config::{PanelAnchor, PanelSize}; use cosmic_panel_config::{PanelAnchor, PanelSize};
@ -56,6 +55,7 @@ pub struct Window {
theme: Theme, theme: Theme,
dbus: Option<(Connection, PowerDaemonProxy<'static>)>, dbus: Option<(Connection, PowerDaemonProxy<'static>)>,
state: State, state: State,
applet_helper: CosmicAppletHelper,
} }
#[allow(dead_code)] #[allow(dead_code)]
@ -141,7 +141,7 @@ impl Application for Window {
)); ));
} }
let popup_settings = let popup_settings =
get_popup_settings(window::Id::new(0), new_id, (200, 240), None, None); self.applet_helper.get_popup_settings(window::Id::new(0), new_id, (200, 240), None, None);
commands.push(get_popup(popup_settings)); commands.push(get_popup(popup_settings));
return Command::batch(commands); return Command::batch(commands);
} }
@ -183,11 +183,7 @@ impl Application for Window {
fn view(&self, id: SurfaceIdWrapper) -> Element<Message> { fn view(&self, id: SurfaceIdWrapper) -> Element<Message> {
match id { match id {
SurfaceIdWrapper::LayerSurface(_) => unimplemented!(), SurfaceIdWrapper::LayerSurface(_) => unimplemented!(),
SurfaceIdWrapper::Window(_) => icon_button("input-gaming-symbolic", Svg::Custom(|theme| { SurfaceIdWrapper::Window(_) => self.applet_helper.icon_button("input-gaming-symbolic")
svg::Appearance {
fill: Some(theme.palette().text),
}
}))
.on_press(Message::TogglePopup) .on_press(Message::TogglePopup)
.style(Button::Text) .style(Button::Text)
.into(), .into(),
@ -252,14 +248,14 @@ impl Application for Window {
.into() .into()
} }
}; };
popup_container( self.applet_helper.popup_container(
column(vec![ column(vec![
text("Graphics Mode") text("Graphics Mode")
.width(Length::Fill) .width(Length::Fill)
.horizontal_alignment(Horizontal::Center) .horizontal_alignment(Horizontal::Center)
.size(24) .size(24)
.into(), .into(),
separator!(1).into(), horizontal_rule(1).into(),
content, content,
]) ])
.padding(4) .padding(4)