Skip to content

Commit 6046f14

Browse files
authored
Merge pull request #77 from waycrate/remove_temp_pause
[update] Exit on SIGINT ( Control + c ).
2 parents c36bd28 + 185dbd0 commit 6046f14

File tree

2 files changed

+2
-13
lines changed

2 files changed

+2
-13
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ After opening swhkd, you can control the program through signals:
4141
- `sudo pkill -USR1 swhkd` - Pause key checking
4242
- `sudo pkill -USR2 swhkd` - Resume key checking
4343
- `sudo pkill -HUP swhkd` - Reload config file
44-
- `sudo pkill -INT swhkd` - Pause key checking temporarily (resume by pressing `super+shift+escape`)
4544

4645
## Configuration
4746

src/daemon.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,6 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
157157
SIGSYS, SIGTERM, SIGTRAP, SIGTSTP, SIGVTALRM, SIGXCPU, SIGXFSZ,
158158
])?;
159159
let mut paused = false;
160-
let mut temp_paused = false;
161-
162160
let mut last_hotkey: Option<config::Hotkey> = None;
163161
let mut keyboard_states: Vec<KeyboardState> = Vec::new();
164162
let mut keyboard_stream_map = StreamMap::new();
@@ -200,7 +198,8 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
200198
hotkeys = load_config();
201199
}
202200
SIGINT => {
203-
temp_paused = true;
201+
log::warn!("Received SIGINT signal, exiting...");
202+
exit(1);
204203
}
205204
_ => {
206205
let keyboard_devices = evdev::enumerate().filter(check_keyboard);
@@ -272,15 +271,6 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
272271
log::debug!("state_modifiers: {:#?}", keyboard_state.state_modifiers);
273272
log::debug!("state_keysyms: {:#?}", keyboard_state.state_keysyms);
274273
log::debug!("hotkey: {:#?}", possible_hotkeys);
275-
if temp_paused {
276-
if keyboard_state.state_modifiers.iter().all(|x| {
277-
vec![config::Modifier::Shift, config::Modifier::Super].contains(x)
278-
}) && keyboard_state.state_keysyms.contains(evdev::Key::KEY_ESC)
279-
{
280-
temp_paused = false;
281-
}
282-
continue;
283-
}
284274

285275
for hotkey in possible_hotkeys {
286276
// this should check if state_modifiers and hotkey.modifiers have the same elements

0 commit comments

Comments
 (0)