Raycast script commands: five we run every day
A Raycast script command is just a script with a few metadata comments at the top. If you can write a shell one-liner, you can write one.
Our five
Toggle dark mode, copy the current Git branch, restart the Colima VM, open the Brewfile in Neovim, and flush the DNS cache.
Arguments
Add an argument metadata line and Raycast shows an input field. Our "new branch" command takes a ticket number and does the rest.
Sharing
Keep scripts in your dotfiles repository and point Raycast at the folder. A new Mac gets all of them at once.
- Use silent mode for scripts with no output.
- Set a refresh time for inline scripts.
- Keep scripts in version control.
code
#!/bin/bash
# @raycast.schemaVersion 1
# @raycast.title Toggle Dark Mode
# @raycast.mode silent
osascript -e 'tell application "System Events" to tell appearance preferences to set dark mode to not dark mode'
Real artists ship.
Steve Jobs (1983), as recounted by Andy Hertzfeld in Revolution in the Valley
Scripts run with a minimal PATH. Use absolute paths such as
/opt/homebrew/bin/colima.
$ cat /comments 8
This is exactly the write-up I needed this week. Bookmarked.
Tried this on an M1 Air and got the same numbers within a few percent.
Any chance you could share the full config in a gist? The snippet is great but I want to see the rest.
Glad it helped. Let me know if anything breaks after the next update.
I have been doing this the hard way for years. Thank you.
Worth mentioning that this behaves differently on Intel Macs. Took me an hour to figure that out.
Great post. One small correction: the flag is case-sensitive on older versions.
Same here, it made a big difference.