https://github.com/cijiugechu/tauri-plugin-power-manager
tauri plugin for shut down, reboot or log out operations
https://github.com/cijiugechu/tauri-plugin-power-manager
hibernate power reboot shutdown sleep tauri-plugin
Last synced: 5 months ago
JSON representation
tauri plugin for shut down, reboot or log out operations
- Host: GitHub
- URL: https://github.com/cijiugechu/tauri-plugin-power-manager
- Owner: cijiugechu
- License: mit
- Created: 2024-10-28T03:43:44.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-28T12:26:35.000Z (over 1 year ago)
- Last Synced: 2026-01-02T23:28:26.943Z (5 months ago)
- Topics: hibernate, power, reboot, shutdown, sleep, tauri-plugin
- Language: Rust
- Homepage:
- Size: 416 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Tauri Plugin power-manager
This plugin provides a cross platform way to shut down, reboot or log out operations.
Supported platforms: `Linux`, `Windows` and `macOS`.
## Installation
To install the Rust plugin, run:
```bash
cargo add tauri-plugin-power-manager
```
Then, load the plugin in your Tauri app as follows:
```rust
tauri::Builder::default()
.plugin(tauri_plugin_power_manager::init()) // THIS LINE
// More builder methods
.run(tauri::generate_context!())
.expect("error while running tauri application");
```
Finally, install the JS client bindings:
```bash
pnpm add tauri-plugin-power-manager-api
```
## API
```typescript
/**
* Calls the OS-specific function to force to log out the user.
*/
export declare const forceLogout: () => Promise;
/**
* Calls the OS-specific function to force to reboot the machine.
*/
export declare const forceReboot: () => Promise;
/**
* Calls the OS-specific function to force to shut down the machine.
*/
export declare const forceShutdown: () => Promise;
/**
* Calls the OS-specific function to hibernate the machine.
*/
export declare const hibernate: () => Promise;
/**
* Calls the OS-specific function to log out the user.
*/
export declare const logout: () => Promise;
/**
* Calls the OS-specific function to reboot the machine.
*/
export declare const reboot: () => Promise;
/**
* Calls the OS-specific function to shut down the machine.
*/
export declare const shutdown: () => Promise;
/**
* Calls the OS-specific function to put the machine to sleep.
*/
export declare const sleep: () => Promise;
```