1
0
Fork 0
forked from wry/wry

cli: add pid subcommand

This commit is contained in:
Julian Orth 2026-03-09 22:32:40 +01:00
parent fe8b51ffb6
commit 447dfb3118
7 changed files with 55 additions and 3 deletions

29
src/cli/pid.rs Normal file
View file

@ -0,0 +1,29 @@
use {
crate::{
cli::GlobalArgs,
tools::tool_client::{Handle, ToolClient, with_tool_client},
wire::jay_compositor::{GetPid, Pid},
},
std::rc::Rc,
};
pub fn main(global: GlobalArgs) {
with_tool_client(global.log_level, |tc| async move {
let pid = Rc::new(P { tc: tc.clone() });
run(pid).await;
});
}
struct P {
tc: Rc<ToolClient>,
}
async fn run(p: Rc<P>) {
let tc = &p.tc;
let comp = tc.jay_compositor().await;
tc.send(GetPid { self_id: comp });
Pid::handle(tc, comp, (), |_, pid| {
println!("{}", pid.pid);
});
tc.round_trip().await;
}