Automatically switch to brush tool when brush selector or eraser is clicked

My plugin Shortcut Composer does that.

Its eraser and custom brush pickers switch to freehand brush tool when activated, but only from tools that cannot be used for painting.