jD91mZM2 / xidlehook

GitLab: https://gitlab.com/jD91mZM2/xidlehook
MIT License
382 stars 33 forks source link

Toggling the disabled flag doesn't reset the timer #58

Closed blubber closed 3 years ago

blubber commented 3 years ago

If you enable a previously disabled timer with xidlehook-client control --action enable --timer 0 it doesn't reset the timer. This results in unexpected behavior, where enabling doesn't actually cause the timer to trigger until the user becomes active again.

For example, I have a timer at index 2 that suspends my system. During office hours I have a script to disable this specific timer, to prevent my system from going to sleep. After office hours a cronjob enables the timer again (set for 1200s), but the timer doesn't trigger if the system was already idle when the cronjob ran.

The solution seems quite simple unless I'm missing something. Resetting the timer after toggling the disabled flag should do the trick.

jD91mZM2 commented 3 years ago

In latest master, I added the subcommands reset-idle and stop-timers to xidlehook-client. Simply running the former should do the trick :)

blubber commented 3 years ago

Again, very cool. Thanks!