Skip to content

Commit

Permalink
fix: replace listen with grab
Browse files Browse the repository at this point in the history
  • Loading branch information
decipher3114 committed Oct 1, 2024
1 parent 088fa3b commit 01a9905
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/utils/key_listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use iced::{
futures::{SinkExt, Stream},
stream,
};
use rdev::{listen, EventType, Key};
use rdev::{grab, EventType, Key};
use tokio::sync::mpsc::channel;

use crate::entities::app::AppEvent;
Expand All @@ -12,8 +12,9 @@ pub fn global_key_listener() -> impl Stream<Item = AppEvent> {
let (sender, mut receiver) = channel(10);

std::thread::spawn(move || {
listen(move |event| {
sender.blocking_send(event.clone()).unwrap();
grab(move |event| {
sender.blocking_send(event.clone()).ok();
Some(event)
})
.unwrap()
});
Expand Down

0 comments on commit 01a9905

Please sign in to comment.