From 58ff9e145e176a9df4268b2424a05135280abe85 Mon Sep 17 00:00:00 2001 From: Khoa Vo Date: Wed, 1 Jul 2026 16:01:15 +0700 Subject: [PATCH] fix: handle EINTR in evdev loop, silence SelectionRequest log spam --- daemon/src/main.rs | 11 ++++++++++- protocol/src/x11_inject.rs | 5 +---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/daemon/src/main.rs b/daemon/src/main.rs index 01a882e..0cfd143 100644 --- a/daemon/src/main.rs +++ b/daemon/src/main.rs @@ -1150,7 +1150,16 @@ fn run_with_evdev( .get_key_state() .ok() .unwrap_or_else(evdev::AttributeSet::new); - let events = device.fetch_events()?; + let events = match device.fetch_events() { + Ok(events) => events, + Err(e) => { + if e.kind() == std::io::ErrorKind::Interrupted { + // SIGINT/SIGTERM received — loop back to signal check + continue; + } + return Err(e.into()); + } + }; last_event_time = std::time::Instant::now(); // Check for status changes instantly diff --git a/protocol/src/x11_inject.rs b/protocol/src/x11_inject.rs index 2ad2371..367b575 100644 --- a/protocol/src/x11_inject.rs +++ b/protocol/src/x11_inject.rs @@ -312,10 +312,7 @@ impl X11Injector { } fn handle_selection_request(&self, req: &XSelectionRequestEvent) { - eprintln!( - "[vietc] SelectionRequest: target={} requestor={}", - req.target, req.requestor - ); + // Silently handle — SelectionRequest floods the log on X11 // Determine what property to use for the response let property = if req.property == 0 {