There might be a plugin that can detect user activity…something that could provide you a sense of if the user has been active or not for some specified duration. I’d imagine somebody might have thrown something like that together.
If not, I assume this is a simple javascript (I don’t know javascript, but have found there are a lot of ready made scripts for seemingly difficult tasks), and that you could find a plugin developer to build a plugin for you…also, if you found the script you could try to use some free plugins like toolbox that allow you to run javascript in a workflow.