diff --git a/src/backend/kms/mod.rs b/src/backend/kms/mod.rs index ae887c30..0950de44 100644 --- a/src/backend/kms/mod.rs +++ b/src/backend/kms/mod.rs @@ -168,9 +168,13 @@ pub fn init_backend( } } - // start x11 - let primary = *state.backend.kms().primary_node.read().unwrap(); - state.launch_xwayland(primary); + if state.common.with_xwayland { + // start x11 + let primary = *state.backend.kms().primary_node.read().unwrap(); + state.launch_xwayland(primary); + } else { + state.notify_ready(); + } Ok(()) } diff --git a/src/backend/winit.rs b/src/backend/winit.rs index 984c95b4..a35b0c98 100644 --- a/src/backend/winit.rs +++ b/src/backend/winit.rs @@ -241,7 +241,12 @@ pub fn init_backend( } state.common.refresh(); } - state.launch_xwayland(None); + + if state.common.with_xwayland { + state.launch_xwayland(None); + } else { + state.notify_ready(); + } Ok(()) } diff --git a/src/backend/x11.rs b/src/backend/x11.rs index 18ddb8ae..d5a95bd6 100644 --- a/src/backend/x11.rs +++ b/src/backend/x11.rs @@ -384,7 +384,12 @@ pub fn init_backend( } state.common.refresh(); } - state.launch_xwayland(None); + + if state.common.with_xwayland { + state.launch_xwayland(None); + } else { + state.notify_ready(); + } event_loop .handle() diff --git a/src/lib.rs b/src/lib.rs index 0fbb38d2..04d122e2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -109,6 +109,7 @@ pub fn run(hooks: crate::hooks::Hooks) -> Result<(), Box> { let mut cursor = raw_args.cursor(); let git_hash = option_env!("GIT_HASH").unwrap_or("unknown"); + let mut with_xwayland = true; // Parse the arguments while let Some(arg) = raw_args.next_os(&mut cursor) { match arg.to_str() { @@ -116,6 +117,10 @@ pub fn run(hooks: crate::hooks::Hooks) -> Result<(), Box> { print_help(env!("CARGO_PKG_VERSION"), git_hash); return Ok(()); } + Some("--no-xwayland") => { + tracing::info!("Running without Xwayland"); + with_xwayland = false; + } Some("--version") | Some("-V") => { println!( "cosmic-comp {} (git commit {})", @@ -152,6 +157,7 @@ pub fn run(hooks: crate::hooks::Hooks) -> Result<(), Box> { socket, event_loop.handle(), event_loop.get_signal(), + with_xwayland, ); // init backend backend::init_backend_auto(&display, &mut event_loop, &mut state)?; @@ -239,8 +245,9 @@ Designed for the COSMICâ„¢ desktop environment, cosmic-comp is a Wayland Composi Project home page: https://github.com/pop-os/cosmic-comp Options: - -h, --help Show this message - -v, --version Show the version of cosmic-comp"# + -h, --help Show this message + --no-xwayland Run without Xwayland + -v, --version Show the version of cosmic-comp"# ); } diff --git a/src/state.rs b/src/state.rs index b10c4d8a..a251d2c6 100644 --- a/src/state.rs +++ b/src/state.rs @@ -296,6 +296,8 @@ pub struct Common { #[cfg(feature = "systemd")] pub inhibit_lid_fd: Option, + + pub with_xwayland: bool, } #[derive(Debug)] @@ -626,6 +628,7 @@ impl State { socket: OsString, handle: LoopHandle<'static, State>, signal: LoopSignal, + with_xwayland: bool, ) -> State { let requested_languages = DesktopLanguageRequester::requested_languages(); i18n_embed::select(&*LANG_LOADER, &Localizations, &requested_languages) @@ -801,6 +804,8 @@ impl State { #[cfg(feature = "systemd")] inhibit_lid_fd: None, + + with_xwayland, }, backend: BackendData::Unset, ready: Once::new(),