clan-wl-backdrop/src/main.rs
2026-03-17 21:48:12 -03:00

56 lines
1.3 KiB
Rust

use std::{process::Command, rc::Rc};
use wl_proxy::{
baseline::Baseline,
object::{ConcreteObject, Object, ObjectCoreApi, ObjectRcUtils},
protocols::{
wayland::wl_registry::{WlRegistry, WlRegistryHandler},
xdg_shell::xdg_wm_base::XdgWmBase,
},
simple::{SimpleCommandExt, SimpleProxy},
};
use crate::globals::Globals;
mod buffer;
mod deco;
mod globals;
mod seat;
mod util;
mod xdg;
struct ClientWlRegistry {
globals: Rc<Globals>,
}
impl ClientWlRegistry {
fn new(globals: &Rc<Globals>) -> Self {
Self {
globals: globals.clone(),
}
}
}
impl WlRegistryHandler for ClientWlRegistry {
fn handle_bind(&mut self, slf: &Rc<WlRegistry>, name: u32, id: Rc<dyn Object>) {
match id.interface() {
XdgWmBase::INTERFACE => id
.downcast::<XdgWmBase>()
.set_handler(xdg::ClientXdgWmBase {
globals: self.globals.clone(),
}),
_ => {}
}
slf.send_bind(name, id);
}
}
fn main() -> eyre::Result<()> {
env_logger::builder().parse_default_env().init();
let server = SimpleProxy::new(Baseline::V2)?;
Command::new("gtk4-demo")
.with_wayland_display(server.display())
.spawn_and_forward_exit_code()?;
Err(server.run(|| globals::ClientWlDisplay::new()).into())
}