From 4216d7fd6fb98222a6b69dd9a6c172e1923419c3 Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Wed, 28 Oct 2026 20:00:00 -0700 Subject: [PATCH] feat(doctor): say what KWin needs to offer the screencast, on Linux KWin offers zkde_screencast_unstable_v1 only to a program whose desktop file lists it. The note has the file to write, with the path of this executable in it. --- komorebi-recorder/src/doctor.rs | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/komorebi-recorder/src/doctor.rs b/komorebi-recorder/src/doctor.rs index 60178216..019db505 100644 --- a/komorebi-recorder/src/doctor.rs +++ b/komorebi-recorder/src/doctor.rs @@ -334,14 +334,16 @@ pub fn report() -> Report { )); } + let permitted = platform::capture::has_permission(); let capture = CaptureReport { supported, - permitted: platform::capture::has_permission(), + permitted, video_decoding: crate::av::supported(), - note: (!platform::capture::has_permission()).then(|| { - "screen recording permission has not been granted to this terminal or app".to_string() - }), + note: (!permitted).then(permission_note), }; + if supported && !permitted && cfg!(target_os = "linux") { + warnings.push(permission_note()); + } if !capture.video_decoding { warnings.push(format!( "playing back a recording's video is not built for {} yet", @@ -567,6 +569,25 @@ fn clock_report() -> ClockReport { } } +/// What is missing when the screen cannot be captured, for this host. +fn permission_note() -> String { + if cfg!(target_os = "linux") { + let exe = std::env::current_exe().map_or_else( + |_| "komorebi-recorder".to_string(), + |path| path.display().to_string(), + ); + format!( + "KWin offers its screencast only to a program whose desktop file lists it: write \ + ~/.local/share/applications/komorebi-recorder.desktop with Type=Application, \ + Name=komorebi-recorder, Exec={exe}, NoDisplay=true and \ + X-KDE-Wayland-Interfaces=zkde_screencast_unstable_v1, then start the recorder again \ + (see docs/PLATFORM.md)" + ) + } else { + "screen recording permission has not been granted to this terminal or app".to_string() + } +} + fn clock_kind() -> platform::ClockKind { platform::clock::KIND }