Skip to content

Instantly share code, notes, and snippets.

@SKaplanOfficial
Created May 30, 2023 12:40
Show Gist options
  • Save SKaplanOfficial/af3b9de0edc96f915ec1cc183a74153f to your computer and use it in GitHub Desktop.
Save SKaplanOfficial/af3b9de0edc96f915ec1cc183a74153f to your computer and use it in GitHub Desktop.
JXA script to check if the Raycast main window is currently open.
(() => {
ObjC.import("CoreGraphics");
const windowList = ObjC.castRefToObject($.CGWindowListCopyWindowInfo($.kCGWindowListOptionAll, $.kCGNullWindowID))
const raycastWindow = windowList.js.find((win) => win.allKeys.containsObject("kCGWindowIsOnscreen") && win.js["kCGWindowLayer"].js == 8 && win.js["kCGWindowOwnerName"].js == "Raycast")
return raycastWindow != undefined
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment