When the phone is docked onto a desk dock, the silent ringtone mode is activated.
When the phone is docked onto a car dock, the normal ringtone mode is activated.
When the phone is undocked from any dock, the previous ringtone mode is restored.
Only tested with the Google Nexus One, the Samsung Galaxy Nexus and their official Desk and Car docks.
Free software (GPL v3+).
Needs "OI About" for "About" dialog.
Feel free to send suggestions by email.