Enable /Disable Custom Menu Item

I have created Custome Menu “Custom Menu Item” Under Action Main Menu through a Agent.

I want to disable the Menu when the User not in Mail View and enable when the user opens Mail View.

I know one way is comparing current view with “$inbox” if it is not warn user to goto Mail view and then select the Menu item.

Instead of that if I am able to disable/enable it will look like native action.

Will any one implemented the same or have idea?

Subject: Enable /Disable Custom Menu Item

If you are actually adding an agent to the mail file, you are already modifying the mail design, so why not just make this a View Action called from the Inbox? That way you won’t have to try to figure out the view/folder.