feat: preview host process

This commit is contained in:
elwrcl committed 2026-09-30 13:28:19 +03:00
1 parent c670c28985
commit 7267885d0d
3 files changed
+499 -1

No files matched your search

+12
View File
@@ -7,6 +7,7 @@ mod detach;
mod doctor;
mod error;
mod frame;
mod host;
mod ipc;
mod lock;
mod log;
@@ -59,6 +60,9 @@ enum Command {
},
/// Report what the compositor and system support.
Doctor,
/// Internal: the process that shows preview thumbnails.
#[command(name = "__preview-host", hide = true)]
PreviewHost,
}
#[derive(Args)]
@@ -115,6 +119,7 @@ fn main() -> ExitCode {
fn run(cli: Cli) -> Result<()> {
match cli.command {
Command::Doctor => doctor::run(),
Command::PreviewHost => host::run(),
Command::Screen { all, common } => capture(Mode::Screen { all }, common),
Command::Region { common } => capture(Mode::Region, common),
}
@@ -246,6 +251,13 @@ mod tests {
assert!(!parses(&["region", "--clipboard-only", "-o", "a.png"]));
}
#[test]
fn preview_host_is_hidden_from_help() {
assert!(parses(&["__preview-host"]));
let help = Cli::command().render_help().to_string();
assert!(!help.contains("preview-host"), "{help}");
}
#[test]
fn delay_values() {
assert_eq!(parse_delay("1.5"), Ok(Duration::from_millis(1500)));