From ff8e688121bfc88e0cc9c6e04cd4330ea8032af8 Mon Sep 17 00:00:00 2001 From: Ashley Wulber Date: Wed, 11 Oct 2023 14:05:56 -0400 Subject: [PATCH] fix: checkmark icons --- cosmic-applet-battery/src/app.rs | 38 +++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/cosmic-applet-battery/src/app.rs b/cosmic-applet-battery/src/app.rs index 1bb83ede..9d1ddad1 100644 --- a/cosmic-applet-battery/src/app.rs +++ b/cosmic-applet-battery/src/app.rs @@ -18,7 +18,7 @@ use cosmic::iced::{ }; use cosmic::iced_runtime::core::layout::Limits; use cosmic::iced_style::application; -use cosmic::widget::{button, divider, icon}; +use cosmic::widget::{button, divider, horizontal_space, icon}; use cosmic::{applet::button_theme, Command}; use cosmic::{Element, Theme}; use cosmic_time::{anim, chain, id, once_cell::sync::Lazy, Instant, Timeline}; @@ -333,9 +333,15 @@ impl cosmic::Application for CosmicBatteryApplet { text(fl!("battery-desc")).size(10) ] .width(Length::Fill), - icon::from_name("emblem-ok-symbolic") - .size(12) - .symbolic(matches!(self.power_profile, Power::Battery)), + if matches!(self.power_profile, Power::Battery) { + container( + icon::from_name("emblem-ok-symbolic") + .size(12) + .symbolic(true), + ) + } else { + container(horizontal_space(1.0)) + } ] .align_items(Alignment::Center) ) @@ -350,9 +356,15 @@ impl cosmic::Application for CosmicBatteryApplet { text(fl!("balanced-desc")).size(10) ] .width(Length::Fill), - icon::from_name("emblem-ok-symbolic") - .size(12) - .symbolic(matches!(self.power_profile, Power::Balanced)), + if matches!(self.power_profile, Power::Balanced) { + container( + icon::from_name("emblem-ok-symbolic") + .size(12) + .symbolic(true), + ) + } else { + container(horizontal_space(1.0)) + } ] .align_items(Alignment::Center) ) @@ -367,9 +379,15 @@ impl cosmic::Application for CosmicBatteryApplet { text(fl!("performance-desc")).size(10) ] .width(Length::Fill), - icon::from_name("emblem-ok-symbolic") - .size(12) - .symbolic(matches!(self.power_profile, Power::Performance)), + if matches!(self.power_profile, Power::Performance) { + container( + icon::from_name("emblem-ok-symbolic") + .size(12) + .symbolic(true), + ) + } else { + container(horizontal_space(1.0)) + } ] .align_items(Alignment::Center) )