This is an attempt to improve the behaviour of notifications that are triggered while the session is idle. This is related to (but not fixing) Bug 378032.
Notifications that are triggered while the session is idle might be missed by the user. With these changes, notifications will be shown again when the session resumes from idle.
This behaviour might be controversial. A history of notifications seems to be unwanted. I tried to find a way to make missing important notifications less likely while not annoying the user too much.