Skip to content
HN On Hacker News ↗

Unlag Neo: Macbook Neo Cursor lag "fix"

▲ 229 points 105 comments by retroplasma 2w ago HN discussion ↗

Pangram verdict · v3.3

We believe that this document is fully human-written

2 %

AI likelihood · overall

Human
100% human-written 0% AI-generated
SEGMENTS · HUMAN 5 of 5
SEGMENTS · AI 0 of 5
WORD COUNT 447
PEAK AI % 3% · §5
Analyzed
Jun 24
backend: pangram/v3.3
Segments scanned
5 windows
avg 89 words each
Distribution
100 / 0%
human / AI fraction
Verdict
Human
Pangram v3.3

Article text · 447 words · 5 segments analyzed

Human AI-generated
§1 Human · 1%

#!/bin/bash set -Efeuxo pipefail

APP="Unlag Neo" DISPLAY_NAME="Unlag Neo"

if [ -e "${APP}.app" ]; then echo "Error: ${APP}.app exists already" exit 1 fi

mkdir -vp "${APP}.app/Contents/MacOS" "${APP}.app/Contents/Resources" PATH="$PATH:/usr/libexec"

swiftc - -o "${APP}.app/Contents/MacOS/${APP}" <<'SWIFT' import Foundation import AppKit import CoreGraphics import CoreMedia import ServiceManagement import ApplicationServices @preconcurrency import ScreenCaptureKit struct CaptureError: Error, CustomStringConvertible { let description: String init(_ description: String) { self.description = description } } @MainActor var showedPermissionAlert = false @MainActor var showedAccessibilityAlert = false @MainActor func relaunchUnlag() { let isApp = Bundle.main.bundlePath.hasSuffix(".app") let target = isApp ? Bundle.main.bundlePath : (Bundle.main.executablePath ??

§2 Human · 2%

Bundle.main.bundlePath) let p = Process() p.executableURL = URL(fileURLWithPath: "/bin/sh") p.arguments = ["-c", isApp ? "sleep 0.5; /usr/bin/open \"$1\"" : "sleep 0.5; \"$1\" >/dev/null 2>&1 &", "sh", target] try? p.run() NSApp.terminate(nil) } @MainActor func openScreenRecordingSettings() { NSWorkspace.shared.open(URL(string: "x-apple.systempreferences:com.apple.preference.security?Privacy_ScreenCapture")!) } @MainActor func openAccessibilitySettings() { NSWorkspace.shared.open(URL(string: "x-apple.systempreferences:com.apple.preference.security?Privacy_Accessibility")!) } @MainActor func showPermissionAlert() { NSApp.activate(ignoringOtherApps: true) let a = NSAlert() a.alertStyle = .warning a.messageText = "Screen Recording Permission Needed" a.informativeText = "Give Screen Recording permission in System Settings, then restart Unlag Neo."

§3 Human · 2%

a.addButton(withTitle: "Open Settings") a.addButton(withTitle: "Restart Unlag Neo") a.addButton(withTitle: "Quit Unlag Neo") switch a.runModal() { case .alertFirstButtonReturn: openScreenRecordingSettings() let b = NSAlert() b.alertStyle = .informational b.messageText = "Restart Unlag Neo After Permission" b.informativeText = "After enabling Screen Recording permission, restart Unlag Neo." b.addButton(withTitle: "Restart Unlag Neo") b.addButton(withTitle: "Quit Unlag Neo") if b.runModal() == .alertFirstButtonReturn { relaunchUnlag() } else { NSApp.terminate(nil) } case .alertSecondButtonReturn: relaunchUnlag() default: NSApp.terminate(nil) } } @MainActor func showAccessibilityAlert() { guard !

§4 Human · 3%

showedAccessibilityAlert else { return } showedAccessibilityAlert = true NSApp.activate(ignoringOtherApps: true) let a = NSAlert() a.alertStyle = .warning a.messageText = "Accessibility Permission Needed" a.informativeText = "Give Accessibility permission in System Settings, then restart Unlag Neo." a.addButton(withTitle: "Open Settings") a.addButton(withTitle: "Restart Unlag Neo") a.addButton(withTitle: "Quit Unlag Neo") switch a.runModal() { case .alertFirstButtonReturn: openAccessibilitySettings() let b = NSAlert() b.alertStyle = .informational b.messageText = "Restart Unlag Neo After Permission" b.informativeText = "After enabling Accessibility permission, restart Unlag Neo." b.addButton(withTitle: "Restart Unlag Neo") b.addButton(withTitle: "Quit Unlag Neo") if b.runModal() == .alertFirstButtonReturn { relaunchUnlag() } else { NSApp.terminate(nil) }

§5 Human · 3%

case .alertSecondButtonReturn: relaunchUnlag() default: NSApp.terminate(nil) } } @MainActor func requireScreenRecordingPermission() throws { guard !CGPreflightScreenCaptureAccess() else { return } _ = CGRequestScreenCaptureAccess() if !showedPermissionAlert { showedPermissionAlert = true showPermissionAlert() } throw CaptureError("Missing Screen Recording permission.") } func axCopy(_ element: AXUIElement, _ attr: String) -> AnyObject? { var value: CFTypeRef? return AXUIElementCopyAttributeValue(element, attr as CFString, &value) == .success ? value : nil } func axBool(_ element: AXUIElement, _ attr: String) -> Bool { (axCopy(element, attr) as? NSNumber)?.boolValue ?? false } func axValue(_ element: AXUIElement, _ attr: String, _ type: AXValueType) -> AXValue? { guard let v = axCopy(element, attr) else { return nil } let axv = v as! AXValue return AXValueGetType(axv) == type ?