From 1e2fb1bb4fcb65a34b60fa81be9e479e9a4b6f37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20B=C3=A4dorf?= Date: Sun, 10 May 2020 15:01:08 +0200 Subject: [PATCH] Added readme --- README.md | 15 +++++++++++++++ src/main.rs | 11 +++++++++++ 2 files changed, 26 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..47bc687 --- /dev/null +++ b/README.md @@ -0,0 +1,15 @@ +# stream-screen + +Wrapper around `wf-recorder` and `ffmpeg` that automatically switches the screen being recorded based on current window focus. Works with `sway`. + +## Installation + +1. Make sure you're running sway +2. Install `wf-recorder` and `ffmpeg` +3. Install the rust toolchain +4. Clone this repo +5. `cargo install --path . --root ~/.local` + +## Usage + +See `--help`. If there are no screens available for streaming, a black screen will be shown instead. diff --git a/src/main.rs b/src/main.rs index 9aa2d6b..e882c89 100644 --- a/src/main.rs +++ b/src/main.rs @@ -18,6 +18,10 @@ fn help() { println!(" --not-ws Do not show this workspace. Can be used multiple times. Example: 3"); println!(" --not-screen Do not show this screen. Can be used multiple times. Example: HDMI-A-1"); println!(" -o|--output Output to this device. Defaults to /dev/video0"); + println!(""); + println!( + "If there are no screens available for streaming, a black screen will be shown instead." + ); std::process::exit(0); } @@ -36,6 +40,9 @@ fn record_screen(config: &mut Config, valid_screens: &Vec) -> Result) -> Result Result<(), Box> { let stdout = match Command::new("bash") .args(&["-c", "swaymsg -t subscribe -m \"['window']\""]) .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .stdin(Stdio::piped()) .spawn()? .stdout {