macOS Menu Bar App Generator
Build a complete macOS menu bar (status bar) app with SwiftUI, including popover UI, keyboard shortcuts, and launch-at-login support.
Prompt Template
You are an expert macOS developer. Help me build a menu bar (status bar) app for macOS using SwiftUI. **App Purpose:** [e.g., "A clipboard history manager" or "A quick note-taking widget"] **What the popover should show:** [describe the UI that appears when clicking the menu bar icon] **Key Features:** - [Feature 1] - [Feature 2] - [Feature 3] **Global Hotkey:** [optional — e.g., "⌘⇧V to toggle the popover"] **Persistent Data:** [what needs to be saved between launches] **Background Tasks:** [any monitoring, polling, or event listening needed] Please provide: 1. **App entry point** — @main struct using MenuBarExtra (macOS 13+) with .window or .popover style 2. **Menu bar icon** — SF Symbol choice + dynamic states (e.g., different icon when active) 3. **Popover/window view** — full SwiftUI view with proper sizing and styling 4. **Data persistence** — UserDefaults, SwiftData, or file-based as appropriate 5. **Launch at Login** — using SMAppService (macOS 13+) 6. **Global keyboard shortcut** registration (if requested) 7. **Proper lifecycle** — handle popover show/hide, app activation without dock icon 8. **Info.plist** settings — LSUIElement for hiding dock icon, any required entitlements 9. **Complete working code** — should compile and run as-is in a new Xcode project
Example Output
import SwiftUI
import ServiceManagement
@main
struct ClipboardHistoryApp: App {
@State private var clipboardItems: [ClipItem] = []
var body: some Scene {
MenuBarExtra {
ClipboardPopoverView(items: $clipboardItems)
.frame(width: 320, height: 420)
} label: {
Label("Clipboard", systemImage: clipboardItems.isEmpty ? "clipboard" : "clipboard.fill")
}
.menuBarExtraStyle(.window)
Settings {
SettingsView()
}
}
}
struct ClipboardPopoverView: View {
@Binding var items: [ClipItem]
@State private var searchText = ""
var body: some View {
VStack(spacing: 0) {
HStack {
Image(systemName: "magnifyingglass")
.foregroundStyle(.secondary)
TextField("Search clips...", text: $searchText)
.textFieldStyle(.plain)
}
.padding(10)
.background(.bar)
Divider()
List(filteredItems) { item in
ClipRow(item: item)
.onTapGesture { paste(item) }
}
.listStyle(.plain)
Divider()
HStack {
Text("\(items.count) clips")
.font(.caption)
.foregroundStyle(.secondary)
Spacer()
Button("Clear All", role: .destructive) {
items.removeAll()
}
.buttonStyle(.plain)
.font(.caption)
}
.padding(8)
.background(.bar)
}
}
}
Info.plist:
<key>LSUIElement</key>
<true/> <!-- Hides dock icon -->
Launch at Login:
try SMAppService.mainApp.register() // Enable
try SMAppService.mainApp.unregister() // Disable
Tips for Best Results
- 💡Use MenuBarExtra with .window style for rich UI, or .menu style for simple dropdown menus
- 💡Set LSUIElement = YES in Info.plist to hide the dock icon
- 💡For global hotkeys, consider the HotKey Swift package or Carbon API via CGEvent
- 💡Test with multiple displays — menu bar apps need to handle screen changes
Frequently Asked Questions
What is the macOS Menu Bar App Generator prompt?
Build a complete macOS menu bar (status bar) app with SwiftUI, including popover UI, keyboard shortcuts, and launch-at-login support. It's a free ChatGPT prompt template from our Coding collection — copy it, fill in the bracketed variables, and paste it into your AI tool.
Which AI tools work with this prompt?
It's written and tested for ChatGPT, Claude and Gemini. Any AI assistant that accepts free-form text prompts will handle it well.
How do I customize this ChatGPT prompt?
Replace the bracketed variables — such as [Feature 1], [Feature 2], [Feature 3] — with your own details before running it. Use MenuBarExtra with .window style for rich UI, or .menu style for simple dropdown menus
Is this prompt free to use?
Yes. Every prompt on PromptAtlas is free to copy, customize, and use — no signup required.
Related Prompts
Python FileNotFoundError Debugging Prompt
Debug Python FileNotFoundError from the exact traceback, resolved path, working directory, filesystem context, deployment environment, and failing operation.
Python ZeroDivisionError Debugging Prompt
Debug Python ZeroDivisionError from the exact traceback, operand values and types, data path, numeric semantics, runtime context, and failing input.
Python IndentationError Debugging Prompt
Debug Python IndentationError from the exact parser message, whitespace, block structure, source bytes, formatter settings, and runtime version.
Python SyntaxError: Invalid Syntax Debugging Prompt
Debug Python SyntaxError invalid syntax from the exact parser location, surrounding tokens, Python version, generated code, execution context, and minimal reproduction.
Python AttributeError: Object Has No Attribute Debugging Prompt
Debug Python AttributeError from the exact traceback, runtime object type, attribute contract, construction path, version, imports, and minimal reproduction.
Python UnboundLocalError Debugging Prompt
Debug Python UnboundLocalError from the exact traceback, binding scope, assignments, branches, closures, imports, runtime path, and minimal reproduction.