that one is easy, UPDATE_DELAYED_GCODE should do the trick. I do some similar stuff for a Case-Fan which gets turned off delayed after a print finished.
reset the timer for Macro A and do Macro B whenever the user makes any Input to the UI (every Button-Press, every klick on the Printers LCD etc.)
for that “reset timer” functionality I know that this is possible as I also do this in my delayed-fan function
But the first part (user interaction detection) I’m not sure if this is actually possible. At least I couldn’t think of any way.
OIK, as far as I can tell this would not allow to recreate the desired effect, because the [idle_timeout] “timer-reset” is only performed when a actual CGODE is processed. Not when the user is touching a button.
Also, there is no event fired in to “disable” the timeout. (e.g. when the user is pressing a button)
So If I’m not mistaken, [idle_timeout] is intended to be a security-feature to turn off any heaters when the printer is just not doing anything physical.
It does not tie to the user input things (take “upload a gcode” for example or “browsing the Klipper-Screen”)