I often set my computer to doing calculations that are going to take a long time, and then leave the room and go do something else. The GNOME desktop's power manager only seems to pay attention to whether the keyboard and mouse have been touched recently when deciding whether to put the computer into sleep mode; so I have to come back periodically and poke a key, or the computer goes to sleep in the middle of the calculation. This makes it difficult to leave the house while it's running, or go to bed myself, when I know it's going to be several hours.
Is there any way (presumably by poking at stuff at a lower level than the GUI exposes) to tell it not to go into sleep mode unless all HID devices have been idle for time X (an hour, say) and CPU utilization has been less than Y% for time Z (say, five percent and five minutes)? That way it would finish the run and then put itself to bed till I come back.