@@ -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