From b8daa1b6eea3d75d720e959c3b9b1d5d57cfa747 Mon Sep 17 00:00:00 2001 From: Shinyzenith Date: Sun, 6 Mar 2022 18:56:51 +0530 Subject: [PATCH] [update] Exit on SIGINT ( Control + c ). --- README.md | 1 - src/daemon.rs | 13 +------------ 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/README.md b/README.md index 7209a71..9eafd41 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,6 @@ After opening swhkd, you can control the program through signals: - `sudo pkill -USR1 swhkd` - Pause key checking - `sudo pkill -USR2 swhkd` - Resume key checking - `sudo pkill -HUP swhkd` - Reload config file -- `sudo pkill -INT swhkd` - Pause key checking temporarily (resume by pressing `super+shift+escape`) ## Configuration diff --git a/src/daemon.rs b/src/daemon.rs index a89a807..d362eff 100644 --- a/src/daemon.rs +++ b/src/daemon.rs @@ -157,8 +157,6 @@ async fn main() -> Result<(), Box> { SIGSYS, SIGTERM, SIGTRAP, SIGTSTP, SIGVTALRM, SIGXCPU, SIGXFSZ, ])?; let mut paused = false; - let mut temp_paused = false; - let mut last_hotkey: Option = None; let mut keyboard_states: Vec = Vec::new(); let mut keyboard_stream_map = StreamMap::new(); @@ -201,7 +199,7 @@ async fn main() -> Result<(), Box> { hotkeys = load_config(); } SIGINT => { - temp_paused = true; + exit(1); } _ => { let keyboard_devices = evdev::enumerate().filter(check_keyboard); @@ -273,15 +271,6 @@ async fn main() -> Result<(), Box> { log::debug!("state_modifiers: {:#?}", keyboard_state.state_modifiers); log::debug!("state_keysyms: {:#?}", keyboard_state.state_keysyms); log::debug!("hotkey: {:#?}", possible_hotkeys); - if temp_paused { - if keyboard_state.state_modifiers.iter().all(|x| { - vec![config::Modifier::Shift, config::Modifier::Super].contains(x) - }) && keyboard_state.state_keysyms.contains(evdev::Key::KEY_ESC) - { - temp_paused = false; - } - continue; - } for hotkey in possible_hotkeys { // this should check if state_modifiers and hotkey.modifiers have the same elements