Skip to content

Commit

Permalink
Prevent appearance panels from showing when the menu bar is invisible
Browse files Browse the repository at this point in the history
Fixes issue #7
  • Loading branch information
jordanbaird committed Feb 5, 2024
1 parent 7038583 commit cea3d46
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions Ice/MenuBar/MenuBarAppearancePanel/MenuBarAppearancePanel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,23 @@ class MenuBarAppearancePanel: NSPanel {
.publisher(for: NSWorkspace.activeSpaceDidChangeNotification)
.receive(on: DispatchQueue.main)
.sink { [weak self] _ in
guard let self else {
guard
let self,
let screen = NSScreen.main
else {
return
}

// cache isVisible before hiding
let isVisible = isVisible

hide()
if isVisible {

// if the screen's visible frame and frame are the same,
// the menu bar is hidden; do not allow the panel to show
let canShow = screen.visibleFrame != screen.frame

if canShow && isVisible {
show()
}
}
Expand Down

0 comments on commit cea3d46

Please sign in to comment.