Open
Description
Hi there and thanks for all the work on Keyboard Cowboy - fantastic app!
I've figured out how to center a window using KC's built-in window management, but not how to resize to custom dimensions. Is that currently possibly natively?
If not, I have this AppleScript which works fine when triggered in Script Editor, but not in Keyboard Cowboy. I have it running concurrently with the Center Window command, but it's not resizing. What am I missing?
Here is the script:
-- Desired size
set desiredWidth to 1350
set desiredHeight to 840
-- Get screen dimensions
tell application "Finder"
set screenBounds to bounds of window of desktop
set screenWidth to item 3 of screenBounds
set screenHeight to item 4 of screenBounds
end tell
-- Calculate center position
set posX to (screenWidth - desiredWidth) / 2
set posY to (screenHeight - desiredHeight) / 2
-- Resize and move the frontmost window
tell application "System Events"
set frontApp to name of first application process whose frontmost is true
tell application process frontApp
try
set size of front window to {desiredWidth, desiredHeight}
set position of front window to {posX, posY}
on error errMsg
display dialog "Error: " & errMsg
end try
end tell
end tell
Thank you
Metadata
Metadata
Assignees
Labels
No labels