Skip to content

Instantly share code, notes, and snippets.

@SebastiaanKloos
Created May 21, 2024 11:12
Show Gist options
  • Save SebastiaanKloos/63faaf1c302e0bebb51bb5f26969ab6b to your computer and use it in GitHub Desktop.
Save SebastiaanKloos/63faaf1c302e0bebb51bb5f26969ab6b to your computer and use it in GitHub Desktop.
Position Ray Applescript for Raycast
#!/usr/bin/osascript
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Position Ray
# @raycast.mode compact
# Optional parameters:
# @raycast.packageName Developer Utils
# Documentation:
# @raycast.description Position Ray To It's Predefined Position
# @raycast.author Sebastiaan Kloos
# @raycast.authorURL https://github.com/SebastiaanKloos
tell application "System Events"
set appProcess to application process "Ray"
set windowPadding to 50
set screenResolution to do shell script "system_profiler SPDisplaysDataType | grep Resolution | awk '{print $2,$4}'"
set screenWidth to word 1 of screenResolution
set screenHeight to word 2 of screenResolution
tell appProcess
set frontWindow to the front window
set size of frontWindow to {400, 500}
set windowSize to size of frontWindow
set newPosX to screenWidth - (item 1 of windowSize) - windowPadding
set newPosY to screenHeight - (item 2 of windowSize) - windowPadding
set position of frontWindow to {newPosX, newPosY}
end tell
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment