Disable screencast when PipeWire is missing

This can cause a panic.
This commit is contained in:
Ivan Molodetskikh 2024-03-19 08:59:28 +04:00
parent 4740682904
commit e0da101c73
2 changed files with 8 additions and 2 deletions

View File

@ -67,7 +67,7 @@ impl DBusServers {
dbus.conn_screen_shot = try_start(screenshot);
#[cfg(feature = "xdp-gnome-screencast")]
{
if niri.pipewire.is_some() {
let (to_niri, from_screen_cast) = calloop::channel::channel();
niri.event_loop
.insert_source(from_screen_cast, {
@ -82,6 +82,8 @@ impl DBusServers {
.unwrap();
let screen_cast = ScreenCast::new(backend.enabled_outputs(), to_niri);
dbus.conn_screen_cast = try_start(screen_cast);
} else {
warn!("disabling screencast support because we couldn't start PipeWire");
}
}

View File

@ -898,7 +898,11 @@ impl State {
}
};
let pw = self.niri.pipewire.as_ref().unwrap();
let Some(pw) = &self.niri.pipewire else {
error!("screencasting must be disabled if PipeWire is missing");
return;
};
match pw.start_cast(
to_niri.clone(),
gbm,