Skip to content

Instantly share code, notes, and snippets.

@daimon99
Last active May 24, 2020 02:19
Show Gist options
  • Save daimon99/1e6a66a8575660053eeda2209caaf84b to your computer and use it in GitHub Desktop.
Save daimon99/1e6a66a8575660053eeda2209caaf84b to your computer and use it in GitHub Desktop.
mac sizeup 的替代品,自动按需调节 app 位置 / Mac sizeup alternative
on run {input, parameters}
tell application "Finder"
set screenResolution to bounds of window of desktop
end tell
set screenWidth to item 3 of screenResolution
set screenHeight to item 4 of screenResolution
set theApp to (path to frontmost application as Unicode text)
tell application "System Events" to tell (process 1 where it is frontmost)
tell window 1 to set {size, position} to {{screenWidth * 0.6 as integer, screenHeight * 0.8 as integer}, {screenWidth * 0.2 as integer, screenHeight * 0.05 as integer}}
end tell
end run
on run {input, parameters}
tell application "Finder"
set screenResolution to bounds of window of desktop
end tell
set screenWidth to item 3 of screenResolution
set screenHeight to item 4 of screenResolution
set theApp to (path to frontmost application as Unicode text)
tell application "System Events" to tell (process 1 where it is frontmost)
tell window 1 to set {size, position} to {{screenWidth * 0.5 as integer, screenHeight * 1 as integer}, {0, 0}}
end tell
end run
on run {input, parameters}
tell application "Finder"
set screenResolution to bounds of window of desktop
end tell
set screenWidth to item 3 of screenResolution
set screenHeight to item 4 of screenResolution
set theApp to (path to frontmost application as Unicode text)
tell application "System Events" to tell (process 1 where it is frontmost)
tell window 1 to set {size, position} to {{screenWidth * 0.5 as integer, screenHeight * 1 as integer}, {screenWidth * 0.5 as integer, 0}}
end tell
end run