Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
tauri-plugin-prevent-default
Disable default browser shortcuts in your Tauri app, e.g. F3 or Ctrl+J.
Install
Install the plugin by adding the following to your Cargo.toml file:
[]
= "4"
Usage
Register the plugin with Tauri:
src-tauri/src/main.rs
default
.plugin
.run
.expect;
You can also use flags to determine which shortcuts the plugin should disable. By default, it will disable all of them.
use Flags;
let prevent = new
.with_flags
.build;
default
.plugin
.run
.expect;
If you want to keep only CONTEXT_MENU, DEV_TOOLS, and RELOAD enabled in dev mode, you can build the plugin with tauri_plugin_prevent_default::debug instead.
default
.plugin
.run
.expect;
Examples
- Disable all but a few:
use Flags;
// This will disable all shortcuts, except `FIND` and `RELOAD`.
new
.with_flags
.build
- Disable only keyboard shortcuts:
use Flags;
new
.with_flags
.build
- Disable custom shortcuts:
use KeyboardShortcut;
use ;
new
.shortcut
.shortcut
.shortcut
.build;
- Keep certain shortcuts enabled only when in dev mode:
Platform-specific options
Please read our versioning policy before using any of these options.
Windows
The platform-windows feature must be enabled.
[]
= { = "4", = ["platform-windows"] }
use PlatformOptions;
new
.platform
.build
Versioning and Experimental Features
This plugin adheres to SemVer. However, features marked as unstable are experimental and may introduce breaking changes between minor versions.
Supported Tauri Version
This plugin requires Tauri 2.0 or later.