jD91mZM2/xidlehook

Toggling the disabled flag doesn't reset the timer

Closed this issue · 2 comments

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.

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

Again, very cool. Thanks!