feat: update iced with fix and refactor applet env vars

This commit is contained in:
Ashley Wulber 2023-05-25 18:47:14 -04:00
parent 2fafeca71f
commit 71395b0c75
No known key found for this signature in database
GPG key ID: 5216D4F46A90A820
3 changed files with 16 additions and 7 deletions

View file

@ -15,7 +15,7 @@ wayland = ["iced/wayland", "iced_sctk", "sctk",]
wgpu = ["iced/wgpu", "iced_wgpu"] wgpu = ["iced/wgpu", "iced_wgpu"]
tokio = ["dep:tokio", "iced/tokio"] tokio = ["dep:tokio", "iced/tokio"]
winit = ["iced/winit", "iced_winit"] winit = ["iced/winit", "iced_winit"]
applet = ["cosmic-panel-config", "wayland"] applet = ["cosmic-panel-config", "wayland", "ron", "serde"]
winit_tiny_skia = ["winit", "tiny_skia"] winit_tiny_skia = ["winit", "tiny_skia"]
winit_wgpu = ["winit", "wgpu"] winit_wgpu = ["winit", "wgpu"]
@ -25,11 +25,13 @@ derive_setters = "0.1.5"
lazy_static = "1.4.0" lazy_static = "1.4.0"
palette = "0.6.1" palette = "0.6.1"
tokio = { version = "1.24.2", optional = true } tokio = { version = "1.24.2", optional = true }
cosmic-panel-config = {git = "https://github.com/pop-os/cosmic-panel", optional = true } cosmic-panel-config = {git = "https://github.com/pop-os/cosmic-panel", branch = "bg_jammy", optional = true }
sctk = { package = "smithay-client-toolkit", git = "https://github.com/pop-os/client-toolkit", optional = true, tag = "themed-pointer"} sctk = { package = "smithay-client-toolkit", git = "https://github.com/pop-os/client-toolkit", optional = true, tag = "themed-pointer"}
slotmap = "1.0.6" slotmap = "1.0.6"
fraction = "0.13.0" fraction = "0.13.0"
cosmic-config = { path = "cosmic-config" } cosmic-config = { path = "cosmic-config" }
ron = { version = "0.8", optional = true }
serde = { version = "1.0", optional = true }
[target.'cfg(unix)'.dependencies] [target.'cfg(unix)'.dependencies]
freedesktop-icons = "0.2.2" freedesktop-icons = "0.2.2"

2
iced

@ -1 +1 @@
Subproject commit 2aee37387f6ada651f6517c79f6cb3f408d5fabc Subproject commit d29dd8d7855c568a528e67ee43dad29654053cac

View file

@ -1,4 +1,4 @@
use cosmic_panel_config::{PanelAnchor, PanelSize}; use cosmic_panel_config::{CosmicPanelBackground, PanelAnchor, PanelSize};
use iced::{ use iced::{
alignment::{Horizontal, Vertical}, alignment::{Horizontal, Vertical},
wayland::InitialSurface, wayland::InitialSurface,
@ -37,6 +37,8 @@ pub fn applet_button_theme() -> Button {
pub struct CosmicAppletHelper { pub struct CosmicAppletHelper {
pub size: Size, pub size: Size,
pub anchor: PanelAnchor, pub anchor: PanelAnchor,
pub background: CosmicPanelBackground,
pub output_name: String,
} }
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
@ -52,13 +54,18 @@ impl Default for CosmicAppletHelper {
size: Size::PanelSize( size: Size::PanelSize(
std::env::var("COSMIC_PANEL_SIZE") std::env::var("COSMIC_PANEL_SIZE")
.ok() .ok()
.and_then(|size| size.parse::<PanelSize>().ok()) .and_then(|size| ron::from_str(size.as_str()).ok())
.unwrap_or(PanelSize::S), .unwrap_or(PanelSize::S),
), ),
anchor: std::env::var("COSMIC_PANEL_ANCHOR") anchor: std::env::var("COSMIC_PANEL_ANCHOR")
.ok() .ok()
.and_then(|size| size.parse::<PanelAnchor>().ok()) .and_then(|size| ron::from_str(size.as_str()).ok())
.unwrap_or(PanelAnchor::Top), .unwrap_or(PanelAnchor::Top),
background: std::env::var("COSMIC_PANEL_BACKGROUND")
.ok()
.and_then(|size| ron::from_str(size.as_str()).ok())
.unwrap_or(CosmicPanelBackground::ThemeDefault),
output_name: std::env::var("COSMIC_PANEL_OUTPUT").unwrap_or_default(),
} }
} }
} }
@ -102,7 +109,7 @@ impl CosmicAppletHelper {
.max_height(height as f32 + APPLET_PADDING as f32 * 2.0) .max_height(height as f32 + APPLET_PADDING as f32 * 2.0)
.min_width(width as f32 + APPLET_PADDING as f32 * 2.0) .min_width(width as f32 + APPLET_PADDING as f32 * 2.0)
.max_width(width as f32 + APPLET_PADDING as f32 * 2.0), .max_width(width as f32 + APPLET_PADDING as f32 * 2.0),
resizable: None,
..Default::default() ..Default::default()
}), }),
..crate::settings_with_flags(flags) ..crate::settings_with_flags(flags)