MCPcopy Create free account
hub / github.com/altic-dev/FluidVoice / systemSettingsWindowFrame

Method systemSettingsWindowFrame

Sources/Fluid/ContentView.swift:4016–4051  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4014 }
4015
4016 private func systemSettingsWindowFrame() -> NSRect? {
4017 guard let windowList = CGWindowListCopyWindowInfo(.optionOnScreenOnly, kCGNullWindowID) as? [[String: Any]] else {
4018 return nil
4019 }
4020
4021 for info in windowList {
4022 guard (info[kCGWindowOwnerName as String] as? String) == "System Settings",
4023 let bounds = info[kCGWindowBounds as String] as? [String: Any],
4024 let x = bounds["X"] as? CGFloat,
4025 let y = bounds["Y"] as? CGFloat,
4026 let width = bounds["Width"] as? CGFloat,
4027 let height = bounds["Height"] as? CGFloat,
4028 width > 0,
4029 height > 0
4030 else {
4031 continue
4032 }
4033
4034 for screen in NSScreen.screens {
4035 let convertedFrame = NSRect(
4036 x: x,
4037 y: screen.frame.maxY - y - height,
4038 width: width,
4039 height: height
4040 )
4041 if screen.frame.intersects(convertedFrame) {
4042 return convertedFrame
4043 }
4044 }
4045
4046 let convertedY = (NSScreen.main?.frame.maxY ?? 0) - y - height
4047 return NSRect(x: x, y: convertedY, width: width, height: height)
4048 }
4049
4050 return nil
4051 }
4052
4053 private func showAccessibilityGuidePanel(requestID: UUID) {
4054 DispatchQueue.main.asyncAfter(deadline: .now() + 0.65) {

Calls

no outgoing calls

Tested by

no test coverage detected