Created
February 14, 2020 00:27
-
-
Save DanielDe/6873a83499998461403a038f88986d4a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Cocoa | |
import SwiftUI | |
import AppKit | |
@NSApplicationMain | |
class AppDelegate: NSObject, NSApplicationDelegate { | |
var window: NSWindow! | |
func applicationDidFinishLaunching(_ aNotification: Notification) { | |
var axUIElement: AXUIElement? = nil | |
let copyElementResponse = AXUIElementCopyElementAtPosition( | |
AXUIElementCreateSystemWide(), | |
Float(NSScreen.screens.first!.frame.size.width + NSScreen.screens.last!.frame.size.width / 2), | |
Float(NSScreen.screens.last!.frame.size.height / 2), | |
&axUIElement | |
) | |
print("response: \(copyElementResponse)") | |
print("element: \(axUIElement)") | |
} | |
func applicationWillTerminate(_ aNotification: Notification) { | |
// Insert code here to tear down your application | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment