OS Information
Read information about the operating system using the OS Information plugin.
Setup
Install the OS Information plugin to get started.
Use your project’s package manager to add the dependency:
-
Run the following command in the
src-tauri
folder to add the plugin to the project’s dependencies inCargo.toml
: -
Modify
lib.rs
to initialize the plugin: -
If you’d like to use in JavaScript then install the npm package as well:
Usage
With this plugin you can query multiple information from current operational system. See all available functions in the JavaScript API or Rust API references.
Example: OS Platform
platform
returns a string describing the specific operating system in use. The value is set at compile time. Possible values are linux
, macos
, ios
, freebsd
, dragonfly
, netbsd
, openbsd
, solaris
, android
, windows
.
Permissions
By default all potentially dangerous plugin commands and scopes are blocked and cannot be accessed. You must modify the permissions in your capabilities
configuration to enable these.
See the Capabilities Overview for more information and the step by step guide to use plugin permissions.
Default Permission
This permission set configures which operating system information are available to gather from the frontend.
Granted Permissions
All information except the host name are available.
allow-arch
allow-exe-extension
allow-family
allow-locale
allow-os-type
allow-platform
allow-version
Permission Table
Identifier | Description |
---|---|
|
Enables the arch command without any pre-configured scope. |
|
Denies the arch command without any pre-configured scope. |
|
Enables the exe_extension command without any pre-configured scope. |
|
Denies the exe_extension command without any pre-configured scope. |
|
Enables the family command without any pre-configured scope. |
|
Denies the family command without any pre-configured scope. |
|
Enables the hostname command without any pre-configured scope. |
|
Denies the hostname command without any pre-configured scope. |
|
Enables the locale command without any pre-configured scope. |
|
Denies the locale command without any pre-configured scope. |
|
Enables the os_type command without any pre-configured scope. |
|
Denies the os_type command without any pre-configured scope. |
|
Enables the platform command without any pre-configured scope. |
|
Denies the platform command without any pre-configured scope. |
|
Enables the version command without any pre-configured scope. |
|
Denies the version command without any pre-configured scope. |
© 2024 Tauri Contributors. CC-BY / MIT