Activate MIDI mapping mode from within patcher

due_friday's icon

Hi, I can't figure out if it is possible to activate MIDI mapping mode from within the patcher. I would like to make my own UI and not rely on the toolbar (where the keyboard button on the bottom does the job).
If anyone can help me, or confirm that this is indeed impossible, that would be very helpful, thanks!

due_friday's icon

Alright, I found the [mappings] object, which does what I was looking for. But I don't know how to detect if the user has exited MIDI mapping mode using the Escape key, for example. Is there any good way to detect this?