You can have a single OnKeystroke trigger for the whole layout. Just make sure to return True for the actual event to proceed normally. Note that at the moment for the first keystroke the open state is still 0, so you'll have to set it manually.
This won't work for certain editing actions, like drag and drop, although they're rare.
Hmmm, you could use Install OnTimerScript to perform a script every few minutes. That script could use your get funciton to check the current record's state and update a variable to cause conditional formatting to produce a color or other appearance change. (You could actually cause layout text that reads "Record Not Saved" to appear when the script sets the value of the variable.