🐛 Whoops, I'm supposed to use WAYLAND_DISPLAY, not WAYLAND_SOCKET (thanks @Drakulix!)

This commit is contained in:
Lucy 2022-06-24 20:36:49 -04:00
parent 1350cd4335
commit be2b800716
No known key found for this signature in database
GPG key ID: EBC517FAD666BBF1
3 changed files with 18 additions and 19 deletions

View file

@ -3,12 +3,10 @@ use crate::process::{ProcessEvent, ProcessHandler};
use tokio::sync::{mpsc::unbounded_channel, oneshot};
use tokio_util::sync::CancellationToken;
pub async fn run_compositor(token: CancellationToken, wayland_socket_tx: oneshot::Sender<String>) {
let mut wayland_socket_tx = Some(wayland_socket_tx);
pub async fn run_compositor(token: CancellationToken, wayland_display_tx: oneshot::Sender<String>) {
let mut wayland_display_tx = Some(wayland_display_tx);
let (tx, mut rx) = unbounded_channel::<ProcessEvent>();
ProcessHandler::new(tx, &token).run("cosmic-comp", vec![], vec![]);
let span = info_span!("cosmic-comp");
let _enter = span.enter();
while let Some(event) = rx.recv().await {
match event {
ProcessEvent::Started => {
@ -18,13 +16,13 @@ pub async fn run_compositor(token: CancellationToken, wayland_socket_tx: oneshot
ProcessEvent::Stdout(line) | ProcessEvent::Stderr(line) => {
if line.contains("Listening on \"") {
// Message format: Listening on "wayland-0"
if let Some(tx) = wayland_socket_tx.take() {
if let Some(tx) = wayland_display_tx.take() {
let socket_name = line
.split('"')
.nth(1)
.expect("failed to get WAYLAND_SOCKET");
.expect("failed to get WAYLAND_DISPLAY");
tx.send(socket_name.to_string())
.expect("failed to send WAYLAND_SOCKET back to main app");
.expect("failed to send WAYLAND_DISPLAY back to main app");
}
}
info!("{}", line);