Skip to content

Commit

Permalink
add kanata to known event devices to listen to
Browse files Browse the repository at this point in the history
  • Loading branch information
mhantsch committed Sep 10, 2024
1 parent 2cec0ef commit f6185c7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,9 @@ fn main() -> anyhow::Result<()> {
for (path, mut device) in evdev::enumerate() {
// Filter devices so that only the Framework's builtin touchpad and keyboard are listened
// to. Since we don't support hotplug, listening on USB devices wouldn't work reliably.
//log::info!("checking device {:#?}", device.name());
match device.name() {
Some("PIXA3854:00 093A:0274 Touchpad" | "AT Translated Set 2 keyboard" | "keyd virtual keyboard" ) => {
Some("PIXA3854:00 093A:0274 Touchpad" | "AT Translated Set 2 keyboard" | "keyd virtual keyboard" | "kanata" ) => {
let act = act.clone();
thread::spawn(move || -> io::Result<()> {
let name = device.name();
Expand Down Expand Up @@ -131,12 +132,13 @@ fn main() -> anyhow::Result<()> {
loop {
let guard = act.last_activity.lock().unwrap();
let last = *guard;
let (_, result) = act
let (unneeded, result) = act
.condvar
.wait_timeout_while(guard, Duration::from_secs(args.timeout.into()), |instant| {
*instant == last
})
.unwrap();
drop(unneeded);
let new_state = !result.timed_out();
if state != Some(new_state) {
log::info!("activity state changed: {state:?} -> {new_state}");
Expand Down

0 comments on commit f6185c7

Please sign in to comment.