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]]
name = "cosmic-panel-config"
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 = [
"anyhow",
"ron",
@ -1531,7 +1531,7 @@ checksum = "db6d7e329c562c5dfab7a46a2afabc8b987ab9a4834c9d1ca04dc54c1546cef8"
[[package]]
name = "libcosmic"
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 = [
"apply",
"cosmic-panel-config",

View file

@ -7,9 +7,8 @@ edition = "2021"
[dependencies]
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 }
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" }

View file

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