macos-menubar-app
Skill12 starsChanged 6 days agoMITView on GitHub
Expert in building macOS menu bar applications with SwiftUI, MenuBarExtra, and system integration. Use for menu bar UI patterns, status items, popover windows, keyboard shortcuts, and macOS-specific APIs.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- jaskirat1616/grok-skillstheir own version, first seen Nov 1, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- jaskirat1616/grok-skills★ 22same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository5 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- add-providerSkill
- verify-meterbarSkill
- xcode-swift-devSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 4 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 294
Keep the popover lightweight and fast to open
- Distinctive: line 295
Use system colors for automatic dark/light mode support
- Distinctive: line 297
Test with different menu bar densities
- Distinctive: line 299
Consider "Reduce motion" accessibility setting
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
macOS Menu Bar App Expert
Specialized guidance for macOS menu bar applications using SwiftUI.
When to Use
- Building menu bar-only apps (no dock icon)
- Creating status item with popover or menu
- Implementing keyboard shortcuts
- System tray integrations
- Background app functionality
- Login item configuration
App Configuration
Info.plist Settings
<!-- Hide dock icon -->
<key>LSUIElement</key>
<true/>
<!-- App category -->
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>MenuBarExtra Styles
// Window style - shows popover
MenuBarExtra("Title", systemImage: "icon") {
ContentView()
}
.menuBarExtraStyle(.window)
// Menu style - shows traditional menu
MenuBarExtra("Title", systemImage: "icon") {
Button("Action") { }
Divider()
Button("Quit") { NSApp.terminate(nil) }
}
.menuBarExtraStyle(.menu)Common Patterns
App Delegate for System Events
class AppDelegate: NSObject, NSApplicationDelegate {
func applicationDidFinishLaunching(_ notification: Notification) {
// Setup on launch
}
func applicationWillTerminate(_ notification: Notification) {
// Cleanup
}
func applicationShouldHandleReopen(_ sender: NSApplication,
hasVisibleWindows flag: Bool) -> Bool {
// Handle dock icon click if visible
return true
}
}Settings Window
@main
struct MyApp: App {
var body: some Scene {
MenuBarExtra { ... }
Settings {
SettingsView()
}
}
}
// Open settings programmatically
NSApp.sendAction(Selector(("showSettingsWindow:")), to: nil, from: nil)
// Or for older macOS:
if #available(macOS 14.0, *) {
NSApp.sendAction(Selector(("showSettingsWindow:")), to: nil, from: nil)
} else {
NSApp.sendAction(Selector(("showPreferencesWindow:")), to: nil, from: nil)
}Keyboard Shortcuts (Global Hotkeys)
import Carbon
class HotkeyManager {
private var hotKeyRef: EventHotKeyRef?
func registerHotkey() {
var hotKeyID = EventHotKeyID()
hotKeyID.signature = OSType("htky".fourCharCode)
hotKeyID.id = 1
// Cmd + Shift + U
RegisterEventHotKey(
UInt32(kVK_ANSI_U),
UInt32(cmdKey | shiftKey),
hotKeyID,
GetApplicationEventTarget(),
0,
&hotKeyRef
)
}
}Login Item (Launch at Login)
import ServiceManagement
func setLaunchAtLogin(_ enabled: Bool) {
if #available(macOS 13.0, *) {
do {
if enabled {
try SMAppService.mainApp.register()
} else {
try SMAppService.mainApp.unregister()
}
} catch {
print("Failed to set login item: \(error)")
}
}
}
var isLaunchAtLoginEnabled: Bool {
if #available(macOS 13.0, *) {
return SMAppService.mainApp.status == .enabled
}
return false
}Timer-Based Updates
@Observable
class UsageMonitor {
private var timer: Timer?
func startMonitoring() {
timer = Timer.scheduledTimer(withTimeInterval: 60, repeats: true) { [weak self] _ in
Task { await self?.refreshData() }
}
RunLoop.current.add(timer!, forMode: .common)
}
func stopMonitoring() {
timer?.invalidate()
timer = nil
}
@MainActor
private func refreshData() async {
// Update data
}
}Menu Bar Icon with State
MenuBarExtra {
ContentView()
} label: {
if isActive {
Image(systemName: "chart.bar.fill")
.foregroundStyle(.green)
} else {
Image(systemName: "chart.bar")
}
}Widget Integration
App Groups for Data Sharing
- Enable App Groups capability in both app and widget targets
- Use shared UserDefaults:
let sharedDefaults = UserDefaults(suiteName: "group.com.company.app")!- Share data:
// In main app
sharedDefaults.set(encodedData, forKey: "widgetData")
WidgetCenter.shared.reloadAllTimelines()
// In widget
let data = sharedDefaults.data(forKey: "widgetData")UI Patterns
Consistent Styling
struct MenuBarView: View {
var body: some View {
VStack(alignment: .leading, spacing: 12) {
// Header
HStack {
Text("App Name")
.font(.headline)
Spacer()
Button(action: openSettings) {
Image(systemName: "gear")
}
.buttonStyle(.plain)
}
Divider()
// Content
ForEach(items) { item in
ItemRow(item: item)
}
Divider()
// Footer
HStack {
Button("Refresh") { refresh() }
Spacer()
Button("Quit") { NSApp.terminate(nil) }
}
.font(.caption)
}
.padding()
.frame(width: 280)
}
}Progress Indicators
struct UsageBar: View {
let current: Double
let limit: Double
var percentage: Double {
guard limit > 0 else { return 0 }
return min(current / limit, 1.0)
}
var color: Color {
switch percentage {
case 0..<0.5: return .green
case 0.5..<0.8: return .yellow
default: return .red
}
}
var body: some View {
GeometryReader { geometry in
ZStack(alignment: .leading) {
RoundedRectangle(cornerRadius: 4)
.fill(Color.secondary.opacity(0.2))
RoundedRectangle(cornerRadius: 4)
.fill(color)
.frame(width: geometry.size.width * percentage)
}
}
.frame(height: 8)
}
}Best Practices
- Keep the popover lightweight and fast to open
- Use system colors for automatic dark/light mode support
- Respect user's accent color with
.tint(.accentColor) - Test with different menu bar densities
- Handle notch on newer MacBooks (menu bar space is limited)
- Consider "Reduce motion" accessibility setting
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

