Created
May 4, 2022 13:30
-
-
Save neilio/35cae2ffd86e3a466d732b3d9b73f8b0 to your computer and use it in GitHub Desktop.
Set up laptop for work
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
#!/usr/bin/osascript | |
# Required parameters: | |
# @raycast.schemaVersion 1 | |
# @raycast.title Switch to FreshBooks | |
# @raycast.mode silent | |
# Optional parameters: | |
# @raycast.icon 🤖 | |
# Documentation: | |
# @raycast.description Opens apps relevant to work | |
# @raycast.author Neil | |
# @raycast.authorURL https://neillee.com/ | |
set theAppList to {{name:"Sidekick", vis:true}, {name:"Messages", vis:true}, {name:"MeetingBar", vis:false}, {name:"Things3", vis:true}, {name:"Craft", vis:true}} | |
set quitList to {{name:"Safari"}, {name:"Safari Technology Preview"}, {name:"Google Chrome Canary"}, {name:"Microsoft Edge Canary"}, {name:"Slack"}, {name:"Spike"}} | |
repeat with currentApp in theAppList | |
tell application (name of currentApp) to launch | |
tell application "System Events" | |
try | |
if background only of process (name of currentApp) is false then | |
set visible of process (name of currentApp) to (vis of currentApp) | |
end if | |
end try | |
end tell | |
end repeat | |
repeat with currentApp in quitList | |
set thisApp to (name of currentApp) | |
is_running(thisApp) | |
end repeat | |
open location "x-fantastical3://show/set?name=Work" | |
(* Get display size and run Moom *) | |
tell application "Image Events" | |
launch | |
set countDisplays to count displays | |
quit | |
end tell | |
tell application "Finder" | |
set screen_total to bounds of window of desktop | |
set screen_width to item 3 of screen_total | |
end tell | |
if countDisplays > 1 or screen_width = 2560 then | |
tell application "Moom" to arrange windows according to snapshot "Desk" | |
else if screen_width = 1512 then | |
tell application "Moom" to arrange windows according to snapshot "1512" | |
else if screen_width = 1800 then | |
tell application "Moom" to arrange windows according to snapshot "8" | |
else if screen_width = 2560 then | |
tell application "Moom" to arrange windows according to snapshot "1512" | |
end if | |
tell application "Fantastical" to quit | |
on is_running(appname) | |
if application appname is running then | |
tell application id (id of application appname) to quit | |
end if | |
end is_running |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment