Extract the run-with-idle-timer boilerplate into a macro.