Skip to content
Khoa Pham@onmyway133

How to handle when menu is about to open in macOS

1 min read

NSMenuDelegate

https://developer.apple.com/documentation/appkit/nsmenudelegate

Invoked when a menu is about to open.

let statusItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.squareLength)
let menu = NSMenu()

menu.delegate = self

func menuWillOpen(_ menu: NSMenu) {
    updateMenu()
}

Type to search titles and full text.

↑ ↓ move↵ openPagefind