#tauri-plugin #shutdown #reboot #tauri #power #plugin #operation

sys tauri-plugin-power-manager

tauri plugin for shut down, reboot or log out operations

2 releases

0.1.1 Oct 28, 2024
0.1.0 Oct 28, 2024

#633 in GUI

Download history 31/week @ 2024-12-22 16/week @ 2024-12-29 33/week @ 2025-01-05 37/week @ 2025-01-12 27/week @ 2025-01-19 34/week @ 2025-01-26 36/week @ 2025-02-02 31/week @ 2025-02-09 42/week @ 2025-02-16 28/week @ 2025-02-23 46/week @ 2025-03-02 18/week @ 2025-03-09 28/week @ 2025-03-16 34/week @ 2025-03-23 31/week @ 2025-03-30 28/week @ 2025-04-06

123 downloads per month

MIT license

12KB
189 lines

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:

cargo add tauri-plugin-power-manager

Then, load the plugin in your Tauri app as follows:

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:

pnpm add tauri-plugin-power-manager-api

API

/**
 * Calls the OS-specific function to force to log out the user.
 */
export declare const forceLogout: () => Promise<void>;
/**
 * Calls the OS-specific function to force to reboot the machine.
 */
export declare const forceReboot: () => Promise<void>;
/**
 * Calls the OS-specific function to force to shut down the machine.
 */
export declare const forceShutdown: () => Promise<void>;
/**
 * Calls the OS-specific function to hibernate the machine.
 */
export declare const hibernate: () => Promise<void>;
/**
 * Calls the OS-specific function to log out the user.
 */
export declare const logout: () => Promise<void>;
/**
 * Calls the OS-specific function to reboot the machine.
 */
export declare const reboot: () => Promise<void>;
/**
 * Calls the OS-specific function to shut down the machine.
 */
export declare const shutdown: () => Promise<void>;
/**
 * Calls the OS-specific function to put the machine to sleep.
 */
export declare const sleep: () => Promise<void>;

Dependencies

~18–56MB
~1M SLoC