This commit is contained in:
Ashley Wulber 2022-06-16 12:23:25 -04:00
parent c67f6fdb2d
commit 554bdfe19b
5 changed files with 30 additions and 19 deletions

View file

@ -2,7 +2,7 @@ use crate::utils::{Activate};
use std::{env, os::unix::net::UnixStream, path::PathBuf};
use tokio::sync::mpsc;
use wayland_client::{
protocol::{wl_output::WlOutput, wl_registry},
protocol::{wl_output::{WlOutput, self}, wl_registry},
ConnectError,
};
@ -40,11 +40,11 @@ pub fn spawn_workspaces(tx: mpsc::Sender<State>) -> mpsc::Sender<Activate> {
let (workspaces_tx, mut workspaces_rx) = mpsc::channel(100);
if let Ok(Ok(conn)) = std::env::var("HOST_WAYLAND_DISPLAY")
.map_err(anyhow::Error::msg)
.map(|fd| {
.map(|display_str| {
let mut socket_path = env::var_os("XDG_RUNTIME_DIR")
.map(Into::<PathBuf>::into)
.ok_or(ConnectError::NoCompositor)?;
socket_path.push(env::var_os("WAYLAND_DISPLAY").ok_or(ConnectError::NoCompositor)?);
socket_path.push(display_str);
Ok(UnixStream::connect(socket_path).map_err(|_| ConnectError::NoCompositor)?)
})
@ -128,6 +128,10 @@ impl Dispatch<wl_registry::WlRegistry, ()> for State {
.unwrap();
self.workspace_manager = Some(workspace_manager);
}
"wl_output" => {
println!("binding to output");
registry.bind::<WlOutput, _, _>(name, 1, qh, ()).unwrap();
}
_ => {}
}
}
@ -267,3 +271,14 @@ impl Dispatch<ZextWorkspaceHandleV1, ()> for State {
}
}
}
impl Dispatch<WlOutput, ()> for State {
fn event(
&mut self,
_: &WlOutput,
_: wl_output::Event,
_: &(),
_: &Connection,
_: &QueueHandle<Self>,
) {}
}