jD91mZM2 / xidlehook

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

--not-when-cpu-busy #24

Closed cyplo closed 4 years ago

cyplo commented 5 years ago

Hi ! I love the project, thank you for that :)

I was thinking about a feature I would love to have - --not-when-cpu-busy or something similar. It would only execute the command when cpu average is below some percentage. What do you think ?

If this seems like a good idea - I may have a PR for that some time in the future, but also feel free to pick this up whenever if someone wants :)

thanks again !

jD91mZM2 commented 5 years ago

I wouldn't use it personally but if you see a use-case for this, feel free to PR (or wait long enough for me to find time to add this)

cyplo commented 5 years ago

Thanks for that :) My usecase is I would like to leave the laptop unattended while compiling but want for it to go to sleep when done.

rschmukler commented 5 years ago

@cyplo take a look at my newly released utility caffeinate which might work for your use case. Namely you could likely wire it up to the pid of your compilation process:

caffeinate --pid <compilation_process_pid> --quit=sleep
jD91mZM2 commented 4 years ago

xidlehook has been rewritten to be a library (see !6). This lets you register any kind of timer using traits. Feel free to PR something that adds such a module, extend xidlehook yourself using the awesome library system. Or just use caffeinate :)