diff --git a/AppDelegate.swift b/AppDelegate.swift index d64b55a..6d05bc1 100644 --- a/AppDelegate.swift +++ b/AppDelegate.swift @@ -26,9 +26,10 @@ class AppDelegate: NSObject, NSApplicationDelegate { statusItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.variableLength) if let button = statusItem?.button { - button.title = "🤡" button.target = self button.action = #selector(toggleMenu) + button.imagePosition = .imageLeft + updateStatusBarIcon() } setupMenu() @@ -151,9 +152,19 @@ class AppDelegate: NSObject, NSApplicationDelegate { playPauseItem.title = playerManager.isPlaying ? NSLocalizedString("Pause", comment: "") : NSLocalizedString("Play", comment: "") } + updateStatusBarIcon() updatePlayModeMenuItems() } + private func updateStatusBarIcon() { + if let button = statusItem?.button { + let configuration = NSImage.SymbolConfiguration(pointSize: 18, weight: .regular) + let symbolName = playerManager.isPlaying ? "headphones.circle.fill" : "headphones.circle" + let icon = NSImage(systemSymbolName: symbolName, accessibilityDescription: "Music")?.withSymbolConfiguration(configuration) + button.image = icon + } + } + @objc func togglePlayPause() { if playerManager.isPlaying { playerManager.pause() diff --git a/MacMusicPlayer/Assets.xcassets/AppIcon.appiconset/Contents.json b/MacMusicPlayer/Assets.xcassets/AppIcon.appiconset/Contents.json index 3f00db4..37153e4 100644 --- a/MacMusicPlayer/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/MacMusicPlayer/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -46,6 +46,7 @@ "size" : "512x512" }, { + "filename" : "music-good.png", "idiom" : "mac", "scale" : "2x", "size" : "512x512" diff --git a/MacMusicPlayer/Assets.xcassets/AppIcon.appiconset/music-good.png b/MacMusicPlayer/Assets.xcassets/AppIcon.appiconset/music-good.png new file mode 100644 index 0000000..484024b Binary files /dev/null and b/MacMusicPlayer/Assets.xcassets/AppIcon.appiconset/music-good.png differ