Created
May 30, 2023 12:40
-
-
Save SKaplanOfficial/af3b9de0edc96f915ec1cc183a74153f to your computer and use it in GitHub Desktop.
JXA script to check if the Raycast main window is currently open.
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
(() => { | |
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