pop-os / cosmic-epoch

Next generation Cosmic desktop environment
1.7k stars 54 forks source link

Help with running Niri with Cosmic DE #318

Open billksun opened 1 month ago

billksun commented 1 month ago

Now that Cosmic is nearing Alpha status, I finally followed up on my previous inquiry on the feasibility of running 3rd-party compositors with Cosmic DE (#151).

Following @Drakulix's comment, I attempted to patch cosmic-session to launch niri instead. The result is that Niri was able to launch (nice!), however, none of the cosmic clients (panel, notifications, dock ... etc) started. Here's the boot log error:

.cosmic-panel-wrapped[2105]: Failed to connect to the notifications daemon Ok(Err(environment variable not found))
.cosmic-panel-wrapped[2105]: Failed to initialize fractional scaling manager
.cosmic-panel-wrapped[2105]: thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: NotPresent': /build/cargo-vendor-dir/cosmic-client-toolkit-0.1.0/src/toplevel_info.rs:40
                                                                              0: <backtrace::capture::Backtrace as core::default::Default>::default
                                                                              1: log_panics::Config::install_panic_hook::{{closure}}
                                                                              2: std::panicking::rust_panic_with_hook
                                                                              3: std::panicking::begin_panic_handler::{{closure}}
                                                                              4: std::sys_common::backtrace::__rust_end_short_backtrace
                                                                              5: rust_begin_unwind
                                                                              6: core::panicking::panic_fmt
                                                                              7: core::result::unwrap_failed
                                                                              8: cosmic_client_toolkit::toplevel_info::ToplevelInfoState::new
                                                                              9: cosmic_panel::main
                                                                             10: std::sys_common::backtrace::__rust_begin_short_backtrace
                                                                             11: std::rt::lang_start::{{closure}}
                                                                             12: std::rt::lang_start_internal
                                                                             13: main
                                                                             14: __libc_start_call_main
                                                                             15: __libc_start_main@@GLIBC_2.34
                                                                             16: _start

Code that paniced above: https://github.com/pop-os/cosmic-protocols/blob/1316f9e1148ec65351471d8a046ffc82171b066e/client-toolkit/src/toplevel_info.rs#L40

Aside from this, I also noticed that cosmic-session retrieves environment variables via IPC from the compositor, and this part seems to never return...at least, the error message associated was never printed to the log and the subsequent "success" entry also was not written to the log output. However, the panel attempting to load seems to suggest that the code isn't blocking?

I'm keeping my fingers crossed, I hope there isn't any huge blockers preventing from using Niri with Cosmic. Let me know what I can do to help :)

jokeyrhyme commented 1 month ago

You probably want to avoid using cosmic-session altogether, as it makes lots of assumptions about COSMIC that won't be true if you start replacing pieces here and there

For now, perhaps create your own script or equivalent of cosmic-session that is able to work with the way that niri exposes the environment variables