feat: initialize window ID on startup and batch keyboard subscription with additional event handling
This commit is contained in:
@@ -468,7 +468,13 @@ impl HcieIcedApp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
app.initialized = true;
|
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)
|
(app, init_task)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1817,7 +1823,7 @@ impl HcieIcedApp {
|
|||||||
/// - Ctrl+V: Paste
|
/// - Ctrl+V: Paste
|
||||||
/// - Escape: Close dialog
|
/// - Escape: Close dialog
|
||||||
pub fn subscription(&self) -> iced::Subscription<Message> {
|
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 ctrl = modifiers.control() || modifiers.logo();
|
||||||
let shift = modifiers.shift();
|
let shift = modifiers.shift();
|
||||||
|
|
||||||
@@ -1863,6 +1869,8 @@ impl HcieIcedApp {
|
|||||||
}
|
}
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
|
iced::Subscription::batch(vec![keyboard])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user