diff --git a/LyricsX/Base.lproj/Main.storyboard b/LyricsX/Base.lproj/Main.storyboard index 3429fc34..4ae8b89f 100644 --- a/LyricsX/Base.lproj/Main.storyboard +++ b/LyricsX/Base.lproj/Main.storyboard @@ -258,6 +258,7 @@ + @@ -451,7 +452,7 @@ - + diff --git a/LyricsX/Component/AppDelegate.swift b/LyricsX/Component/AppDelegate.swift index 6854bb57..7d672c6c 100644 --- a/LyricsX/Component/AppDelegate.swift +++ b/LyricsX/Component/AppDelegate.swift @@ -26,6 +26,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSMenuItemValidation, NSMenu return NSApplication.shared.delegate as? AppDelegate } + @IBOutlet weak var lyricsOffsetView: NSView! @IBOutlet weak var lyricsOffsetTextField: NSTextField! @IBOutlet weak var lyricsOffsetStepper: NSStepper! @IBOutlet weak var statusBarMenu: NSMenu! @@ -140,6 +141,21 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSMenuItemValidation, NSMenu menu.item(withTag: 202)?.isEnabled = AppController.shared.currentLyrics != nil } + func menuWillOpen(_ menu: NSMenu) { + if #available(macOS 10.16, *) { + let menuHasOnState = statusBarMenu.items.filter { menuItem in + return menuItem.state == .on + }.count > 0 + + let lyricsOffsetConstraint = lyricsOffsetView.constraints.first(where: {$0.identifier == "lyricsOffsetConstraint"}) + + lyricsOffsetConstraint?.constant = 14 + if menuHasOnState { + lyricsOffsetConstraint?.constant += 10 + } + } + } + // MARK: - Menubar Action var lyricsHUD: NSWindowController?