feat(src): add inhibit command to prevent system sleep
The new inhibit subcommand lets users block suspend/sleep while optionally running a command, specifying why and who, and running in daemon mode. - New Features - Introduce Inhibit subcommand with command, why, who, and daemon options - Enhancements - Extend CLI parsing to support additional arguments - Enable background inhibition via daemon flag for continuous prevention
This commit is contained in:
2 files changed
+20
No files matched your search
+14
@@ -41,6 +41,20 @@ pub enum Commands {
|
||||
Status,
|
||||
/// Install udev rules for rootless operation
|
||||
InstallRules,
|
||||
/// Inhibit system sleep/suspend
|
||||
Inhibit {
|
||||
/// The command to run while inhibiting (optional)
|
||||
command: Vec<String>,
|
||||
/// Why the system is being inhibited
|
||||
#[arg(long, default_value = "lapctl inhibiting sleep")]
|
||||
why: String,
|
||||
/// Who is inhibiting the system
|
||||
#[arg(long, default_value = "lapctl")]
|
||||
who: String,
|
||||
/// Run the inhibitor in the background (daemon mode)
|
||||
#[arg(long)]
|
||||
daemon: bool,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Subcommand, Debug)]
|
||||
|
||||
@@ -28,5 +28,11 @@ fn main() {
|
||||
Commands::Cooling { command } => commands::cooling::execute(command),
|
||||
Commands::Status => commands::status::execute(),
|
||||
Commands::InstallRules => commands::install_rules::execute(),
|
||||
Commands::Inhibit {
|
||||
command,
|
||||
why,
|
||||
who,
|
||||
daemon,
|
||||
} => commands::inhibit::execute(command, why, who, *daemon),
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user