How to detect which tab is focused

I was wondering is there a way to detect which of my tabbed windows is currently up front and showing. Like If I have my Inspector window and a custom window tabbed together in the same area and I have the custom window showing and the inspector isn’t…is there a way in code to tell?

You can detect if your editor window is open via OnEnable. If you switch to the Inspector tab and your window disappears as a result, it will call OnDisable.

You can check what the currently focused window is via EditorWindow.focusedWindow.

does not work, enable fires but disable never does until you close the tab… not switching to another