Skip to content

Commit 7ea361a

Browse files
committed
Don't show SecureInputView if the current binding mode is empty
1 parent de1b21b commit 7ea361a

File tree

1 file changed

+14
-17
lines changed

1 file changed

+14
-17
lines changed

Sources/AppBundle/ui/SecureInputView.swift

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,20 @@ public final class SecureInputPanel: NSPanelHud {
1515

1616
@MainActor
1717
public func refresh() {
18-
lazy var isSecureInputEnabled = IsSecureEventInputEnabled()
19-
switch true {
20-
case isVisible && !TrayMenuModel.shared.isEnabled:
21-
close()
22-
case isSecureInputEnabled == isVisible:
23-
break
24-
case isSecureInputEnabled:
25-
self.contentView?.subviews.removeAll()
26-
hostingView = NSHostingView(rootView: SecureInputView())
27-
hostingView.frame = NSRect(x: 0, y: 0, width: iconSize.width, height: iconSize.height)
28-
self.contentView?.addSubview(hostingView)
29-
let x = mainMonitor.width - iconSize.width - 20
30-
let panelFrame = NSRect(x: x, y: 20, width: iconSize.width, height: iconSize.width)
31-
self.setFrame(panelFrame, display: true)
32-
self.orderFrontRegardless()
33-
default:
34-
close()
18+
if let activeMode, TrayMenuModel.shared.isEnabled &&
19+
config.modes[activeMode]?.bindings.isEmpty == false && IsSecureEventInputEnabled()
20+
{
21+
if isVisible { return }
22+
self.contentView?.subviews.removeAll()
23+
hostingView = NSHostingView(rootView: SecureInputView())
24+
hostingView.frame = NSRect(x: 0, y: 0, width: iconSize.width, height: iconSize.height)
25+
self.contentView?.addSubview(hostingView)
26+
let x = mainMonitor.width - iconSize.width - 20
27+
let panelFrame = NSRect(x: x, y: 20, width: iconSize.width, height: iconSize.width)
28+
self.setFrame(panelFrame, display: true)
29+
self.orderFrontRegardless()
30+
} else {
31+
close()
3532
}
3633
}
3734

0 commit comments

Comments
 (0)