This page describes how to work with various desktop capabilities.
Molybden provides API that allows you to open URL in the default web browser, show a file or folder in the default file manager, or open a file in the associated application. It works on macOS and Windows only. Linux support will be added later.
You can open a URL in the associated application.
If URL points to a website, the default web browser will be launched to open it:
If URL represents a
mailto: URI, the default mail client will be launched to compose a new message:
mailto: URI can specify message fields including “to”, “cc”, “subject”, “body”, etc. See The mailto URL scheme (RFC 2368) for the
mailto: URI specification details.
If there’s no associated application for the specified URL, the function will do nothing.
You can open a file or folder in the associated application. For example, you can open a PDF file in the default PDF viewer (if it’s installed on the system):
If the associated application is not launched yet, it will be launched. If the given path is a folder, the file manager of the current platform is launched to open it.
If there’s no associated application for the specified path or the path does not exist, the function will do nothing.
If you want to show a file or folder in the default file manager, use the following approach:
auto desktop = app->desktop(); desktop->showPath("/Users/me/Documents"); desktop->showPath("/Users/me/Documents/file.txt");
If the provided path is a file, the file manager will open its directory and try selecting the file. If the provide path doesn’t exist, the function will do nothing.