How can I detect if a plugin is selected?

Hi there,

When you move out of the plugin tab, a plugin deselects itself, and doesn’t fire the clicked event.
This means that the plugin’s gui is still shown, even with the plugin being deselected.
Is there a way to fix this?