--- src/bin/vrec-ui.rs +++ src/bin/vrec-ui.rs @@ -40,14 +40,10 @@ let receiver = GlobalHotKeyEvent::receiver(); loop { - if let Ok(event) = receiver.recv() { - if event.id == hotkey.id() { - if event.state == global_hotkey::HotKeyState::Pressed { - println!("Hotkey triggered! Sending SaveReplay command to daemon..."); - if let Err(e) = send_command(Command::SaveReplay) { - eprintln!("Failed to communicate with daemon: {}", e); - } else { - if env::var("XDG_SESSION_TYPE").unwrap_or_else(|_| "x11".to_string()).to_lowercase() != "wayland" { - vrec::overlay::show_saved_overlay(); - } - } - } - } - } + if let Ok(event) = receiver.recv() { + if event.id == hotkey.id() && event.state == global_hotkey::HotKeyState::Pressed { + println!("Hotkey triggered! Sending SaveReplay command to daemon..."); + if let Err(e) = send_command(Command::SaveReplay) { + eprintln!("Failed to communicate with daemon: {}", e); + } else { + if env::var("XDG_SESSION_TYPE").unwrap_or_else(|_| "x11".to_string()).to_lowercase() != "wayland" { + vrec::overlay::show_saved_overlay(); + } + } + } + } }