fix(gui): load Bootstrap Icons font via Task instead of builder

The .font() builder method was silently failing to register the font
for named lookup. Using iced::font::load() as a startup Task ensures
the font is properly loaded before any text rendering occurs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
funman300
2026-04-18 23:34:22 -07:00
parent 108f385973
commit 0c22e23ad3
+8 -2
View File
@@ -12,6 +12,7 @@ use std::time::Duration;
#[derive(Debug, Clone)]
pub enum Message {
FontLoaded,
PollProcesses,
ReloadConfig,
AddLauncher,
@@ -123,6 +124,7 @@ impl Dashboard {
fn update(state: &mut Dashboard, msg: Message) -> Task<Message> {
match msg {
Message::FontLoaded => Task::none(),
Message::PollProcesses => {
for l in &state.config.launchers {
state.running.insert(l.name.clone(), launcher::is_running(l));
@@ -1168,11 +1170,15 @@ pub fn run(config: &Config) -> Result<()> {
iced::application(|_: &Dashboard| String::from("umutray"), update, view)
.subscription(subscription)
.theme(|_| Theme::Dark)
.font(iced_fonts::BOOTSTRAP_FONT_BYTES)
.window(iced::window::Settings {
size: iced::Size::new(600.0, 560.0),
..Default::default()
})
.run_with(move || (Dashboard::new(config.clone()), Task::none()))
.run_with(move || {
let cfg = config.clone();
let load_font = iced::font::load(std::borrow::Cow::Borrowed(iced_fonts::BOOTSTRAP_FONT_BYTES)).map(|_| Message::FontLoaded);
(Dashboard::new(cfg), load_font)
})
.map_err(|e| anyhow::anyhow!("iced: {e}"))
}