You would like to customize the behavior of built-in Integrity buttons: You can't, really, although there are a limited number of client side triggers that might be helpful.
Activate custom buttons: This is possible, and there are context dependent environment variables that are available. The only documentation I could find in a quick search was this: