jD91mZM2 / xidlehook

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

Timer issue #6

Closed dbrgn closed 6 years ago

dbrgn commented 6 years ago

For testing, I used this command:

xidlehook \
     --time 1 \
     --timer 'xrandr --output DP-2 --brightness 1; xrandr --output DP-3 --brightness 1; slock' \
     --notify 10 \
     --notifier 'xrandr --output DP-2 --brightness .5; xrandr --output DP-3 --brightness .5' \
     --canceller 'xrandr --output DP-2 --brightness 1; xrandr --output DP-3 --brightness 1' \
     --not-when-fullscreen

Then I ran watch -n 1 xidlehook --print. I could observe that the notifier triggered after about 80s of idle time, and the timer 10 seconds later.

Is it expected that the timer is very inaccurate?

jD91mZM2 commented 6 years ago

It is, unfortunately. The way xidlehook works is that it queries the idle time every once in a while - something we don't want to do too often. So currently it only checks once every minute if the idle time is more than or equal to the specified amount, which it only became at 80s. The notifier is guaranteed to be accurate to the second though, which is why it purposely delayed the timer to 90s, so the notifier got the time it wanted.

dbrgn commented 6 years ago

Ok. That's fine for me, but should probably be mentioned in the README :slightly_smiling_face:

jD91mZM2 commented 6 years ago

Timers will now support second precision in https://gitlab.com/jD91mZM2/xidlehook/merge_requests/5 :smile: