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
@daimon99
Copy link
Author

daimon99 commented May 6, 2020

Move app to left or right or center of the screen with shortcuts like sizeup.

  1. Open automator
  2. Select "快速操作"
  3. Select "实用工具"-"运行apple script"
  4. Input the code belows in the right region
  5. Save it
  6. Open "系统偏好设置“ - ”键盘“ - ”快捷键“ - “服务“,find your service just entered.
  7. Assign your favorite shortcuts.

Ok now!
It worth $12.99! If you think it helps you, may you donate for my share, any amount is appreciate :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment