Capabilities for Different Windows and Platforms
This guide will help you customize the capabilities of your Tauri app.
Content of this guide
- Create multiple windows in a Tauri app
- Use different capabilities for different windows
- Use platform-specific capabilities
Prerequisites
This exercise is meant to be read after completing
Using Plugin Permissions.
Guide
Create Multiple Windows in a Tauri Application
Here we create an app with two windows labelled
firstandsecond. There are multiple ways to create windows in your Tauri application.Create Windows with the Tauri Configuration File
In the Tauri configuration file, usually named
tauri.conf.json:Show solution
"productName": "multiwindow", ... "app": { "windows": [ { "label": "first", "title": "First", "width": 800, "height": 600 }, { "label": "second", "title": "Second", "width": 800, "height": 600 } ], }, ...}Create Windows Programmatically
In the Rust code to create a Tauri app:
Show solution
tauri::Builder::default() .invoke_handler(tauri::generate_handler![greet]) .setup(|app| { let webview_url = tauri::WebviewUrl::App("index.html".into()); // First window tauri::WebviewWindowBuilder::new(app, "first", webview_url.clone()) .title("First") .build()?; // Second window tauri::WebviewWindowBuilder::new(app, "second", webview_url) .title("Second") .build()?; Ok(()) }) .run(context) .expect("error while running tauri application");Apply Different Capabilities to Different Windows
The windows of a Tauri app can use different features or plugins of the Tauri backend. For better security it is recommended to only give the necessary capabilities to each window. We simulate a scenario where the
firstwindows uses filesystem and dialog functionalities andsecondonly needs dialog functionalities.Separate capability files per category
It is recommended to separate the capability files per category of actions they enable.
Show solution
JSON files in the
src-tauri/capabilitieswill be taken into account for the capability system. Here we separate capabilities related to the filesystem and dialog window intofilesystem.jsonanddialog.json.filetree of the Tauri project:
/src/src-tauri /capabilities filesystem.json dialog.json tauri.conf.jsonpackage.jsonREADME.mdGive filesystem capabilities to the
firstwindowWe give the
firstwindow the capability to have read access to the content of the$HOMEdirectory.Show solution
Use the
windowsfield in a capability file with one or multiple window labels.{ "identifier": "fs-read-home", "description": "Allow access file access to home directory", "local": true, "windows": ["first"], "permissions": [ "fs:allow-home-read", ]}filesystem.json
Give dialog capabilities to the
firstandsecondwindowWe give to
firstandsecondwindows the capability to create a “Yes/No” dialogShow solution
Use the
windowsfield in a capability file with one or multiple window labels.{ "identifier": "dialog", "description": "Allow to open a dialog", "local": true, "windows": ["first", "second"], "permissions": ["dialog:allow-ask"]}dialog.json
Make Capabilities Platform Dependent
We now want to customize the capabilities to be active only on certain platforms. We make our filesystem capabilities only active on
linuxandwindows.Show solution
Use the
platformsfield in a capability file to make it platform-specific.{ "identifier": "fs-read-home", "description": "Allow access file access to home directory", "local": true, "windows": ["first"], "permissions": [ "fs:allow-home-read", ], "platforms": ["linux", "windows"]}filesystem.json
The currently available platforms are
linux,windows,macos,android, andios.
Conclusion and Resources
We have learned how to create multiple windows in a Tauri app and give them specific capabilities. Furthermore these capabilities can also be targeted to certain platforms.
An example application that used window capabilities can be found in the
api
example of
the Tauri Github repository. The
fields that can be used in a capability file are listed in the
Capability reference.
Support on Open CollectiveSponsor on GitHub
© 2026 Tauri Contributors. CC-BY / MIT
Last updated Oct 08, 2026