forge
Explore
Log in

Don't you dare go Hollow

b98f4906da021c2d37729b73f0e8fc4f84a7bc4aIvan MolodetskikhParent: e82830c
niri-ipc/src/lib.rsmodified+17 -0
@@ -1490,6 +1490,8 @@ pub struct Cast {
14901490 ///
14911491 /// Do not confuse `session_id` with [`stream_id`](Self::stream_id).
14921492 pub session_id: u64,
1493+ /// Kind of this screencast.
1494+ pub kind: CastKind,
14931495 /// Target being captured.
14941496 pub target: CastTarget,
14951497 /// Whether this is a Dynamic Cast Target screencast.
@@ -1505,6 +1507,21 @@ pub struct Cast {
15051507 pub is_active: bool,
15061508 }
15071509
1510+/// Kind of screencast.
1511+#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq)]
1512+#[cfg_attr(feature = "json-schema", derive(schemars::JsonSchema))]
1513+pub enum CastKind {
1514+ /// PipeWire screencast, typically via xdg-desktop-portal-gnome.
1515+ PipeWire,
1516+ /// wlr-screencopy protocol screencast.
1517+ ///
1518+ /// Tools like wf-recorder, and the xdg-desktop-portal-wlr portal.
1519+ ///
1520+ /// Only wlr-screencopy with damage tracking is reported here. Screencopy without damage is
1521+ /// treated as a regular screenshot and not reported as a screencast.
1522+ WlrScreencopy,
1523+}
1524+
15081525 /// Target of a screencast.
15091526 #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
15101527 #[cfg_attr(feature = "json-schema", derive(schemars::JsonSchema))]
src/ipc/client.rsmodified+7 -1
@@ -7,7 +7,7 @@ use anyhow::{anyhow, bail, Context};
77 use niri_config::OutputName;
88 use niri_ipc::socket::Socket;
99 use niri_ipc::{
10- Action, Cast, CastTarget, Event, KeyboardLayouts, LogicalOutput, Mode, Output,
10+ Action, Cast, CastKind, CastTarget, Event, KeyboardLayouts, LogicalOutput, Mode, Output,
1111 OutputConfigChanged, Overview, Request, Response, Transform, Window, WindowLayout,
1212 };
1313 use serde_json::json;
@@ -743,6 +743,12 @@ fn print_cast(cast: &Cast) {
743743 println!("Cast stream ID {}:{active}", cast.stream_id);
744744 println!(" Session ID: {}", cast.session_id);
745745
746+ let kind = match cast.kind {
747+ CastKind::PipeWire => "PipeWire",
748+ CastKind::WlrScreencopy => "wlr-screencopy",
749+ };
750+ println!(" Kind: {kind}");
751+
746752 match &cast.target {
747753 CastTarget::Nothing {} => {
748754 println!(" Target: nothing (cleared)");
src/ipc/server.rsmodified+3 -0
@@ -825,6 +825,7 @@ impl State {
825825 let cast = niri_ipc::Cast {
826826 session_id: pending.session_id.get(),
827827 stream_id,
828+ kind: niri_ipc::CastKind::PipeWire,
828829 target: niri_ipc::CastTarget::Nothing {},
829830 is_dynamic_target: true,
830831 is_active: false,
@@ -845,6 +846,7 @@ impl State {
845846 let cast = niri_ipc::Cast {
846847 session_id: cast.session_id.get(),
847848 stream_id,
849+ kind: niri_ipc::CastKind::PipeWire,
848850 target: cast.target.make_ipc(),
849851 is_dynamic_target: cast.dynamic_target,
850852 is_active: cast.is_active(),
@@ -870,6 +872,7 @@ impl State {
870872 let cast = niri_ipc::Cast {
871873 session_id: cast_info.session_id.get(),
872874 stream_id,
875+ kind: niri_ipc::CastKind::WlrScreencopy,
873876 target: niri_ipc::CastTarget::Output {
874877 name: cast_info.output_name.clone(),
875878 },