System Utilities
This set of utilities exposes some of Raycast's native functionality to allow deep integration into the user's setup. For example, you can use the Application APIs to check if a desktop application is installed and then provide an action to deep-link into it.
API Reference
getApplications
Returns all applications that can open the file or URL.
Signature
Example
Parameters
path
The path of the file or folder to get the applications for. If no path is specified, all installed applications are returned.
Return
An array of Application.
getDefaultApplication
Returns the default application that the file or URL would be opened with.
Signature
Example
Parameters
Return
A Promise that resolves with the default Application that would open the file or URL. If no application was found, the promise will be rejected.
getFrontmostApplication
Returns the frontmost application.
Signature
Example
Return
A Promise that resolves with the frontmost Application. If no application was found, the promise will be rejected.
showInFinder
Shows a file or directory in the Finder.
Signature
Example
Parameters
Return
A Promise that resolves when the item is revealed in the Finder.
trash
Moves a file or directory to the Trash.
Signature
Example
Parameters
Return
A Promise that resolves when all files are moved to the trash.
open
Opens a target with the default application or specified application.
Signature
Example
Parameters
target*
The file, folder or URL to open.
string
application
The application name to use for opening the file. If no application is specified, the default application as determined by the system is used to open the specified file. Note that you can use the application name, app identifier, or absolute path to the app.
string
or Application
Return
A Promise that resolves when the target has been opened.
captureException
Report the provided exception to the Developer Hub. This helps in handling failures gracefully while staying informed about the occurrence of the failure.
Signature
Example
Parameters
target*
The file, folder or URL to open.
string
application
The application name to use for opening the file. If no application is specified, the default application as determined by the system is used to open the specified file. Note that you can use the application name, app identifier, or absolute path to the app.
string
or Application
Types
Application
An object that represents a locally installed application on the system.
It can be used to open files or folders in a specific application. Use getApplications or getDefaultApplication to get applications that can open a specific file or folder.
Properties
name*
The display name of the application.
string
path*
The absolute path to the application bundle, e.g. /Applications/Raycast.app
,
string
bundleId
The bundle identifier of the application, e.g. com.raycast.macos
.
string
localizedName
The localized name of the application.
string
PathLike
Supported path types.
Last updated