You can use the NSMenuDelegate protocol to process menuWillOpen and menuWillClose . Use menuWillOpen to set a boolean indicating that the menu is open, and menuWillClose to disable it.
Update: It seems that menuWillClose: no longer an available delegation method. Use menuDidClose: .
source share