Disable screencast when PipeWire is missing
Browse files at this commite0da101c73f1c6e7728632f43d2e49e19b8787b2Parent: 47406822 changed files +8 -2
- src/dbus/mod.rs +3 -1
- src/niri.rs +5 -1
src/dbus/mod.rsmodified+3 -1
| @@ -67,7 +67,7 @@ impl DBusServers { | |||
| 67 | dbus.conn_screen_shot = try_start(screenshot); | 67 | dbus.conn_screen_shot = try_start(screenshot); |
| 68 | 68 | ||
| 69 | #[cfg(feature = "xdp-gnome-screencast")] | 69 | #[cfg(feature = "xdp-gnome-screencast")] |
| 70 | - { | 70 | + if niri.pipewire.is_some() { |
| 71 | let (to_niri, from_screen_cast) = calloop::channel::channel(); | 71 | let (to_niri, from_screen_cast) = calloop::channel::channel(); |
| 72 | niri.event_loop | 72 | niri.event_loop |
| 73 | .insert_source(from_screen_cast, { | 73 | .insert_source(from_screen_cast, { |
| @@ -82,6 +82,8 @@ impl DBusServers { | |||
| 82 | .unwrap(); | 82 | .unwrap(); |
| 83 | let screen_cast = ScreenCast::new(backend.enabled_outputs(), to_niri); | 83 | let screen_cast = ScreenCast::new(backend.enabled_outputs(), to_niri); |
| 84 | dbus.conn_screen_cast = try_start(screen_cast); | 84 | dbus.conn_screen_cast = try_start(screen_cast); |
| 85 | + } else { | ||
| 86 | + warn!("disabling screencast support because we couldn't start PipeWire"); | ||
| 85 | } | 87 | } |
| 86 | } | 88 | } |
| 87 | 89 | ||
src/niri.rsmodified+5 -1
| @@ -898,7 +898,11 @@ impl State { | |||
| 898 | } | 898 | } |
| 899 | }; | 899 | }; |
| 900 | 900 | ||
| 901 | - let pw = self.niri.pipewire.as_ref().unwrap(); | 901 | + let Some(pw) = &self.niri.pipewire else { |
| 902 | + error!("screencasting must be disabled if PipeWire is missing"); | ||
| 903 | + return; | ||
| 904 | + }; | ||
| 905 | + | ||
| 902 | match pw.start_cast( | 906 | match pw.start_cast( |
| 903 | to_niri.clone(), | 907 | to_niri.clone(), |
| 904 | gbm, | 908 | gbm, |