chore(applet): add spacing field

This commit is contained in:
Vukašin Vojinović 2025-06-20 01:54:56 +02:00 committed by Ashley Wulber
parent ec7a531539
commit 38dde24f96

View file

@ -21,7 +21,7 @@ use crate::{
}; };
pub use cosmic_panel_config; pub use cosmic_panel_config;
use cosmic_panel_config::{CosmicPanelBackground, PanelAnchor, PanelSize}; use cosmic_panel_config::{CosmicPanelBackground, PanelAnchor, PanelSize};
use iced_core::{Layout, Padding, Shadow}; use iced_core::{Padding, Shadow};
use iced_widget::runtime::platform_specific::wayland::popup::{SctkPopupSettings, SctkPositioner}; use iced_widget::runtime::platform_specific::wayland::popup::{SctkPopupSettings, SctkPositioner};
use sctk::reexports::protocols::xdg::shell::client::xdg_positioner::{Anchor, Gravity}; use sctk::reexports::protocols::xdg::shell::client::xdg_positioner::{Anchor, Gravity};
use std::{borrow::Cow, num::NonZeroU32, rc::Rc, sync::LazyLock, time::Duration}; use std::{borrow::Cow, num::NonZeroU32, rc::Rc, sync::LazyLock, time::Duration};
@ -39,6 +39,7 @@ static TOOLTIP_WINDOW_ID: LazyLock<window::Id> = LazyLock::new(window::Id::uniqu
pub struct Context { pub struct Context {
pub size: Size, pub size: Size,
pub anchor: PanelAnchor, pub anchor: PanelAnchor,
pub spacing: u32,
pub background: CosmicPanelBackground, pub background: CosmicPanelBackground,
pub output_name: String, pub output_name: String,
pub panel_type: PanelType, pub panel_type: PanelType,
@ -93,6 +94,10 @@ impl Default for Context {
.ok() .ok()
.and_then(|size| ron::from_str(size.as_str()).ok()) .and_then(|size| ron::from_str(size.as_str()).ok())
.unwrap_or(PanelAnchor::Top), .unwrap_or(PanelAnchor::Top),
spacing: std::env::var("COSMIC_PANEL_SPACING")
.ok()
.and_then(|size| ron::from_str(size.as_str()).ok())
.unwrap_or(4),
background: std::env::var("COSMIC_PANEL_BACKGROUND") background: std::env::var("COSMIC_PANEL_BACKGROUND")
.ok() .ok()
.and_then(|size| ron::from_str(size.as_str()).ok()) .and_then(|size| ron::from_str(size.as_str()).ok())