Initial commit

This commit is contained in:
冰朔 2026-08-20 00:01:53 +08:00
commit d5c932d8e1
710 changed files with 50282 additions and 0 deletions

17
.tmp_axprobe/hit.swift Executable file
View file

@ -0,0 +1,17 @@
import Cocoa
let px = Float(CommandLine.arguments[1])!, py = Float(CommandLine.arguments[2])!
let sw = AXUIElementCreateSystemWide()
var el: AXUIElement?
let r = AXUIElementCopyElementAtPosition(sw, px, py, &el)
print("hitResult=\(r.rawValue)")
if let el {
func attr(_ e: AXUIElement, _ a: String) -> String {
var v: CFTypeRef?
guard AXUIElementCopyAttributeValue(e, a as CFString, &v) == .success else { return "?" }
return "\(v!)"
}
print("role=\(attr(el, kAXRoleAttribute)) title=\(attr(el, kAXTitleAttribute)) desc=\(attr(el, kAXDescriptionAttribute))")
var pid: pid_t = 0; AXUIElementGetPid(el, &pid)
let owner = NSRunningApplication(processIdentifier: pid)?.localizedName ?? "?"
print("ownerPid=\(pid) owner=\(owner)")
}