There are a few ways to acomplish this but what I see is most common is to register a function in your addon with the event manager to be ran when the action layer is pushed, then check that the inventory frame (or whicher you like) is show, and lastly show your control window. You can also do the same to hide the window when done using the action layer popped event.
Lua Code:
EVENT_MANAGER:RegisterForEvent("youraddonpusheventname", EVENT_ACTION_LAYER_PUSHED, YourAddonPushFunction)
EVENT_MANAGER:RegisterForEvent("youraddonpusheventname", EVENT_ACTION_LAYER_POPPED, YourAddonPopFunction)