mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-07-16 18:11:14 +02:00
feat(bar): add accents to widget emojis
This commit is contained in:
+174
-169
@@ -59,166 +59,170 @@ impl Komobar {
|
|||||||
} => match catppuccin {
|
} => match catppuccin {
|
||||||
Catppuccin::Frappe => {
|
Catppuccin::Frappe => {
|
||||||
catppuccin_egui::set_theme(ctx, catppuccin_egui::FRAPPE);
|
catppuccin_egui::set_theme(ctx, catppuccin_egui::FRAPPE);
|
||||||
if let Some(catppuccin_value) = catppuccin_value {
|
let catppuccin_value = catppuccin_value.unwrap_or_default();
|
||||||
let accent = match catppuccin_value {
|
|
||||||
CatppuccinValue::Rosewater => catppuccin_egui::FRAPPE.rosewater,
|
let accent = match catppuccin_value {
|
||||||
CatppuccinValue::Flamingo => catppuccin_egui::FRAPPE.flamingo,
|
CatppuccinValue::Rosewater => catppuccin_egui::FRAPPE.rosewater,
|
||||||
CatppuccinValue::Pink => catppuccin_egui::FRAPPE.pink,
|
CatppuccinValue::Flamingo => catppuccin_egui::FRAPPE.flamingo,
|
||||||
CatppuccinValue::Mauve => catppuccin_egui::FRAPPE.mauve,
|
CatppuccinValue::Pink => catppuccin_egui::FRAPPE.pink,
|
||||||
CatppuccinValue::Red => catppuccin_egui::FRAPPE.red,
|
CatppuccinValue::Mauve => catppuccin_egui::FRAPPE.mauve,
|
||||||
CatppuccinValue::Maroon => catppuccin_egui::FRAPPE.maroon,
|
CatppuccinValue::Red => catppuccin_egui::FRAPPE.red,
|
||||||
CatppuccinValue::Peach => catppuccin_egui::FRAPPE.peach,
|
CatppuccinValue::Maroon => catppuccin_egui::FRAPPE.maroon,
|
||||||
CatppuccinValue::Yellow => catppuccin_egui::FRAPPE.yellow,
|
CatppuccinValue::Peach => catppuccin_egui::FRAPPE.peach,
|
||||||
CatppuccinValue::Green => catppuccin_egui::FRAPPE.green,
|
CatppuccinValue::Yellow => catppuccin_egui::FRAPPE.yellow,
|
||||||
CatppuccinValue::Teal => catppuccin_egui::FRAPPE.teal,
|
CatppuccinValue::Green => catppuccin_egui::FRAPPE.green,
|
||||||
CatppuccinValue::Sky => catppuccin_egui::FRAPPE.sky,
|
CatppuccinValue::Teal => catppuccin_egui::FRAPPE.teal,
|
||||||
CatppuccinValue::Sapphire => catppuccin_egui::FRAPPE.sapphire,
|
CatppuccinValue::Sky => catppuccin_egui::FRAPPE.sky,
|
||||||
CatppuccinValue::Blue => catppuccin_egui::FRAPPE.blue,
|
CatppuccinValue::Sapphire => catppuccin_egui::FRAPPE.sapphire,
|
||||||
CatppuccinValue::Lavender => catppuccin_egui::FRAPPE.lavender,
|
CatppuccinValue::Blue => catppuccin_egui::FRAPPE.blue,
|
||||||
CatppuccinValue::Text => catppuccin_egui::FRAPPE.text,
|
CatppuccinValue::Lavender => catppuccin_egui::FRAPPE.lavender,
|
||||||
CatppuccinValue::Subtext1 => catppuccin_egui::FRAPPE.subtext1,
|
CatppuccinValue::Text => catppuccin_egui::FRAPPE.text,
|
||||||
CatppuccinValue::Subtext0 => catppuccin_egui::FRAPPE.subtext0,
|
CatppuccinValue::Subtext1 => catppuccin_egui::FRAPPE.subtext1,
|
||||||
CatppuccinValue::Overlay2 => catppuccin_egui::FRAPPE.overlay2,
|
CatppuccinValue::Subtext0 => catppuccin_egui::FRAPPE.subtext0,
|
||||||
CatppuccinValue::Overlay1 => catppuccin_egui::FRAPPE.overlay1,
|
CatppuccinValue::Overlay2 => catppuccin_egui::FRAPPE.overlay2,
|
||||||
CatppuccinValue::Overlay0 => catppuccin_egui::FRAPPE.overlay0,
|
CatppuccinValue::Overlay1 => catppuccin_egui::FRAPPE.overlay1,
|
||||||
CatppuccinValue::Surface2 => catppuccin_egui::FRAPPE.surface2,
|
CatppuccinValue::Overlay0 => catppuccin_egui::FRAPPE.overlay0,
|
||||||
CatppuccinValue::Surface1 => catppuccin_egui::FRAPPE.surface1,
|
CatppuccinValue::Surface2 => catppuccin_egui::FRAPPE.surface2,
|
||||||
CatppuccinValue::Surface0 => catppuccin_egui::FRAPPE.surface0,
|
CatppuccinValue::Surface1 => catppuccin_egui::FRAPPE.surface1,
|
||||||
CatppuccinValue::Base => catppuccin_egui::FRAPPE.base,
|
CatppuccinValue::Surface0 => catppuccin_egui::FRAPPE.surface0,
|
||||||
CatppuccinValue::Mantle => catppuccin_egui::FRAPPE.mantle,
|
CatppuccinValue::Base => catppuccin_egui::FRAPPE.base,
|
||||||
CatppuccinValue::Crust => catppuccin_egui::FRAPPE.crust,
|
CatppuccinValue::Mantle => catppuccin_egui::FRAPPE.mantle,
|
||||||
};
|
CatppuccinValue::Crust => catppuccin_egui::FRAPPE.crust,
|
||||||
|
};
|
||||||
|
|
||||||
|
ctx.style_mut(|style| {
|
||||||
|
style.visuals.selection.stroke.color = accent;
|
||||||
|
style.visuals.widgets.hovered.fg_stroke.color = accent;
|
||||||
|
style.visuals.widgets.active.fg_stroke.color = accent;
|
||||||
|
style.visuals.override_text_color = None;
|
||||||
|
});
|
||||||
|
|
||||||
ctx.style_mut(|style| {
|
|
||||||
style.visuals.selection.stroke.color = accent;
|
|
||||||
style.visuals.widgets.hovered.fg_stroke.color = accent;
|
|
||||||
style.visuals.widgets.active.fg_stroke.color = accent;
|
|
||||||
style.visuals.override_text_color = None;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
self.bg_color = catppuccin_egui::FRAPPE.base;
|
self.bg_color = catppuccin_egui::FRAPPE.base;
|
||||||
}
|
}
|
||||||
Catppuccin::Latte => {
|
Catppuccin::Latte => {
|
||||||
catppuccin_egui::set_theme(ctx, catppuccin_egui::LATTE);
|
catppuccin_egui::set_theme(ctx, catppuccin_egui::LATTE);
|
||||||
if let Some(catppuccin_value) = catppuccin_value {
|
let catppuccin_value = catppuccin_value.unwrap_or_default();
|
||||||
let accent = match catppuccin_value {
|
|
||||||
CatppuccinValue::Rosewater => catppuccin_egui::LATTE.rosewater,
|
let accent = match catppuccin_value {
|
||||||
CatppuccinValue::Flamingo => catppuccin_egui::LATTE.flamingo,
|
CatppuccinValue::Rosewater => catppuccin_egui::LATTE.rosewater,
|
||||||
CatppuccinValue::Pink => catppuccin_egui::LATTE.pink,
|
CatppuccinValue::Flamingo => catppuccin_egui::LATTE.flamingo,
|
||||||
CatppuccinValue::Mauve => catppuccin_egui::LATTE.mauve,
|
CatppuccinValue::Pink => catppuccin_egui::LATTE.pink,
|
||||||
CatppuccinValue::Red => catppuccin_egui::LATTE.red,
|
CatppuccinValue::Mauve => catppuccin_egui::LATTE.mauve,
|
||||||
CatppuccinValue::Maroon => catppuccin_egui::LATTE.maroon,
|
CatppuccinValue::Red => catppuccin_egui::LATTE.red,
|
||||||
CatppuccinValue::Peach => catppuccin_egui::LATTE.peach,
|
CatppuccinValue::Maroon => catppuccin_egui::LATTE.maroon,
|
||||||
CatppuccinValue::Yellow => catppuccin_egui::LATTE.yellow,
|
CatppuccinValue::Peach => catppuccin_egui::LATTE.peach,
|
||||||
CatppuccinValue::Green => catppuccin_egui::LATTE.green,
|
CatppuccinValue::Yellow => catppuccin_egui::LATTE.yellow,
|
||||||
CatppuccinValue::Teal => catppuccin_egui::LATTE.teal,
|
CatppuccinValue::Green => catppuccin_egui::LATTE.green,
|
||||||
CatppuccinValue::Sky => catppuccin_egui::LATTE.sky,
|
CatppuccinValue::Teal => catppuccin_egui::LATTE.teal,
|
||||||
CatppuccinValue::Sapphire => catppuccin_egui::LATTE.sapphire,
|
CatppuccinValue::Sky => catppuccin_egui::LATTE.sky,
|
||||||
CatppuccinValue::Blue => catppuccin_egui::LATTE.blue,
|
CatppuccinValue::Sapphire => catppuccin_egui::LATTE.sapphire,
|
||||||
CatppuccinValue::Lavender => catppuccin_egui::LATTE.lavender,
|
CatppuccinValue::Blue => catppuccin_egui::LATTE.blue,
|
||||||
CatppuccinValue::Text => catppuccin_egui::LATTE.text,
|
CatppuccinValue::Lavender => catppuccin_egui::LATTE.lavender,
|
||||||
CatppuccinValue::Subtext1 => catppuccin_egui::LATTE.subtext1,
|
CatppuccinValue::Text => catppuccin_egui::LATTE.text,
|
||||||
CatppuccinValue::Subtext0 => catppuccin_egui::LATTE.subtext0,
|
CatppuccinValue::Subtext1 => catppuccin_egui::LATTE.subtext1,
|
||||||
CatppuccinValue::Overlay2 => catppuccin_egui::LATTE.overlay2,
|
CatppuccinValue::Subtext0 => catppuccin_egui::LATTE.subtext0,
|
||||||
CatppuccinValue::Overlay1 => catppuccin_egui::LATTE.overlay1,
|
CatppuccinValue::Overlay2 => catppuccin_egui::LATTE.overlay2,
|
||||||
CatppuccinValue::Overlay0 => catppuccin_egui::LATTE.overlay0,
|
CatppuccinValue::Overlay1 => catppuccin_egui::LATTE.overlay1,
|
||||||
CatppuccinValue::Surface2 => catppuccin_egui::LATTE.surface2,
|
CatppuccinValue::Overlay0 => catppuccin_egui::LATTE.overlay0,
|
||||||
CatppuccinValue::Surface1 => catppuccin_egui::LATTE.surface1,
|
CatppuccinValue::Surface2 => catppuccin_egui::LATTE.surface2,
|
||||||
CatppuccinValue::Surface0 => catppuccin_egui::LATTE.surface0,
|
CatppuccinValue::Surface1 => catppuccin_egui::LATTE.surface1,
|
||||||
CatppuccinValue::Base => catppuccin_egui::LATTE.base,
|
CatppuccinValue::Surface0 => catppuccin_egui::LATTE.surface0,
|
||||||
CatppuccinValue::Mantle => catppuccin_egui::LATTE.mantle,
|
CatppuccinValue::Base => catppuccin_egui::LATTE.base,
|
||||||
CatppuccinValue::Crust => catppuccin_egui::LATTE.crust,
|
CatppuccinValue::Mantle => catppuccin_egui::LATTE.mantle,
|
||||||
};
|
CatppuccinValue::Crust => catppuccin_egui::LATTE.crust,
|
||||||
|
};
|
||||||
|
|
||||||
|
ctx.style_mut(|style| {
|
||||||
|
style.visuals.selection.stroke.color = accent;
|
||||||
|
style.visuals.widgets.hovered.fg_stroke.color = accent;
|
||||||
|
style.visuals.widgets.active.fg_stroke.color = accent;
|
||||||
|
style.visuals.override_text_color = None;
|
||||||
|
});
|
||||||
|
|
||||||
ctx.style_mut(|style| {
|
|
||||||
style.visuals.selection.stroke.color = accent;
|
|
||||||
style.visuals.widgets.hovered.fg_stroke.color = accent;
|
|
||||||
style.visuals.widgets.active.fg_stroke.color = accent;
|
|
||||||
style.visuals.override_text_color = None;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
self.bg_color = catppuccin_egui::LATTE.base;
|
self.bg_color = catppuccin_egui::LATTE.base;
|
||||||
}
|
}
|
||||||
Catppuccin::Macchiato => {
|
Catppuccin::Macchiato => {
|
||||||
catppuccin_egui::set_theme(ctx, catppuccin_egui::MACCHIATO);
|
catppuccin_egui::set_theme(ctx, catppuccin_egui::MACCHIATO);
|
||||||
if let Some(catppuccin_value) = catppuccin_value {
|
let catppuccin_value = catppuccin_value.unwrap_or_default();
|
||||||
let accent = match catppuccin_value {
|
|
||||||
CatppuccinValue::Rosewater => catppuccin_egui::MACCHIATO.rosewater,
|
let accent = match catppuccin_value {
|
||||||
CatppuccinValue::Flamingo => catppuccin_egui::MACCHIATO.flamingo,
|
CatppuccinValue::Rosewater => catppuccin_egui::MACCHIATO.rosewater,
|
||||||
CatppuccinValue::Pink => catppuccin_egui::MACCHIATO.pink,
|
CatppuccinValue::Flamingo => catppuccin_egui::MACCHIATO.flamingo,
|
||||||
CatppuccinValue::Mauve => catppuccin_egui::MACCHIATO.mauve,
|
CatppuccinValue::Pink => catppuccin_egui::MACCHIATO.pink,
|
||||||
CatppuccinValue::Red => catppuccin_egui::MACCHIATO.red,
|
CatppuccinValue::Mauve => catppuccin_egui::MACCHIATO.mauve,
|
||||||
CatppuccinValue::Maroon => catppuccin_egui::MACCHIATO.maroon,
|
CatppuccinValue::Red => catppuccin_egui::MACCHIATO.red,
|
||||||
CatppuccinValue::Peach => catppuccin_egui::MACCHIATO.peach,
|
CatppuccinValue::Maroon => catppuccin_egui::MACCHIATO.maroon,
|
||||||
CatppuccinValue::Yellow => catppuccin_egui::MACCHIATO.yellow,
|
CatppuccinValue::Peach => catppuccin_egui::MACCHIATO.peach,
|
||||||
CatppuccinValue::Green => catppuccin_egui::MACCHIATO.green,
|
CatppuccinValue::Yellow => catppuccin_egui::MACCHIATO.yellow,
|
||||||
CatppuccinValue::Teal => catppuccin_egui::MACCHIATO.teal,
|
CatppuccinValue::Green => catppuccin_egui::MACCHIATO.green,
|
||||||
CatppuccinValue::Sky => catppuccin_egui::MACCHIATO.sky,
|
CatppuccinValue::Teal => catppuccin_egui::MACCHIATO.teal,
|
||||||
CatppuccinValue::Sapphire => catppuccin_egui::MACCHIATO.sapphire,
|
CatppuccinValue::Sky => catppuccin_egui::MACCHIATO.sky,
|
||||||
CatppuccinValue::Blue => catppuccin_egui::MACCHIATO.blue,
|
CatppuccinValue::Sapphire => catppuccin_egui::MACCHIATO.sapphire,
|
||||||
CatppuccinValue::Lavender => catppuccin_egui::MACCHIATO.lavender,
|
CatppuccinValue::Blue => catppuccin_egui::MACCHIATO.blue,
|
||||||
CatppuccinValue::Text => catppuccin_egui::MACCHIATO.text,
|
CatppuccinValue::Lavender => catppuccin_egui::MACCHIATO.lavender,
|
||||||
CatppuccinValue::Subtext1 => catppuccin_egui::MACCHIATO.subtext1,
|
CatppuccinValue::Text => catppuccin_egui::MACCHIATO.text,
|
||||||
CatppuccinValue::Subtext0 => catppuccin_egui::MACCHIATO.subtext0,
|
CatppuccinValue::Subtext1 => catppuccin_egui::MACCHIATO.subtext1,
|
||||||
CatppuccinValue::Overlay2 => catppuccin_egui::MACCHIATO.overlay2,
|
CatppuccinValue::Subtext0 => catppuccin_egui::MACCHIATO.subtext0,
|
||||||
CatppuccinValue::Overlay1 => catppuccin_egui::MACCHIATO.overlay1,
|
CatppuccinValue::Overlay2 => catppuccin_egui::MACCHIATO.overlay2,
|
||||||
CatppuccinValue::Overlay0 => catppuccin_egui::MACCHIATO.overlay0,
|
CatppuccinValue::Overlay1 => catppuccin_egui::MACCHIATO.overlay1,
|
||||||
CatppuccinValue::Surface2 => catppuccin_egui::MACCHIATO.surface2,
|
CatppuccinValue::Overlay0 => catppuccin_egui::MACCHIATO.overlay0,
|
||||||
CatppuccinValue::Surface1 => catppuccin_egui::MACCHIATO.surface1,
|
CatppuccinValue::Surface2 => catppuccin_egui::MACCHIATO.surface2,
|
||||||
CatppuccinValue::Surface0 => catppuccin_egui::MACCHIATO.surface0,
|
CatppuccinValue::Surface1 => catppuccin_egui::MACCHIATO.surface1,
|
||||||
CatppuccinValue::Base => catppuccin_egui::MACCHIATO.base,
|
CatppuccinValue::Surface0 => catppuccin_egui::MACCHIATO.surface0,
|
||||||
CatppuccinValue::Mantle => catppuccin_egui::MACCHIATO.mantle,
|
CatppuccinValue::Base => catppuccin_egui::MACCHIATO.base,
|
||||||
CatppuccinValue::Crust => catppuccin_egui::MACCHIATO.crust,
|
CatppuccinValue::Mantle => catppuccin_egui::MACCHIATO.mantle,
|
||||||
};
|
CatppuccinValue::Crust => catppuccin_egui::MACCHIATO.crust,
|
||||||
|
};
|
||||||
|
|
||||||
|
ctx.style_mut(|style| {
|
||||||
|
style.visuals.selection.stroke.color = accent;
|
||||||
|
style.visuals.widgets.hovered.fg_stroke.color = accent;
|
||||||
|
style.visuals.widgets.active.fg_stroke.color = accent;
|
||||||
|
style.visuals.override_text_color = None;
|
||||||
|
});
|
||||||
|
|
||||||
ctx.style_mut(|style| {
|
|
||||||
style.visuals.selection.stroke.color = accent;
|
|
||||||
style.visuals.widgets.hovered.fg_stroke.color = accent;
|
|
||||||
style.visuals.widgets.active.fg_stroke.color = accent;
|
|
||||||
style.visuals.override_text_color = None;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
self.bg_color = catppuccin_egui::MACCHIATO.base;
|
self.bg_color = catppuccin_egui::MACCHIATO.base;
|
||||||
}
|
}
|
||||||
Catppuccin::Mocha => {
|
Catppuccin::Mocha => {
|
||||||
catppuccin_egui::set_theme(ctx, catppuccin_egui::MOCHA);
|
catppuccin_egui::set_theme(ctx, catppuccin_egui::MOCHA);
|
||||||
if let Some(catppuccin_value) = catppuccin_value {
|
let catppuccin_value = catppuccin_value.unwrap_or_default();
|
||||||
let accent = match catppuccin_value {
|
|
||||||
CatppuccinValue::Rosewater => catppuccin_egui::MOCHA.rosewater,
|
let accent = match catppuccin_value {
|
||||||
CatppuccinValue::Flamingo => catppuccin_egui::MOCHA.flamingo,
|
CatppuccinValue::Rosewater => catppuccin_egui::MOCHA.rosewater,
|
||||||
CatppuccinValue::Pink => catppuccin_egui::MOCHA.pink,
|
CatppuccinValue::Flamingo => catppuccin_egui::MOCHA.flamingo,
|
||||||
CatppuccinValue::Mauve => catppuccin_egui::MOCHA.mauve,
|
CatppuccinValue::Pink => catppuccin_egui::MOCHA.pink,
|
||||||
CatppuccinValue::Red => catppuccin_egui::MOCHA.red,
|
CatppuccinValue::Mauve => catppuccin_egui::MOCHA.mauve,
|
||||||
CatppuccinValue::Maroon => catppuccin_egui::MOCHA.maroon,
|
CatppuccinValue::Red => catppuccin_egui::MOCHA.red,
|
||||||
CatppuccinValue::Peach => catppuccin_egui::MOCHA.peach,
|
CatppuccinValue::Maroon => catppuccin_egui::MOCHA.maroon,
|
||||||
CatppuccinValue::Yellow => catppuccin_egui::MOCHA.yellow,
|
CatppuccinValue::Peach => catppuccin_egui::MOCHA.peach,
|
||||||
CatppuccinValue::Green => catppuccin_egui::MOCHA.green,
|
CatppuccinValue::Yellow => catppuccin_egui::MOCHA.yellow,
|
||||||
CatppuccinValue::Teal => catppuccin_egui::MOCHA.teal,
|
CatppuccinValue::Green => catppuccin_egui::MOCHA.green,
|
||||||
CatppuccinValue::Sky => catppuccin_egui::MOCHA.sky,
|
CatppuccinValue::Teal => catppuccin_egui::MOCHA.teal,
|
||||||
CatppuccinValue::Sapphire => catppuccin_egui::MOCHA.sapphire,
|
CatppuccinValue::Sky => catppuccin_egui::MOCHA.sky,
|
||||||
CatppuccinValue::Blue => catppuccin_egui::MOCHA.blue,
|
CatppuccinValue::Sapphire => catppuccin_egui::MOCHA.sapphire,
|
||||||
CatppuccinValue::Lavender => catppuccin_egui::MOCHA.lavender,
|
CatppuccinValue::Blue => catppuccin_egui::MOCHA.blue,
|
||||||
CatppuccinValue::Text => catppuccin_egui::MOCHA.text,
|
CatppuccinValue::Lavender => catppuccin_egui::MOCHA.lavender,
|
||||||
CatppuccinValue::Subtext1 => catppuccin_egui::MOCHA.subtext1,
|
CatppuccinValue::Text => catppuccin_egui::MOCHA.text,
|
||||||
CatppuccinValue::Subtext0 => catppuccin_egui::MOCHA.subtext0,
|
CatppuccinValue::Subtext1 => catppuccin_egui::MOCHA.subtext1,
|
||||||
CatppuccinValue::Overlay2 => catppuccin_egui::MOCHA.overlay2,
|
CatppuccinValue::Subtext0 => catppuccin_egui::MOCHA.subtext0,
|
||||||
CatppuccinValue::Overlay1 => catppuccin_egui::MOCHA.overlay1,
|
CatppuccinValue::Overlay2 => catppuccin_egui::MOCHA.overlay2,
|
||||||
CatppuccinValue::Overlay0 => catppuccin_egui::MOCHA.overlay0,
|
CatppuccinValue::Overlay1 => catppuccin_egui::MOCHA.overlay1,
|
||||||
CatppuccinValue::Surface2 => catppuccin_egui::MOCHA.surface2,
|
CatppuccinValue::Overlay0 => catppuccin_egui::MOCHA.overlay0,
|
||||||
CatppuccinValue::Surface1 => catppuccin_egui::MOCHA.surface1,
|
CatppuccinValue::Surface2 => catppuccin_egui::MOCHA.surface2,
|
||||||
CatppuccinValue::Surface0 => catppuccin_egui::MOCHA.surface0,
|
CatppuccinValue::Surface1 => catppuccin_egui::MOCHA.surface1,
|
||||||
CatppuccinValue::Base => catppuccin_egui::MOCHA.base,
|
CatppuccinValue::Surface0 => catppuccin_egui::MOCHA.surface0,
|
||||||
CatppuccinValue::Mantle => catppuccin_egui::MOCHA.mantle,
|
CatppuccinValue::Base => catppuccin_egui::MOCHA.base,
|
||||||
CatppuccinValue::Crust => catppuccin_egui::MOCHA.crust,
|
CatppuccinValue::Mantle => catppuccin_egui::MOCHA.mantle,
|
||||||
};
|
CatppuccinValue::Crust => catppuccin_egui::MOCHA.crust,
|
||||||
|
};
|
||||||
|
|
||||||
|
ctx.style_mut(|style| {
|
||||||
|
style.visuals.selection.stroke.color = accent;
|
||||||
|
style.visuals.widgets.hovered.fg_stroke.color = accent;
|
||||||
|
style.visuals.widgets.active.fg_stroke.color = accent;
|
||||||
|
style.visuals.override_text_color = None;
|
||||||
|
});
|
||||||
|
|
||||||
ctx.style_mut(|style| {
|
|
||||||
style.visuals.selection.stroke.color = accent;
|
|
||||||
style.visuals.widgets.hovered.fg_stroke.color = accent;
|
|
||||||
style.visuals.widgets.active.fg_stroke.color = accent;
|
|
||||||
style.visuals.override_text_color = None;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
self.bg_color = catppuccin_egui::MOCHA.base;
|
self.bg_color = catppuccin_egui::MOCHA.base;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -227,32 +231,33 @@ impl Komobar {
|
|||||||
accent: base16_value,
|
accent: base16_value,
|
||||||
} => {
|
} => {
|
||||||
ctx.set_style(base16.style());
|
ctx.set_style(base16.style());
|
||||||
if let Some(base16_value) = base16_value {
|
let base16_value = base16_value.unwrap_or_default();
|
||||||
let accent = match base16_value {
|
|
||||||
Base16Value::Base00 => base16.base00(),
|
let accent = match base16_value {
|
||||||
Base16Value::Base01 => base16.base01(),
|
Base16Value::Base00 => base16.base00(),
|
||||||
Base16Value::Base02 => base16.base02(),
|
Base16Value::Base01 => base16.base01(),
|
||||||
Base16Value::Base03 => base16.base03(),
|
Base16Value::Base02 => base16.base02(),
|
||||||
Base16Value::Base04 => base16.base04(),
|
Base16Value::Base03 => base16.base03(),
|
||||||
Base16Value::Base05 => base16.base05(),
|
Base16Value::Base04 => base16.base04(),
|
||||||
Base16Value::Base06 => base16.base06(),
|
Base16Value::Base05 => base16.base05(),
|
||||||
Base16Value::Base07 => base16.base07(),
|
Base16Value::Base06 => base16.base06(),
|
||||||
Base16Value::Base08 => base16.base08(),
|
Base16Value::Base07 => base16.base07(),
|
||||||
Base16Value::Base09 => base16.base09(),
|
Base16Value::Base08 => base16.base08(),
|
||||||
Base16Value::Base0A => base16.base0a(),
|
Base16Value::Base09 => base16.base09(),
|
||||||
Base16Value::Base0B => base16.base0b(),
|
Base16Value::Base0A => base16.base0a(),
|
||||||
Base16Value::Base0C => base16.base0c(),
|
Base16Value::Base0B => base16.base0b(),
|
||||||
Base16Value::Base0D => base16.base0d(),
|
Base16Value::Base0C => base16.base0c(),
|
||||||
Base16Value::Base0E => base16.base0e(),
|
Base16Value::Base0D => base16.base0d(),
|
||||||
Base16Value::Base0F => base16.base0f(),
|
Base16Value::Base0E => base16.base0e(),
|
||||||
};
|
Base16Value::Base0F => base16.base0f(),
|
||||||
|
};
|
||||||
|
|
||||||
|
ctx.style_mut(|style| {
|
||||||
|
style.visuals.selection.stroke.color = accent;
|
||||||
|
style.visuals.widgets.hovered.fg_stroke.color = accent;
|
||||||
|
style.visuals.widgets.active.fg_stroke.color = accent;
|
||||||
|
});
|
||||||
|
|
||||||
ctx.style_mut(|style| {
|
|
||||||
style.visuals.selection.stroke.color = accent;
|
|
||||||
style.visuals.widgets.hovered.fg_stroke.color = accent;
|
|
||||||
style.visuals.widgets.active.fg_stroke.color = accent;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
self.bg_color = base16.background();
|
self.bg_color = base16.background();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
+45
-22
@@ -1,8 +1,12 @@
|
|||||||
use crate::widget::BarWidget;
|
use crate::widget::BarWidget;
|
||||||
use crate::WIDGET_SPACING;
|
use crate::WIDGET_SPACING;
|
||||||
|
use eframe::egui::text::LayoutJob;
|
||||||
use eframe::egui::Context;
|
use eframe::egui::Context;
|
||||||
|
use eframe::egui::FontId;
|
||||||
use eframe::egui::Label;
|
use eframe::egui::Label;
|
||||||
use eframe::egui::Sense;
|
use eframe::egui::Sense;
|
||||||
|
use eframe::egui::TextFormat;
|
||||||
|
use eframe::egui::TextStyle;
|
||||||
use eframe::egui::Ui;
|
use eframe::egui::Ui;
|
||||||
use schemars::JsonSchema;
|
use schemars::JsonSchema;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
@@ -24,7 +28,7 @@ pub struct BatteryConfig {
|
|||||||
impl From<BatteryConfig> for Battery {
|
impl From<BatteryConfig> for Battery {
|
||||||
fn from(value: BatteryConfig) -> Self {
|
fn from(value: BatteryConfig) -> Self {
|
||||||
let manager = Manager::new().unwrap();
|
let manager = Manager::new().unwrap();
|
||||||
let mut last_state = vec![];
|
let mut last_state = String::new();
|
||||||
let mut state = None;
|
let mut state = None;
|
||||||
|
|
||||||
if let Ok(mut batteries) = manager.batteries() {
|
if let Ok(mut batteries) = manager.batteries() {
|
||||||
@@ -35,7 +39,8 @@ impl From<BatteryConfig> for Battery {
|
|||||||
State::Discharging => state = Some(BatteryState::Discharging),
|
State::Discharging => state = Some(BatteryState::Discharging),
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
last_state.push(format!("{percentage}%"));
|
|
||||||
|
last_state = format!("{percentage}%");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,17 +65,17 @@ pub struct Battery {
|
|||||||
manager: Manager,
|
manager: Manager,
|
||||||
pub state: BatteryState,
|
pub state: BatteryState,
|
||||||
data_refresh_interval: u64,
|
data_refresh_interval: u64,
|
||||||
last_state: Vec<String>,
|
last_state: String,
|
||||||
last_updated: Instant,
|
last_updated: Instant,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Battery {
|
impl Battery {
|
||||||
fn output(&mut self) -> Vec<String> {
|
fn output(&mut self) -> String {
|
||||||
let mut outputs = self.last_state.clone();
|
let mut output = self.last_state.clone();
|
||||||
|
|
||||||
let now = Instant::now();
|
let now = Instant::now();
|
||||||
if now.duration_since(self.last_updated) > Duration::from_secs(self.data_refresh_interval) {
|
if now.duration_since(self.last_updated) > Duration::from_secs(self.data_refresh_interval) {
|
||||||
outputs.clear();
|
output.clear();
|
||||||
|
|
||||||
if let Ok(mut batteries) = self.manager.batteries() {
|
if let Ok(mut batteries) = self.manager.batteries() {
|
||||||
if let Some(Ok(first)) = batteries.nth(0) {
|
if let Some(Ok(first)) = batteries.nth(0) {
|
||||||
@@ -81,38 +86,56 @@ impl Battery {
|
|||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
outputs.push(format!("{percentage}%"));
|
output = format!("{percentage}%");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.last_state.clone_from(&outputs);
|
self.last_state.clone_from(&output);
|
||||||
self.last_updated = now;
|
self.last_updated = now;
|
||||||
}
|
}
|
||||||
|
|
||||||
outputs
|
output
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl BarWidget for Battery {
|
impl BarWidget for Battery {
|
||||||
fn render(&mut self, _ctx: &Context, ui: &mut Ui) {
|
fn render(&mut self, ctx: &Context, ui: &mut Ui) {
|
||||||
if self.enable {
|
if self.enable {
|
||||||
let output = self.output();
|
let output = self.output();
|
||||||
if !output.is_empty() {
|
if !output.is_empty() {
|
||||||
for battery in output {
|
let emoji = match self.state {
|
||||||
let emoji = match self.state {
|
BatteryState::Charging => egui_phosphor::regular::BATTERY_CHARGING,
|
||||||
BatteryState::Charging => egui_phosphor::regular::BATTERY_CHARGING,
|
BatteryState::Discharging => egui_phosphor::regular::BATTERY_FULL,
|
||||||
BatteryState::Discharging => egui_phosphor::regular::BATTERY_FULL,
|
};
|
||||||
};
|
|
||||||
|
|
||||||
ui.add(
|
let font_id = ctx
|
||||||
Label::new(format!("{emoji} {battery}"))
|
.style()
|
||||||
.selectable(false)
|
.text_styles
|
||||||
.sense(Sense::click()),
|
.get(&TextStyle::Body)
|
||||||
);
|
.cloned()
|
||||||
}
|
.unwrap_or_else(FontId::default);
|
||||||
|
|
||||||
ui.add_space(WIDGET_SPACING);
|
let mut layout_job = LayoutJob::simple(
|
||||||
|
emoji.to_string(),
|
||||||
|
font_id.clone(),
|
||||||
|
ctx.style().visuals.selection.stroke.color,
|
||||||
|
100.0,
|
||||||
|
);
|
||||||
|
|
||||||
|
layout_job.append(
|
||||||
|
&output,
|
||||||
|
10.0,
|
||||||
|
TextFormat::simple(font_id, ctx.style().visuals.text_color()),
|
||||||
|
);
|
||||||
|
|
||||||
|
ui.add(
|
||||||
|
Label::new(layout_job)
|
||||||
|
.selectable(false)
|
||||||
|
.sense(Sense::click()),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ui.add_space(WIDGET_SPACING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+34
-12
@@ -1,9 +1,14 @@
|
|||||||
use crate::widget::BarWidget;
|
use crate::widget::BarWidget;
|
||||||
use crate::WIDGET_SPACING;
|
use crate::WIDGET_SPACING;
|
||||||
|
use eframe::egui::text::LayoutJob;
|
||||||
use eframe::egui::Context;
|
use eframe::egui::Context;
|
||||||
|
use eframe::egui::FontId;
|
||||||
use eframe::egui::Label;
|
use eframe::egui::Label;
|
||||||
use eframe::egui::Sense;
|
use eframe::egui::Sense;
|
||||||
|
use eframe::egui::TextFormat;
|
||||||
|
use eframe::egui::TextStyle;
|
||||||
use eframe::egui::Ui;
|
use eframe::egui::Ui;
|
||||||
|
use eframe::egui::WidgetText;
|
||||||
use schemars::JsonSchema;
|
use schemars::JsonSchema;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
@@ -68,26 +73,43 @@ pub struct Date {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Date {
|
impl Date {
|
||||||
fn output(&mut self) -> Vec<String> {
|
fn output(&mut self) -> String {
|
||||||
vec![chrono::Local::now()
|
chrono::Local::now()
|
||||||
.format(&self.format.fmt_string())
|
.format(&self.format.fmt_string())
|
||||||
.to_string()]
|
.to_string()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl BarWidget for Date {
|
impl BarWidget for Date {
|
||||||
fn render(&mut self, _ctx: &Context, ui: &mut Ui) {
|
fn render(&mut self, ctx: &Context, ui: &mut Ui) {
|
||||||
if self.enable {
|
if self.enable {
|
||||||
for output in self.output() {
|
let output = self.output();
|
||||||
|
if !output.is_empty() {
|
||||||
|
let font_id = ctx
|
||||||
|
.style()
|
||||||
|
.text_styles
|
||||||
|
.get(&TextStyle::Body)
|
||||||
|
.cloned()
|
||||||
|
.unwrap_or_else(FontId::default);
|
||||||
|
|
||||||
|
let mut layout_job = LayoutJob::simple(
|
||||||
|
egui_phosphor::regular::CALENDAR_DOTS.to_string(),
|
||||||
|
font_id.clone(),
|
||||||
|
ctx.style().visuals.selection.stroke.color,
|
||||||
|
100.0,
|
||||||
|
);
|
||||||
|
|
||||||
|
layout_job.append(
|
||||||
|
&output,
|
||||||
|
10.0,
|
||||||
|
TextFormat::simple(font_id, ctx.style().visuals.text_color()),
|
||||||
|
);
|
||||||
|
|
||||||
if ui
|
if ui
|
||||||
.add(
|
.add(
|
||||||
Label::new(format!(
|
Label::new(WidgetText::LayoutJob(layout_job.clone()))
|
||||||
"{} {}",
|
.selectable(false)
|
||||||
egui_phosphor::regular::CALENDAR_DOTS,
|
.sense(Sense::click()),
|
||||||
output
|
|
||||||
))
|
|
||||||
.selectable(false)
|
|
||||||
.sense(Sense::click()),
|
|
||||||
)
|
)
|
||||||
.clicked()
|
.clicked()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -183,8 +183,8 @@ fn main() -> color_eyre::Result<()> {
|
|||||||
let config_path_cl = config_path.clone();
|
let config_path_cl = config_path.clone();
|
||||||
|
|
||||||
hotwatch.watch(config_path, move |event| match event.kind {
|
hotwatch.watch(config_path, move |event| match event.kind {
|
||||||
EventKind::Modify(_) | EventKind::Remove(_) => {
|
EventKind::Modify(_) | EventKind::Remove(_) => match KomobarConfig::read(&config_path_cl) {
|
||||||
if let Ok(updated) = KomobarConfig::read(&config_path_cl) {
|
Ok(updated) => {
|
||||||
tx_config.send(updated).unwrap();
|
tx_config.send(updated).unwrap();
|
||||||
|
|
||||||
tracing::info!(
|
tracing::info!(
|
||||||
@@ -192,7 +192,10 @@ fn main() -> color_eyre::Result<()> {
|
|||||||
config_path_cl.as_path().to_string_lossy()
|
config_path_cl.as_path().to_string_lossy()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
Err(error) => {
|
||||||
|
tracing::error!("{error}");
|
||||||
|
}
|
||||||
|
},
|
||||||
_ => {}
|
_ => {}
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
use crate::widget::BarWidget;
|
use crate::widget::BarWidget;
|
||||||
use crate::WIDGET_SPACING;
|
use crate::WIDGET_SPACING;
|
||||||
|
use eframe::egui::text::LayoutJob;
|
||||||
use eframe::egui::Context;
|
use eframe::egui::Context;
|
||||||
|
use eframe::egui::FontId;
|
||||||
use eframe::egui::Label;
|
use eframe::egui::Label;
|
||||||
use eframe::egui::Sense;
|
use eframe::egui::Sense;
|
||||||
|
use eframe::egui::TextFormat;
|
||||||
|
use eframe::egui::TextStyle;
|
||||||
use eframe::egui::Ui;
|
use eframe::egui::Ui;
|
||||||
use schemars::JsonSchema;
|
use schemars::JsonSchema;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
@@ -46,36 +50,57 @@ impl Media {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn output(&mut self) -> Vec<String> {
|
fn output(&mut self) -> String {
|
||||||
if let Ok(session) = self.session_manager.GetCurrentSession() {
|
if let Ok(session) = self.session_manager.GetCurrentSession() {
|
||||||
if let Ok(operation) = session.TryGetMediaPropertiesAsync() {
|
if let Ok(operation) = session.TryGetMediaPropertiesAsync() {
|
||||||
if let Ok(properties) = operation.get() {
|
if let Ok(properties) = operation.get() {
|
||||||
if let (Ok(artist), Ok(title)) = (properties.Artist(), properties.Title()) {
|
if let (Ok(artist), Ok(title)) = (properties.Artist(), properties.Title()) {
|
||||||
if artist.is_empty() {
|
if artist.is_empty() {
|
||||||
return vec![format!("{title}")];
|
return format!("{title}");
|
||||||
}
|
}
|
||||||
|
|
||||||
if title.is_empty() {
|
if title.is_empty() {
|
||||||
return vec![format!("{artist}")];
|
return format!("{artist}");
|
||||||
}
|
}
|
||||||
|
|
||||||
return vec![format!("{artist} - {title}")];
|
return format!("{artist} - {title}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
vec![]
|
String::new()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl BarWidget for Media {
|
impl BarWidget for Media {
|
||||||
fn render(&mut self, _ctx: &Context, ui: &mut Ui) {
|
fn render(&mut self, ctx: &Context, ui: &mut Ui) {
|
||||||
if self.enable {
|
if self.enable {
|
||||||
for output in self.output() {
|
let output = self.output();
|
||||||
|
if !output.is_empty() {
|
||||||
|
let font_id = ctx
|
||||||
|
.style()
|
||||||
|
.text_styles
|
||||||
|
.get(&TextStyle::Body)
|
||||||
|
.cloned()
|
||||||
|
.unwrap_or_else(FontId::default);
|
||||||
|
|
||||||
|
let mut layout_job = LayoutJob::simple(
|
||||||
|
egui_phosphor::regular::HEADPHONES.to_string(),
|
||||||
|
font_id.clone(),
|
||||||
|
ctx.style().visuals.selection.stroke.color,
|
||||||
|
100.0,
|
||||||
|
);
|
||||||
|
|
||||||
|
layout_job.append(
|
||||||
|
&output,
|
||||||
|
10.0,
|
||||||
|
TextFormat::simple(font_id, ctx.style().visuals.text_color()),
|
||||||
|
);
|
||||||
|
|
||||||
if ui
|
if ui
|
||||||
.add(
|
.add(
|
||||||
Label::new(format!("{} {output}", egui_phosphor::regular::HEADPHONES))
|
Label::new(layout_job)
|
||||||
.selectable(false)
|
.selectable(false)
|
||||||
.sense(Sense::click()),
|
.sense(Sense::click()),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
use crate::widget::BarWidget;
|
use crate::widget::BarWidget;
|
||||||
use crate::WIDGET_SPACING;
|
use crate::WIDGET_SPACING;
|
||||||
|
use eframe::egui::text::LayoutJob;
|
||||||
use eframe::egui::Context;
|
use eframe::egui::Context;
|
||||||
|
use eframe::egui::FontId;
|
||||||
use eframe::egui::Label;
|
use eframe::egui::Label;
|
||||||
use eframe::egui::Sense;
|
use eframe::egui::Sense;
|
||||||
|
use eframe::egui::TextFormat;
|
||||||
|
use eframe::egui::TextStyle;
|
||||||
use eframe::egui::Ui;
|
use eframe::egui::Ui;
|
||||||
use schemars::JsonSchema;
|
use schemars::JsonSchema;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
@@ -45,7 +49,7 @@ pub struct Memory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Memory {
|
impl Memory {
|
||||||
fn output(&mut self) -> Vec<String> {
|
fn output(&mut self) -> String {
|
||||||
let now = Instant::now();
|
let now = Instant::now();
|
||||||
if now.duration_since(self.last_updated) > Duration::from_secs(self.data_refresh_interval) {
|
if now.duration_since(self.last_updated) > Duration::from_secs(self.data_refresh_interval) {
|
||||||
self.system.refresh_memory();
|
self.system.refresh_memory();
|
||||||
@@ -54,17 +58,38 @@ impl Memory {
|
|||||||
|
|
||||||
let used = self.system.used_memory();
|
let used = self.system.used_memory();
|
||||||
let total = self.system.total_memory();
|
let total = self.system.total_memory();
|
||||||
vec![format!("RAM: {}%", (used * 100) / total)]
|
format!("RAM: {}%", (used * 100) / total)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl BarWidget for Memory {
|
impl BarWidget for Memory {
|
||||||
fn render(&mut self, _ctx: &Context, ui: &mut Ui) {
|
fn render(&mut self, ctx: &Context, ui: &mut Ui) {
|
||||||
if self.enable {
|
if self.enable {
|
||||||
for output in self.output() {
|
let output = self.output();
|
||||||
|
if !output.is_empty() {
|
||||||
|
let font_id = ctx
|
||||||
|
.style()
|
||||||
|
.text_styles
|
||||||
|
.get(&TextStyle::Body)
|
||||||
|
.cloned()
|
||||||
|
.unwrap_or_else(FontId::default);
|
||||||
|
|
||||||
|
let mut layout_job = LayoutJob::simple(
|
||||||
|
egui_phosphor::regular::MEMORY.to_string(),
|
||||||
|
font_id.clone(),
|
||||||
|
ctx.style().visuals.selection.stroke.color,
|
||||||
|
100.0,
|
||||||
|
);
|
||||||
|
|
||||||
|
layout_job.append(
|
||||||
|
&output,
|
||||||
|
10.0,
|
||||||
|
TextFormat::simple(font_id, ctx.style().visuals.text_color()),
|
||||||
|
);
|
||||||
|
|
||||||
if ui
|
if ui
|
||||||
.add(
|
.add(
|
||||||
Label::new(format!("{} {}", egui_phosphor::regular::MEMORY, output))
|
Label::new(layout_job)
|
||||||
.selectable(false)
|
.selectable(false)
|
||||||
.sense(Sense::click()),
|
.sense(Sense::click()),
|
||||||
)
|
)
|
||||||
|
|||||||
+34
-13
@@ -1,8 +1,12 @@
|
|||||||
use crate::widget::BarWidget;
|
use crate::widget::BarWidget;
|
||||||
use crate::WIDGET_SPACING;
|
use crate::WIDGET_SPACING;
|
||||||
|
use eframe::egui::text::LayoutJob;
|
||||||
use eframe::egui::Context;
|
use eframe::egui::Context;
|
||||||
|
use eframe::egui::FontId;
|
||||||
use eframe::egui::Label;
|
use eframe::egui::Label;
|
||||||
use eframe::egui::Sense;
|
use eframe::egui::Sense;
|
||||||
|
use eframe::egui::TextFormat;
|
||||||
|
use eframe::egui::TextStyle;
|
||||||
use eframe::egui::Ui;
|
use eframe::egui::Ui;
|
||||||
use num_derive::FromPrimitive;
|
use num_derive::FromPrimitive;
|
||||||
use schemars::JsonSchema;
|
use schemars::JsonSchema;
|
||||||
@@ -194,7 +198,7 @@ impl Network {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl BarWidget for Network {
|
impl BarWidget for Network {
|
||||||
fn render(&mut self, _ctx: &Context, ui: &mut Ui) {
|
fn render(&mut self, ctx: &Context, ui: &mut Ui) {
|
||||||
if self.show_total_data_transmitted {
|
if self.show_total_data_transmitted {
|
||||||
for output in self.total_data_transmitted() {
|
for output in self.total_data_transmitted() {
|
||||||
ui.add(Label::new(output).selectable(false));
|
ui.add(Label::new(output).selectable(false));
|
||||||
@@ -214,21 +218,38 @@ impl BarWidget for Network {
|
|||||||
if self.enable {
|
if self.enable {
|
||||||
self.default_interface();
|
self.default_interface();
|
||||||
|
|
||||||
if !self.default_interface.is_empty()
|
if !self.default_interface.is_empty() {
|
||||||
&& ui
|
let font_id = ctx
|
||||||
|
.style()
|
||||||
|
.text_styles
|
||||||
|
.get(&TextStyle::Body)
|
||||||
|
.cloned()
|
||||||
|
.unwrap_or_else(FontId::default);
|
||||||
|
|
||||||
|
let mut layout_job = LayoutJob::simple(
|
||||||
|
egui_phosphor::regular::WIFI_HIGH.to_string(),
|
||||||
|
font_id.clone(),
|
||||||
|
ctx.style().visuals.selection.stroke.color,
|
||||||
|
100.0,
|
||||||
|
);
|
||||||
|
|
||||||
|
layout_job.append(
|
||||||
|
&self.default_interface,
|
||||||
|
10.0,
|
||||||
|
TextFormat::simple(font_id, ctx.style().visuals.text_color()),
|
||||||
|
);
|
||||||
|
|
||||||
|
if ui
|
||||||
.add(
|
.add(
|
||||||
Label::new(format!(
|
Label::new(layout_job)
|
||||||
"{} {}",
|
.selectable(false)
|
||||||
egui_phosphor::regular::WIFI_HIGH,
|
.sense(Sense::click()),
|
||||||
self.default_interface
|
|
||||||
))
|
|
||||||
.selectable(false)
|
|
||||||
.sense(Sense::click()),
|
|
||||||
)
|
)
|
||||||
.clicked()
|
.clicked()
|
||||||
{
|
{
|
||||||
if let Err(error) = Command::new("cmd.exe").args(["/C", "ncpa"]).spawn() {
|
if let Err(error) = Command::new("cmd.exe").args(["/C", "ncpa"]).spawn() {
|
||||||
eprintln!("{}", error)
|
eprintln!("{}", error)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
use crate::widget::BarWidget;
|
use crate::widget::BarWidget;
|
||||||
use crate::WIDGET_SPACING;
|
use crate::WIDGET_SPACING;
|
||||||
|
use eframe::egui::text::LayoutJob;
|
||||||
use eframe::egui::Context;
|
use eframe::egui::Context;
|
||||||
|
use eframe::egui::FontId;
|
||||||
use eframe::egui::Label;
|
use eframe::egui::Label;
|
||||||
use eframe::egui::Sense;
|
use eframe::egui::Sense;
|
||||||
|
use eframe::egui::TextFormat;
|
||||||
|
use eframe::egui::TextStyle;
|
||||||
use eframe::egui::Ui;
|
use eframe::egui::Ui;
|
||||||
use schemars::JsonSchema;
|
use schemars::JsonSchema;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
@@ -69,18 +73,34 @@ impl Storage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl BarWidget for Storage {
|
impl BarWidget for Storage {
|
||||||
fn render(&mut self, _ctx: &Context, ui: &mut Ui) {
|
fn render(&mut self, ctx: &Context, ui: &mut Ui) {
|
||||||
if self.enable {
|
if self.enable {
|
||||||
|
let font_id = ctx
|
||||||
|
.style()
|
||||||
|
.text_styles
|
||||||
|
.get(&TextStyle::Body)
|
||||||
|
.cloned()
|
||||||
|
.unwrap_or_else(FontId::default);
|
||||||
|
|
||||||
for output in self.output() {
|
for output in self.output() {
|
||||||
|
let mut layout_job = LayoutJob::simple(
|
||||||
|
egui_phosphor::regular::HARD_DRIVES.to_string(),
|
||||||
|
font_id.clone(),
|
||||||
|
ctx.style().visuals.selection.stroke.color,
|
||||||
|
100.0,
|
||||||
|
);
|
||||||
|
|
||||||
|
layout_job.append(
|
||||||
|
&output,
|
||||||
|
10.0,
|
||||||
|
TextFormat::simple(font_id.clone(), ctx.style().visuals.text_color()),
|
||||||
|
);
|
||||||
|
|
||||||
if ui
|
if ui
|
||||||
.add(
|
.add(
|
||||||
Label::new(format!(
|
Label::new(layout_job)
|
||||||
"{} {}",
|
.selectable(false)
|
||||||
egui_phosphor::regular::HARD_DRIVES,
|
.sense(Sense::click()),
|
||||||
output
|
|
||||||
))
|
|
||||||
.selectable(false)
|
|
||||||
.sense(Sense::click()),
|
|
||||||
)
|
)
|
||||||
.clicked()
|
.clicked()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
use crate::widget::BarWidget;
|
use crate::widget::BarWidget;
|
||||||
use crate::WIDGET_SPACING;
|
use crate::WIDGET_SPACING;
|
||||||
|
use eframe::egui::text::LayoutJob;
|
||||||
use eframe::egui::Context;
|
use eframe::egui::Context;
|
||||||
|
use eframe::egui::FontId;
|
||||||
use eframe::egui::Label;
|
use eframe::egui::Label;
|
||||||
use eframe::egui::Sense;
|
use eframe::egui::Sense;
|
||||||
|
use eframe::egui::TextFormat;
|
||||||
|
use eframe::egui::TextStyle;
|
||||||
use eframe::egui::Ui;
|
use eframe::egui::Ui;
|
||||||
use schemars::JsonSchema;
|
use schemars::JsonSchema;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
@@ -60,20 +64,41 @@ pub struct Time {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Time {
|
impl Time {
|
||||||
fn output(&mut self) -> Vec<String> {
|
fn output(&mut self) -> String {
|
||||||
vec![chrono::Local::now()
|
chrono::Local::now()
|
||||||
.format(&self.format.fmt_string())
|
.format(&self.format.fmt_string())
|
||||||
.to_string()]
|
.to_string()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl BarWidget for Time {
|
impl BarWidget for Time {
|
||||||
fn render(&mut self, _ctx: &Context, ui: &mut Ui) {
|
fn render(&mut self, ctx: &Context, ui: &mut Ui) {
|
||||||
if self.enable {
|
if self.enable {
|
||||||
for output in self.output() {
|
let output = self.output();
|
||||||
|
if !output.is_empty() {
|
||||||
|
let font_id = ctx
|
||||||
|
.style()
|
||||||
|
.text_styles
|
||||||
|
.get(&TextStyle::Body)
|
||||||
|
.cloned()
|
||||||
|
.unwrap_or_else(FontId::default);
|
||||||
|
|
||||||
|
let mut layout_job = LayoutJob::simple(
|
||||||
|
egui_phosphor::regular::CLOCK.to_string(),
|
||||||
|
font_id.clone(),
|
||||||
|
ctx.style().visuals.selection.stroke.color,
|
||||||
|
100.0,
|
||||||
|
);
|
||||||
|
|
||||||
|
layout_job.append(
|
||||||
|
&output,
|
||||||
|
10.0,
|
||||||
|
TextFormat::simple(font_id, ctx.style().visuals.text_color()),
|
||||||
|
);
|
||||||
|
|
||||||
if ui
|
if ui
|
||||||
.add(
|
.add(
|
||||||
Label::new(format!("{} {}", egui_phosphor::regular::CLOCK, output))
|
Label::new(layout_job)
|
||||||
.selectable(false)
|
.selectable(false)
|
||||||
.sense(Sense::click()),
|
.sense(Sense::click()),
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user