#![allow(irrefutable_let_patterns)] mod handlers; mod audio; mod grabs; mod input; pub mod render; mod state; mod winit; mod xwayland; use smithay::reexports::{calloop::EventLoop, wayland_server::Display}; pub use state::State; fn main() -> Result<(), Box> { init_logging(); let mut event_loop = EventLoop::try_new()?; let display: Display = Display::new()?; let mut state = State::new(display, event_loop.handle())?; // Open a Wayland/X11 window for our nested compositor crate::winit::init_winit(&mut state)?; // Set WAYLAND_DISPLAY to our socket name, so child processes connect to Smallvil rather // than the host compositor unsafe { std::env::set_var("WAYLAND_DISPLAY", &state.socket_name) }; spawn_client(); if let Some(sysaudioplayer) = &state.sysaudioplayer { sysaudioplayer.blink4(); } event_loop.run(None, &mut state, move |_| { // Smallvil is running })?; Ok(()) } fn init_logging() { if let Ok(env_filter) = tracing_subscriber::EnvFilter::try_from_default_env() { tracing_subscriber::fmt().with_env_filter(env_filter).init(); } else { tracing_subscriber::fmt().init(); } } fn spawn_client() { let mut args = std::env::args().skip(1); let flag = args.next(); let arg = args.next(); match (flag.as_deref(), arg) { // (Some("-c") | Some("--command"), Some(command)) => { // std::process::Command::new(command).spawn().ok(); // } _ => { std::process::Command::new("startmde").spawn().ok(); std::process::Command::new("konsole").spawn().ok(); } } }