feat: video/state_machine unit tests and on_video_completed logic fix

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
showen
2026-03-12 08:20:25 +08:00
parent 8ed9c93c8e
commit 45c0a8d54b
5 changed files with 551 additions and 17 deletions

View File

@@ -28,7 +28,8 @@ impl ScreenPlugin {
}
match Command::new("systemd-inhibit")
.arg("--what=idle")
.arg("--what=idle:sleep")
.arg("--mode=block")
.arg("--who=ShowenV2")
.arg("--why=Prevent screen lock during playback")
.arg("sleep")
@@ -66,6 +67,13 @@ impl ScreenPlugin {
}
if hidden {
let _ = Command::new("pkill")
.args(["-f", "unclutter"])
.stdin(Stdio::null())
.stdout(Stdio::null())
.stderr(Stdio::null())
.status();
match Command::new("unclutter")
.arg("-idle")
.arg("0")
@@ -80,7 +88,7 @@ impl ScreenPlugin {
}
} else {
match Command::new("pkill")
.arg("unclutter")
.args(["-f", "unclutter"])
.stdin(Stdio::null())
.stdout(Stdio::null())
.stderr(Stdio::null())
@@ -118,6 +126,10 @@ impl Plugin for ScreenPlugin {
}
}
fn dependencies(&self) -> Vec<&'static str> {
vec![]
}
fn init(&mut self, ctx: PluginContext) -> Result<()> {
self.ctx = Some(ctx);
Ok(())