September 5, 2023
Molybden 1.0.0-preview.8: desktop, permissions, logging, DMG installer on macOS
In the latest SDK update we introduced the Desktop API for macOS and Windows, extended the Permissions and Logging APIs with new features, introduced generator of the DMG installers for macOS, upgraded Molybden Runtime (Chromium) to version 116, and more.
Please share your feedback with us in our Discord community or via the Contact Us form.
What’s new
Here’s a quick overview of the new features and improvements in the latest updates.
Window customization on macOS
The API for customizing app windows on macOS has been extended with new possibilities. Now, you can hide the window title bar, window title, and control the visibility of the standard window buttons.
For example, you can hide the browser window title bar and window title using the following code:
auto browser = Browser::create(app);
browser->setWindowTitleVisible(false);
browser->setWindowTitlebarVisible(false);
You will get the following result on macOS:
DMG installer on macOS
Now, you can pack your app into DMG on macOS. The DMG installer will be generated automatically during making production build and placed in the build-dist/pack
directory.
By default, the DMG installer window looks like this:
You can always customize it in the molybden.conf.json
file.
Desktop API
This API 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.
For example, you can open URL in the default web browser using the following code:
app->desktop()->openUrl("https://www.teamdev.com/molybden");
If you want to open a file in the associated application, use the following approach:
app->desktop()->showPath("/Users/me/Documents/report.pdf");
Permissions API
The Permissions API has been extended with functionality that allows resetting the permission for specific website and checking the permission status.
Now, you can reset the decision for specific website programmatically:
permissions->resetPermission(PermissionType::kVideoCapture, website_url);
permissions->resetPermission(PermissionType::kAudioCapture, website_url);
To check the permission status for specific website, use the getPermissionStatus()
method:
auto permission_status = permissions->getPermissionStatus(
PermissionType::kVideoCapture,
website_url);
if (permission_status == PermissionStatus::kGranted) {
// The video capture permission is granted for the website.
}
Read more about the Permissions API
Logging API
Molybden has a built-in logging system that allows you to log messages to the console and to a file. The Logging API has been extended with functionality that allows you to use the logging system in your application.
For example, you can enable logging and log an INFO
message to the console using the following code:
AppOptions options;
options.logging.enabled = true;
options.logging.log_level = LogLevel::kInfo;
options.logging.destination = Destination::kStandardOutput;
App::init(options, [](std::shared_ptr<App> app) {
LOG(INFO) << "Here's an info log message";
});
Read more about the Logging API
Chromium 116.0.5845.140
We upgraded Chromium to a newer version, which introduces multiple security fixes, including the fix for CVE-2023-4572: Use after free in MediaStream.
For the complete list of Chromium fixes and improvements in 116.0.5845.140
, please visit the
product blog post for this version.
Enhancements
- The debug Molybden libraries have been moved to the separate npm packages to get rid of the npm package size limit. The debug libraries will be installed automatically for smooth debugging experience.
- The generated projects via the official
create-molybden-app
scaffolding tool now uses C++17 standard instead of C++11. - Improved app branding on macOS. In the System Settings → Notifications, for the app Helper Alert process the app icon is used instead of the default Chromium icon.
- Fix bug when notifications don’t work on macOS in production builds.
- Fix CMake lookup. When we cannot find the already installed CMake, we always download our own CMake build, which is wrong and time-consuming. We should only download CMake if it’s not installed/downloaded.