feat: add --no-xwayland argument for running without Xwayland

This leaves the default behavior in place. When --no-xwayland
is not passed, Xwayland is started. If it is passed, then
starting Xwayland is skipped.
This commit is contained in:
RoyalOughtness 2026-01-24 16:30:47 -08:00 committed by Jacob Kauffmann
parent 7aa0942ec1
commit 98cca4f3b7
5 changed files with 33 additions and 7 deletions

View file

@ -168,9 +168,13 @@ pub fn init_backend(
}
}
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(())
}

View file

@ -241,7 +241,12 @@ pub fn init_backend(
}
state.common.refresh();
}
if state.common.with_xwayland {
state.launch_xwayland(None);
} else {
state.notify_ready();
}
Ok(())
}

View file

@ -384,7 +384,12 @@ pub fn init_backend(
}
state.common.refresh();
}
if state.common.with_xwayland {
state.launch_xwayland(None);
} else {
state.notify_ready();
}
event_loop
.handle()

View file

@ -109,6 +109,7 @@ pub fn run(hooks: crate::hooks::Hooks) -> Result<(), Box<dyn Error>> {
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<dyn Error>> {
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<dyn Error>> {
socket,
event_loop.handle(),
event_loop.get_signal(),
with_xwayland,
);
// init backend
backend::init_backend_auto(&display, &mut event_loop, &mut state)?;
@ -240,6 +246,7 @@ Project home page: https://github.com/pop-os/cosmic-comp
Options:
-h, --help Show this message
--no-xwayland Run without Xwayland
-v, --version Show the version of cosmic-comp"#
);
}

View file

@ -296,6 +296,8 @@ pub struct Common {
#[cfg(feature = "systemd")]
pub inhibit_lid_fd: Option<OwnedFd>,
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(),