refactor: allow for transparent header

This commit is contained in:
Ashley Wulber 2026-06-19 00:48:09 -04:00 committed by Ashley Wulber
parent 9855d8b6fd
commit 46b25d4218
2 changed files with 9 additions and 2 deletions

View file

@ -22,7 +22,7 @@ use crate::prelude::*;
use crate::theme::THEME;
use crate::widget::{container, id_container, menu, nav_bar, popover, space};
use apply::Apply;
use iced::{Length, Subscription, theme, window};
use iced::{Color, Length, Subscription, theme, window};
pub use settings::Settings;
use std::borrow::Cow;
use std::cell::RefCell;
@ -625,6 +625,7 @@ impl<App: Application> 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()
@ -833,7 +834,11 @@ impl<App: Application> ApplicationExt for App {
let cosmic = theme.cosmic();
container::Style {
background: Some(iced::Background::Color(
cosmic.background(theme.transparent).base.into(),
if transparent_header {
Color::TRANSPARENT
} else {
cosmic.background(theme.transparent).base.into()
},
)),
border: iced::Border {
radius: [

View file

@ -39,6 +39,7 @@ pub struct Window {
pub show_close: bool,
pub show_maximize: bool,
pub show_minimize: bool,
pub transparent_header: bool,
pub is_maximized: bool,
height: f32,
width: f32,
@ -169,6 +170,7 @@ impl Default for Core {
show_minimize: true,
show_window_menu: false,
is_maximized: false,
transparent_header: false,
height: 0.,
width: 0.,
},