23 lines
570 B
Rust
23 lines
570 B
Rust
use {
|
|
crate::{
|
|
cli::{DpmsArgs, DpmsState, GlobalArgs},
|
|
tools::tool_client::{ToolClient, with_tool_client},
|
|
wire::jay_compositor::SetDpms,
|
|
},
|
|
std::rc::Rc,
|
|
};
|
|
|
|
pub fn main(global: GlobalArgs, args: DpmsArgs) {
|
|
with_tool_client(global.log_level, |tc| async move {
|
|
run(tc, args).await;
|
|
});
|
|
}
|
|
|
|
async fn run(tc: Rc<ToolClient>, args: DpmsArgs) {
|
|
let comp = tc.jay_compositor().await;
|
|
tc.send(SetDpms {
|
|
self_id: comp,
|
|
active: (args.state == DpmsState::On) as u32,
|
|
});
|
|
tc.round_trip().await;
|
|
}
|