Skip to content

ZestProjects/MenuBarAppTemplate

Repository files navigation

A Menu Bar Application Template

Want to build a Menu Bar tool on macOS but don't know where to start? Give this template a try.

Where to start?

First, set your Menu Bar icon. You can use any NSImage for the icon, by default this template selects a symbol from SF Symbols.

Then, build your menu. By default, an About dialog (which additionally presents the contents of Credits.html) and a Quit button are added. Make sure to keep menu.removeAllItems() at the top of the menuNeedsUpdate() function otherwise you'll be appending menu items each time the menu is opened.

If you would like to add a seperator, use menu.addItem(NSMenuItem.separator()). For custom actions, add a selector method prefixed with @objc and a signature of sender: NSMenuItem to the MenuDelegate class.

Finally, add your application logic to AppDelegate. I reccomend adding a private function prefixed with build and appending it to applicationDidFinishLaunching(). You can utilise the MenuBarAppTemplateConfig class to easily get and set UserDefaults, including default options and overrides for DEBUG builds.

A few more things to do are to set your application icon, set the accent colour, and provide preview assets.

Have a look at some examples.

This template is used in Twenty³ and Screenshot2Clipboard (both coming soon).

A deep dive into the structure.

TBD

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published