Updated Sessions Raycast Script Command
Part of the Raycast series
As you may know, I created a Raycast script command to trigger what I call “sessions”, which are really just setting up the Mac to perform different tasks, such as podcasting or “normal” general use. At the time, I was using Raycast for window management, so my script command referenced Raycast window management layouts. Now I’m using Moom for window management, so I needed to update it to call my Moom layouts instead.
In the process, I decided to steal even more from Robb Knight’s App Mode Raycast script command and use his method of killing all apps before activating a session and having an array of default apps that I always want open. It’s almost the same exact script now.
The updated version looks like this:
You can see that because my so-called “IT” session sets Chrome as the default browser, I’m compelled to set Safari as my default browser for every other session type. I supposed I could just move that out to the top and have it called no matter what, and then immediately reversed if the session type is “IT”. You can read about my default browser script commands here.
The reason for the sleep commands is that without them, running the Session script command would result in some timing issue in which only some of the apps would open, but not all of them. I was able to solve the problem by putting in a sleep after killing all applications and after setting the default browser.
Calling Moom layouts using AppleScript commands (osascript) is possible because the author of Moom supports AppleScript calls to the program. I wish more programmers would think of their apps as potential links in a workflow chain like this.