Tauri Plugin device-info
A comprehensive Tauri plugin to access device information including Battery, Network, Storage, Display, and System Details.
📸 Preview
Platform Support
| Platform | Support |
|---|---|
| Windows | ✅ |
| macOS | ✅ |
| Linux | ✅ |
| iOS | ✅ |
| Android | ✅ |
Installation
Using Tauri CLI (Recommended)
# or
Manual Installation
Cargo.toml:
[]
= "0.1.0"
# or from git
= { = "https://github.com/edisdev/tauri-plugin-device-info" }
package.json:
Setup
Register the plugin in your Tauri app:
src-tauri/src/lib.rs:
Usage
import {
getDeviceInfo,
getBatteryInfo,
getNetworkInfo,
getStorageInfo,
getDisplayInfo
} from 'tauri-plugin-device-info-api';
// Get device information
const device = await getDeviceInfo();
console.log(device);
// Get battery status
const battery = await getBatteryInfo();
console.log(battery);
// Get network information
const network = await getNetworkInfo();
console.log(network);
// Get storage information
const storage = await getStorageInfo();
console.log(storage);
// Get display information
const display = await getDisplayInfo();
console.log(display);
API Reference
getDeviceInfo()
Returns device identification and hardware information.
| Field | Type | Description |
|---|---|---|
uuid |
string? |
Unique device identifier |
manufacturer |
string? |
Device manufacturer (e.g., "Apple Inc.") |
model |
string? |
Device model (e.g., "MacBookPro16,1") |
serial |
string? |
Serial number (restricted on some platforms) |
android_id |
string? |
Android-specific ID (Android only) |
device_name |
string? |
User-assigned device name |
getBatteryInfo()
Returns battery status and health information.
| Field | Type | Description |
|---|---|---|
level |
number? |
Battery percentage (0-100) |
isCharging |
boolean? |
Whether the device is charging |
health |
string? |
Battery health status |
getNetworkInfo()
Returns network connection details.
| Field | Type | Description |
|---|---|---|
ipAddress |
string? |
Local IP address |
networkType |
string? |
Connection type: "wifi", "cellular", "ethernet", "unknown" |
macAddress |
string? |
MAC address (unavailable on iOS/Android due to privacy) |
getStorageInfo()
Returns storage capacity information.
| Field | Type | Description |
|---|---|---|
totalSpace |
number? |
Total storage in bytes |
freeSpace |
number? |
Available storage in bytes |
storageType |
string? |
Storage type: "SSD", "HDD", "internal" |
getDisplayInfo()
Returns display/screen information.
| Field | Type | Description |
|---|---|---|
width |
number? |
Screen width in pixels |
height |
number? |
Screen height in pixels |
scaleFactor |
number? |
Display scale factor (e.g., 2.0 for Retina) |
refreshRate |
number? |
Screen refresh rate in Hz |
TypeScript Types
All types are exported and can be imported:
import type {
DeviceInfoResponse,
BatteryInfo,
NetworkInfo,
StorageInfo,
DisplayInfo
} from 'tauri-plugin-device-info-api';
Permissions
Add the required permissions in your capabilities configuration:
Or individually:
device-info:allow-get-device-infodevice-info:allow-get-battery-infodevice-info:allow-get-network-infodevice-info:allow-get-storage-infodevice-info:allow-get-display-info
Platform-Specific Notes
iOS
- MAC address is not available due to Apple's privacy restrictions (returns "unavailable")
- Serial number uses a persistent Keychain-stored UUID
Android
- MAC address is restricted on Android 6.0+ (returns "restricted")
- Requires no special permissions for basic device info
macOS
- Uses native CoreGraphics API for accurate refresh rate detection
- Full access to all device information
Windows
- Uses WMI (Windows Management Instrumentation) for device info
- Full access to all device information
Linux
- Display refresh rate requires X11 (xrandr)
- Device info read from
/sys/class/dmi/id/
License
MIT