From 9691870f7266543a2bf7308f11aeb325a44f12f2 Mon Sep 17 00:00:00 2001 From: Ashley Wulber Date: Mon, 6 Jul 2026 14:38:59 -0400 Subject: [PATCH] refactor: option for customizing the border padding, instead of disabling the content container --- src/app/mod.rs | 20 +++++++++----------- src/core.rs | 4 ++-- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/app/mod.rs b/src/app/mod.rs index f757d5be..5ead69fe 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -625,21 +625,23 @@ impl ApplicationExt for App { let content_container = core.window.content_container; let show_context = core.window.show_context; let nav_bar_active = core.nav_bar_active(); - let transparent_header = core.window.transparent_header; let focused = core .focus_chain() .iter() - .any(|i| Some(*i) == self.core().main_window_id()); + .any(|i| Some(*i) == core.main_window_id()); - let border_padding = if maximized { 8 } else { 7 }; + let border_padding = core + .window + .border_padding + .unwrap_or(if maximized { 8 } else { 7 }); - let main_content_padding = if !content_container { - [0, 0, 0, 0] - } else { + let main_content_padding = if content_container { let right_padding = if show_context { 0 } else { border_padding }; let left_padding = if nav_bar_active { 0 } else { border_padding }; [0, right_padding, 0, left_padding] + } else { + [0, 0, 0, 0] }; let content_row = crate::widget::row::with_children({ @@ -834,11 +836,7 @@ impl ApplicationExt for App { let cosmic = theme.cosmic(); container::Style { background: Some(iced::Background::Color( - if transparent_header { - Color::TRANSPARENT - } else { - cosmic.background(theme.transparent).base.into() - }, + cosmic.background(theme.transparent).base.into(), )), border: iced::Border { radius: [ diff --git a/src/core.rs b/src/core.rs index 0ca555e3..b2bf8693 100644 --- a/src/core.rs +++ b/src/core.rs @@ -39,8 +39,8 @@ pub struct Window { pub show_close: bool, pub show_maximize: bool, pub show_minimize: bool, - pub transparent_header: bool, pub is_maximized: bool, + pub border_padding: Option, height: f32, width: f32, } @@ -170,9 +170,9 @@ impl Default for Core { show_minimize: true, show_window_menu: false, is_maximized: false, - transparent_header: false, height: 0., width: 0., + border_padding: None, }, focused_window: Vec::new(), #[cfg(feature = "applet")]