feat: initialize window ID on startup and batch keyboard subscription with additional event handling

This commit is contained in:
2026-07-12 03:59:24 +03:00
parent 266183a7ff
commit a70bedd6bb
+11 -3
View File
@@ -468,7 +468,13 @@ impl HcieIcedApp {
}
app.initialized = true;
let init_task = Task::none();
let init_task = iced::window::get_oldest().map(|opt_id| {
if let Some(id) = opt_id {
Message::WindowId(id)
} else {
Message::NoOp
}
});
(app, init_task)
}
@@ -1817,7 +1823,7 @@ impl HcieIcedApp {
/// - Ctrl+V: Paste
/// - Escape: Close dialog
pub fn subscription(&self) -> iced::Subscription<Message> {
iced::keyboard::on_key_press(|key, modifiers| {
let keyboard = iced::keyboard::on_key_press(|key, modifiers| {
let ctrl = modifiers.control() || modifiers.logo();
let shift = modifiers.shift();
@@ -1863,6 +1869,8 @@ impl HcieIcedApp {
}
_ => None,
}
})
});
iced::Subscription::batch(vec![keyboard])
}
}