From 9552916a590b18ec810ee3bf6ce0f2f8666d2bc2 Mon Sep 17 00:00:00 2001 From: Michael Aaron Murphy Date: Wed, 13 Sep 2023 15:26:51 +0200 Subject: [PATCH] feat(app): set header title seperately from window title This change will enable applications to set different titles for each --- src/app/core.rs | 3 +++ src/app/mod.rs | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/app/core.rs b/src/app/core.rs index 8fa41639..bf779add 100644 --- a/src/app/core.rs +++ b/src/app/core.rs @@ -13,6 +13,8 @@ pub struct NavBar { #[allow(clippy::struct_excessive_bools)] #[derive(Clone)] pub struct Window { + /// Label to as title in headerbar. + pub header_title: String, pub use_template: bool, pub can_fullscreen: bool, pub sharp_corners: bool, @@ -58,6 +60,7 @@ impl Default for Core { scale_factor: 1.0, title: String::new(), window: Window { + header_title: String::new(), use_template: true, can_fullscreen: false, sharp_corners: false, diff --git a/src/app/mod.rs b/src/app/mod.rs index 603de483..f046b632 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -269,7 +269,7 @@ impl ApplicationExt for App { .push_maybe(if core.window.show_headerbar { Some({ let mut header = crate::widget::header_bar() - .title(self.title()) + .title(&core.window.header_title) .on_drag(Message::Cosmic(cosmic::Message::Drag)) .on_close(Message::Cosmic(cosmic::Message::Close));