Guides
Chromium flags and preferences
Pass Chromium switches, set its preferences and turn back on what Kurogane turns off.
Kurogane starts Chromium with its own switches and preferences. Your app adds to them, overrides them or removes them.
Add a switch
App::chromium_flag adds a switch without a value. App::chromium_flag_with_value adds one with a value:
use kurogane::App;
fn main() {
App::new("content")
.chromium_flag("disable-popup-blocking")
.chromium_flag_with_value("enable-blink-features", "CanvasDrawElement")
.run_or_exit();
}
- A name may be written with or without its leading
--. On Windows it’s case-insensitive as Chromium treats it. - A name holding
=is logged and skipped. Its value goes inchromium_flag_with_value. - Your switches apply after Kurogane’s own, in the order given. The last value given for a switch wins over Kurogane’s own value too.
Add features
enable-features and disable-features are lists. A value adds its features to them instead of replacing them:
use kurogane::App;
fn main() {
App::new("content")
.chromium_flag_with_value("disable-features", "Translate")
.run_or_exit();
}
The features CEF disables itself stay disabled. An enable-features entry turns back on a feature Kurogane turns off, in any form Chromium reads (Name, Name:param/value, Name<Study or *Name).
Remove a switch Kurogane passes
App::without_chromium_flag drops a switch Kurogane would pass. That’s one of its defaults, one a setting such as gpu_mode sets or one your app gave before:
use kurogane::App;
fn main() {
App::new("content")
.without_chromium_flag("disable-stack-profiler")
.run_or_exit();
}
A switch given after it sets the switch again. For enable-features and disable-features it drops Kurogane’s entries and your earlier ones. CEF’s own stay.
A switch CEF passes itself or your app was launched with stays. Kurogane logs it.
Set a preference
App::chromium_pref sets any Chromium preference by its name. The value takes the place of Kurogane’s own:
use kurogane::App;
fn main() {
App::new("content")
.chromium_pref("component_updates.component_updates_enabled", true)
.run_or_exit();
}
A null value returns a preference to Chromium’s default:
use kurogane::App;
use serde_json::Value;
fn main() {
App::new("content")
.chromium_pref("network_time.network_time_queries_enabled", Value::Null)
.run_or_exit();
}
- The name is the profile’s preference when the profile has one of that name and else Chromium’s global one.
- A preference applies once the runtime has started. Chromium reads some only as the profile starts. Those take effect at the next start.
- Preferences are declarative. One set at an earlier start and given no more returns to Chromium’s default.
- A name Chromium doesn’t have, or a value it refuses, is logged and skipped.
What Kurogane turns off
Kurogane turns off what Chromium would run for every app and an app rarely needs. One line turns each back on:
| What | Turned off by | Turned back on with |
|---|---|---|
| Extensions other programs register for Google Chrome | preference extensions.block_external_extensions |
.chromium_pref("extensions.block_external_extensions", false) |
| Component updates, Widevine among them | preference component_updates.component_updates_enabled |
.chromium_pref("component_updates.component_updates_enabled", true) |
| Queries to Google’s time server | preference network_time.network_time_queries_enabled |
.chromium_pref("network_time.network_time_queries_enabled", true) |
| The bubble of finished downloads | preference download_bubble.partial_view_enabled |
.chromium_pref("download_bubble.partial_view_enabled", true) |
| The omnibox’s AI Mode check | feature AimEnabled |
.chromium_flag_with_value("enable-features", "AimEnabled") |
| Cast | feature MediaRouter |
.chromium_flag_with_value("enable-features", "MediaRouter") |
| A renderer kept ready for the next site | feature SpareRendererForSitePerProcess |
.chromium_flag_with_value("enable-features", "SpareRendererForSitePerProcess") |
| A copy of the whole bundle at every macOS start | feature MacAppCodeSignClone |
.chromium_flag_with_value("enable-features", "MacAppCodeSignClone") |
| Chrome’s stack-sampling profiler | switch disable-stack-profiler |
.without_chromium_flag("disable-stack-profiler") |
On macOS Chromium can copy the app bundle into the user’s temporary folder at every start. The running app’s code signature then stays valid when an updater replaces the bundle in place. A killed app leaves its copy behind. An app whose updater replaces the bundle while it runs turns MacAppCodeSignClone back on.
See what Chromium got
- Chromium ignores a switch or feature name it doesn’t know and says nothing. Kurogane reads every switch back once Chromium holds it and logs one held otherwise than passed.
- The final command line is logged at debug level. See Logging.