I'm sorry I do not undertand what you mean by "flag".
By default you can define the input to open the inventory here:
But if you want to be able to open the Inventory only under certain conditions you can replace the "Display Panel Manager Handler" by a custom component.
If you check out the code you'll see we open panels like so: