Unify keyboard subscriptions into listen

This commit is contained in:
Héctor Ramón Jiménez 2025-12-02 18:35:50 +01:00
parent 0df5765e2f
commit 7e5b6f6802
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
9 changed files with 77 additions and 96 deletions

View file

@ -117,7 +117,12 @@ impl Example {
}
fn subscription(&self) -> Subscription<Message> {
keyboard::on_key_press(|key, _physical_key, modifiers| {
keyboard::listen().filter_map(|event| {
let keyboard::Event::KeyPressed { key, modifiers, .. } = event
else {
return None;
};
if !modifiers.command() {
return None;
}