diff --git a/src/app/mod.rs b/src/app/mod.rs index 391e2f22..b8d7a70d 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -676,8 +676,7 @@ impl ApplicationExt for App { let is_condensed = core.is_condensed(); let focused = core .focused_window() - .map(|i| i == self.main_window_id()) - .unwrap_or_default(); + .is_some_and(|i| i == self.main_window_id()); let content_row = crate::widget::row::with_children({ let mut widgets = Vec::with_capacity(2); @@ -731,11 +730,13 @@ impl ApplicationExt for App { if self.nav_model().is_some() { let toggle = crate::widget::nav_bar_toggle() .active(core.nav_bar_active()) + .selected(focused) .on_toggle(if is_condensed { Message::Cosmic(cosmic::Message::ToggleNavBarCondensed) } else { Message::Cosmic(cosmic::Message::ToggleNavBar) - }); + }) + .style(crate::theme::Button::HeaderBar); header = header.start(toggle); } diff --git a/src/theme/style/button.rs b/src/theme/style/button.rs index 110e25f5..e1898eee 100644 --- a/src/theme/style/button.rs +++ b/src/theme/style/button.rs @@ -75,7 +75,9 @@ pub fn appearance( corner_radii = &cosmic.corner_radii.radius_m; } - let (background, _text, _icon) = color(&cosmic.icon_button); + let (background, text, icon) = color(&cosmic.icon_button); + appearance.text_color = text; + appearance.icon_color = icon; appearance.background = Some(Background::Color(background)); } @@ -161,8 +163,8 @@ impl StyleSheet for crate::Theme { { Some(self.cosmic().accent_color().into()) } else if matches!(style, Button::HeaderBar) && !selected { - let mut c = Color::from(component.on); - c.a = 0.8; + let mut c = Color::from(self.cosmic().background.on); + c.a = 0.75; Some(c) } else { Some(component.on.into()) diff --git a/src/widget/nav_bar_toggle.rs b/src/widget/nav_bar_toggle.rs index 64e991f0..cd1ec67f 100644 --- a/src/widget/nav_bar_toggle.rs +++ b/src/widget/nav_bar_toggle.rs @@ -13,6 +13,8 @@ pub struct NavBarToggle { active: bool, #[setters(strip_option)] on_toggle: Option, + style: crate::theme::Button, + selected: bool, } #[must_use] @@ -20,6 +22,8 @@ pub fn nav_bar_toggle() -> NavBarToggle { NavBarToggle { active: false, on_toggle: None, + style: crate::theme::Button::Text, + selected: false, } } @@ -37,10 +41,11 @@ impl<'a, Message: 'static + Clone> From> for Element<'a, M .symbolic(true) }; - widget::button::text("") - .leading_icon(icon) + widget::button::icon(icon) .padding([8, 16, 8, 16]) .on_press_maybe(nav_bar_toggle.on_toggle) + .selected(nav_bar_toggle.selected) + .style(nav_bar_toggle.style) .apply(widget::container) .center_y() .height(Length::Fill)