Expand description
§ppd-rs
ppd-rs
is a Rust interface for the Power Profiles Daemon (PPD), which allows applications
to interact with system power profiles on Linux systems.
This library provides a Rust API for the D-Bus interface exposed by the Power Profiles Daemon, allowing applications to:
- Get the current active power profile
- List available power profiles
- Switch between power profiles
- Hold a profile for a specific application
- Release profile holds
- Configure power-related actions
- Query and configure battery-aware behavior
§Usage
use ppd::{PpdProxyBlocking, Result};
use zbus::blocking::Connection;
fn main() -> Result<()> {
let connection = Connection::system()?;
let proxy = PpdProxyBlocking::new(&connection)?;
// Get current profile
let current_profile = proxy.active_profile()?;
println!("Current profile: {}", current_profile);
// List available profiles
let profiles = proxy.profiles()?;
for profile in profiles {
println!("Profile: {}", profile.profile);
}
Ok(())
}
Re-exports§
Modules§
- error
- Error handling for the ppd library Error handling for the ppd-rs library
Structs§
- Action
- Represents a configurable power-related action
- Active
Hold - Represents an active profile hold
- PpdProxy
- Power Profiles Daemon D-Bus interface
- PpdProxy
Blocking - Power Profiles Daemon D-Bus interface
- Profile
- Represents a power profile configuration
- Profile
Released - A
ProfileReleased
signal. - Profile
Released Iterator - A
Iterator
implementation that yieldsProfileReleased
signals. - Profile
Released Stream - A
Stream
implementation that yieldsProfileReleased
signals.