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:
+8
-2
@@ -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}"))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user