sysctrlcmd
sysctrlcmd is a Rust crate providing a unified and cross-platform interface for executing system-level commands like locking the workstation, logging off the current user, hibernating, suspending, restarting, and shutting down the system. It's designed to simplify the integration of system command functionalities in Rust applications, offering a consistent API across different operating systems.
Supported Commands
The table below outlines the support for various system commands across Windows, Linux, and MacOS:
Command | Windows | Linux | MacOS |
---|---|---|---|
Lock | ✔ | ❌ | ❌ |
Logoff | ✔ | ❌ | ❌ |
Hibernate | ✔ | ❌ | ❌ |
Suspend | ✔ | ❌ | ❌ |
Restart | ✔ | ❌ | ❌ |
Shutdown | ✔ | ❌ | ❌ |
- ✔ - Supported
- ❌ - Not Supported / Not Applicable
- Note: Some commands may require administrative privileges.
Usage
use SystemCommandsImpl;
Installation
Add the following to your Cargo.toml
file:
[]
= "*"