feat(icon): optimize & bundle icons with crabtime for non-unix platforms

This commit is contained in:
Michael Aaron Murphy 2025-11-11 23:02:57 +01:00 committed by Michael Murphy
parent ce0868582b
commit 639326fcc3
27 changed files with 128 additions and 189 deletions

View file

@ -449,25 +449,12 @@ impl<'a, Message: Clone + 'static> HeaderBar<'a, Message> {
fn window_controls(&mut self) -> Element<'a, Message> {
macro_rules! icon {
($name:expr, $size:expr, $on_press:expr) => {{
#[cfg(target_os = "linux")]
let icon = {
widget::icon::from_name($name)
.apply(widget::button::icon)
.padding(8)
};
#[cfg(not(target_os = "linux"))]
let icon = {
widget::icon::from_svg_bytes(include_bytes!(concat!(
"../../res/icons/",
$name,
".svg"
)))
.symbolic(true)
.apply(widget::button::icon)
.padding(8)
};
icon.class(crate::theme::Button::HeaderBar)
.selected(self.focused)
.icon_size($size)