!7 cmodule MonitorOffTimer > DynPrintLogAndEnabled { switchable double timeout = 60.0; // seconds transient new RestartableCountdown countdown; start { dm_restartOnFieldChange timeout(); dm_require("#1020622/UserActivityDetector"); startCountdown(); dm_vmBus_onMessage userActivityDetected(r startCountdown); } void bam enter { // determining whether monitor is on is difficult, so we just // turn it off every time the countdown expires if (enabled) monitorOff(); startCountdown(); } void startCountdown { countdown.start(max(timeout, 10.0), r bam); } }