Last active
July 30, 2020 06:16
-
-
Save hirose31/613599 to your computer and use it in GitHub Desktop.
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
global screenWidth | |
global screenHeight | |
tell (do shell script "/usr/sbin/system_profiler SPDisplaysDataType | grep Resolution | tail -n 1") to set {screenWidth, screenHeight} to {word 2 as number, word 4 as number} | |
-- display dialog "screen: " & screenWidth & "x" & screenHeight | |
if screenWidth = 1200 then | |
-- display dialog "monitor U2410" | |
tell application "System Events" | |
-- うまくうごかない get location of dock preferences | |
try | |
tell process "Firefox" | |
tell window 1 | |
set position to {0, 0} | |
set size to {1200, 1720} | |
end tell | |
end tell | |
end try | |
try | |
tell process "Safari" | |
tell window 1 | |
set position to {0, 0} | |
set size to {1200, 1720} | |
-- set size to {390, 768} | |
-- set position to {-390, 947} | |
end tell | |
end tell | |
end try | |
try | |
tell application "Google Chrome" | |
if running then | |
tell first window to set bounds to {0, 0, 1200, 1720} | |
end if | |
end tell | |
end try | |
try | |
tell process "LimeChat" | |
tell window 1 | |
set position to {0, 0} | |
set size to {1200, 1920} | |
end tell | |
end tell | |
end try | |
try | |
repeat with stk in every window of process "Stickies" | |
if name of stk contains "TODO" then | |
set position of stk to {200, 200} | |
else if name of stk contains "CHEAT" then | |
set position of stk to {510, 400} | |
else if name of stk contains "memo" then | |
set position of stk to {800, 200} | |
else if name of stk contains "雑多" then | |
set position of stk to {510, 200} | |
end if | |
end repeat | |
end try | |
try | |
repeat with fdr in every window of process "Finder" | |
set size of fdr to {900, 400} | |
end repeat | |
set position of item 1 of every window of process "Finder" to {250, 0} | |
set position of item 2 of every window of process "Finder" to {250, 420} | |
end try | |
try | |
tell process "iTerm2" | |
tell window 1 | |
set position to {14, 22} | |
set size to {1173, 1350} | |
end tell | |
tell window 2 | |
set position to {-1324, 947} | |
-- set size to {1300, 746} | |
set size to {940, 746} | |
end tell | |
end tell | |
end try | |
try | |
tell process "Slack" | |
tell window 1 | |
set position to {-1390, 947} | |
set size to {1390, 900} | |
end tell | |
end tell | |
end try | |
end tell | |
else if screenWidth = 1600 then | |
-- display dialog "monitor 2007FP" | |
tell application "System Events" | |
-- うまくうごかない get location of dock preferences | |
try | |
tell process "Firefox" | |
tell window 1 | |
set position to {0, 0} | |
set size to {1200, 1400} | |
end tell | |
end tell | |
end try | |
try | |
tell process "Safari" | |
tell window 1 | |
set position to {0, 0} | |
set size to {1200, 1400} | |
end tell | |
end tell | |
end try | |
try | |
tell application "Google Chrome" | |
if running then | |
tell first window to set bounds to {0, 0, 1200, 1400} | |
end if | |
end tell | |
end try | |
try | |
tell process "LimeChat" | |
tell window 1 | |
set position to {0, 800} | |
set size to {1200, 800} | |
end tell | |
end tell | |
end try | |
try | |
repeat with stk in every window of process "Stickies" | |
if name of stk contains "TODO" then | |
set position of stk to {200, 200} | |
else if name of stk contains "CHEAT" then | |
set position of stk to {510, 400} | |
else if name of stk contains "memo" then | |
set position of stk to {800, 200} | |
else if name of stk contains "javascript" then | |
set position of stk to {510, 200} | |
end if | |
end repeat | |
end try | |
end tell | |
else if screenWidth = 1366 or screenWidth = 1331 then | |
-- display dialog "MacBook Air 11" -- 1366x768 | |
tell application "System Events" | |
-- うまくうごかない get location of dock preferences | |
set dockWidth to 32 | |
set maxWidth to 1366 | |
set maxHeight to 768 | |
try | |
tell process "Firefox" | |
tell window 1 | |
set position to {dockWidth, 0} | |
set size to {maxWidth, maxHeight - 105} | |
end tell | |
end tell | |
end try | |
try | |
tell process "Safari" | |
tell window 1 | |
-- set position to {dockWidth, 0} | |
-- set size to {maxWidth, maxHeight - 105} | |
-- set size to {maxWidth, maxHeight} | |
set size to {390, 685} | |
set position to {64, 0} | |
end tell | |
end tell | |
end try | |
try | |
tell application "Google Chrome" | |
if running then | |
-- tell first window to set bounds to {dockWidth, 0, maxWidth, maxHeight - 80} | |
tell first window to set bounds to {dockWidth, 0, maxWidth, maxHeight} | |
end if | |
end tell | |
end try | |
try | |
tell process "LimeChat" | |
tell window 1 | |
set position to {0, 0} | |
set size to {maxWidth, maxHeight} | |
end tell | |
end tell | |
end try | |
try | |
repeat with stk in every window of process "Stickies" | |
if name of stk contains "TODO" then | |
set position of stk to {200, 100} | |
else if name of stk contains "CHEAT" then | |
set position of stk to {510, 300} | |
else if name of stk contains "memo" then | |
set position of stk to {800, 100} | |
else if name of stk contains "雑多" then | |
set position of stk to {510, 100} | |
end if | |
end repeat | |
end try | |
try | |
repeat with fdr in every window of process "Finder" | |
set size of fdr to {900, 340} | |
end repeat | |
set position of item 1 of every window of process "Finder" to {250, 0} | |
set position of item 2 of every window of process "Finder" to {250, 360} | |
end try | |
try | |
tell process "iTerm2" | |
tell window 1 | |
set position to {34, 0} | |
set size to {1330, 690} | |
end tell | |
tell window 2 | |
set position to {34, 0} | |
set size to {1330, 690} | |
end tell | |
end tell | |
end try | |
try | |
tell process "iTunes" | |
tell window 1 | |
set position to {dockWidth, 0} | |
set size to {maxWidth, maxHeight} | |
end tell | |
end tell | |
end try | |
end tell | |
else if screenWidth = 2560 or screenWidth = 2560 then | |
-- display dialog "MacBook Pro 13" -- 2560x1600 | |
tell application "System Events" | |
-- うまくうごかない get location of dock preferences | |
set dockWidth to 48 | |
set maxWidth to 1440 | |
set maxHeight to 900 | |
try | |
tell process "Firefox" | |
tell window 1 | |
set position to {dockWidth, 0} | |
set size to {maxWidth, maxHeight - 105} | |
end tell | |
end tell | |
end try | |
try | |
tell process "Safari" | |
tell window 1 | |
-- set position to {dockWidth, 0} | |
-- set size to {maxWidth, maxHeight - 105} | |
-- set size to {maxWidth, maxHeight} | |
set size to {390, 685} | |
set position to {64, 0} | |
end tell | |
end tell | |
end try | |
try | |
tell application "Google Chrome" | |
if running then | |
-- tell first window to set bounds to {dockWidth, 0, maxWidth, maxHeight - 80} | |
tell first window to set bounds to {dockWidth, 0, maxWidth, maxHeight} | |
end if | |
end tell | |
end try | |
try | |
tell process "LimeChat" | |
tell window 1 | |
set position to {0, 0} | |
set size to {maxWidth, maxHeight} | |
end tell | |
end tell | |
end try | |
try | |
repeat with stk in every window of process "Stickies" | |
if name of stk contains "TODO" then | |
set position of stk to {200, 100} | |
else if name of stk contains "CHEAT" then | |
set position of stk to {510, 300} | |
else if name of stk contains "memo" then | |
set position of stk to {800, 100} | |
else if name of stk contains "雑多" then | |
set position of stk to {510, 100} | |
end if | |
end repeat | |
end try | |
try | |
repeat with fdr in every window of process "Finder" | |
set size of fdr to {900, 340} | |
end repeat | |
set position of item 1 of every window of process "Finder" to {250, 0} | |
set position of item 2 of every window of process "Finder" to {250, 360} | |
end try | |
try | |
tell process "iTerm2" | |
tell window 1 | |
set position to {dockWidth, 0} | |
set size to {maxWidth, maxHeight} | |
end tell | |
tell window 2 | |
set position to {34, 0} | |
set size to {1330, 690} | |
end tell | |
end tell | |
end try | |
try | |
tell process "Slack" | |
tell window 1 | |
set position to {dockWidth, 0} | |
set size to {maxWidth, maxHeight} | |
end tell | |
end tell | |
end try | |
end tell | |
else | |
-- display dialog "macbook 13" | |
tell application "System Events" | |
try | |
tell process "Firefox" | |
tell window 1 | |
set position to {50, 0} | |
set size to {1230, 695} | |
end tell | |
end tell | |
end try | |
try | |
tell process "Safari" | |
tell window 1 | |
set position to {50, 0} | |
set size to {1230, 695} | |
end tell | |
end tell | |
end try | |
try | |
tell application "Google Chrome" | |
if running then | |
tell first window to set bounds to {50, 0, 1280, 695} | |
end if | |
end tell | |
end try | |
try | |
tell process "LimeChat" | |
tell window 1 | |
set position to {50, 0} | |
set size to {1230, 800} | |
end tell | |
end tell | |
end try | |
try | |
repeat with stk in every window of process "Stickies" | |
-- display dialog "oops" | |
if name of stk contains "TODO" then | |
set position of stk to {200, 200} | |
else if name of stk contains "CHEAT" then | |
set position of stk to {510, 400} | |
else if name of stk contains "memo" then | |
set position of stk to {800, 200} | |
else if name of stk contains "javascript" then | |
set position of stk to {510, 200} | |
end if | |
end repeat | |
end try | |
try | |
tell process "iTunes" | |
tell window 1 | |
set position to {50, 0} | |
set size to {1230, 780} | |
end tell | |
end tell | |
end try | |
end tell | |
end if |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment