Get WAYLAND_SOCKET from comp; run cosmic-panel

This commit is contained in:
Lucy 2022-06-24 12:56:38 -04:00
parent 8bf6567a91
commit fb1a832916
No known key found for this signature in database
GPG key ID: EBC517FAD666BBF1
3 changed files with 60 additions and 8 deletions

View file

@ -3,11 +3,13 @@
extern crate tracing;
mod comp;
mod panel;
mod process;
use async_signals::Signals;
use color_eyre::{eyre::WrapErr, Result};
use futures_util::StreamExt;
use tokio::sync::oneshot;
use tokio_util::sync::CancellationToken;
use tracing::metadata::LevelFilter;
use tracing_subscriber::{fmt, prelude::*, EnvFilter};
@ -29,8 +31,15 @@ async fn main() -> Result<()> {
info!("Starting cosmic-session");
let token = CancellationToken::new();
let (wayland_socket_tx, wayland_socket_rx) = oneshot::channel();
tokio::spawn(comp::run_compositor(token.child_token(), wayland_socket_tx));
let wayland_socket = wayland_socket_rx
.await
.expect("failed to get WAYLAND_SOCKET");
info!("got WAYLAND_SOCKET: {}", wayland_socket);
std::env::set_var("WAYLAND_SOCKET", wayland_socket);
tokio::spawn(comp::run_compositor(token.child_token()));
tokio::spawn(panel::run_panel(token.child_token()));
let mut signals = Signals::new(vec![libc::SIGTERM, libc::SIGINT]).unwrap();
while let Some(signal) = signals.next().await {
@ -38,7 +47,7 @@ async fn main() -> Result<()> {
libc::SIGTERM | libc::SIGINT => {
info!("received request to terminate");
token.cancel();
tokio::time::sleep(std::time::Duration::from_secs(5)).await;
tokio::time::sleep(std::time::Duration::from_secs(2)).await;
break;
}
_ => unreachable!("received unhandled signal {}", signal),