jD91mZM2 / xidlehook

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

Make PID of the timer process available to the canceller #63

Closed wavexx closed 3 years ago

wavexx commented 3 years ago

It would be nice to be able to have the PID of the started timer process (if still running) in the canceller through an environment variable.

For example:

xidlehook --timer 10 \
  'sleep 100' \
  'test -n $XIDLEHOOK_TIMER_PID && kill $XIDLEHOOK_TIMER_PID'

Assuming sleep 100 is still running when the canceller is run, we populate the variable so that's possible to easily kill the timer process without having to keep track of it exernally.

jD91mZM2 commented 3 years ago

Note: Having a canceller/abort command means xidlehook will ping for activity every second. This is currently not configurable. The reason for this is of course because the user could become idle at any point and xidlehook needs to trigger that timer ASAP. Example: timer dims the screen, canceller undims it.

jD91mZM2 commented 3 years ago

Fixed :smile:

wavexx commented 3 years ago

Maybe we should reopen this until https://github.com/jD91mZM2/xidlehook/commit/fd0a269da9f0b85944ffb4ec0f699cede604ff6d#commitcomment-48445324 is addressed. This is something I was mentioning here, since without proper tracking this is no better than using an external pid file..