Added readme

master
Benjamin Bädorf 2020-05-10 15:01:08 +02:00
parent 4800758796
commit 1e2fb1bb4f
No known key found for this signature in database
GPG Key ID: 4406E80E13CD656C
2 changed files with 26 additions and 0 deletions

15
README.md Normal file
View File

@ -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.

View File

@ -18,6 +18,10 @@ fn help() {
println!(" --not-ws <ws-num> Do not show this workspace. Can be used multiple times. Example: 3");
println!(" --not-screen <screen> Do not show this screen. Can be used multiple times. Example: HDMI-A-1");
println!(" -o|--output <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<String>) -> Result<Chi
"v4l2",
config.output.as_str(),
])
.stdin(Stdio::piped())
.stdout(Stdio::piped())
.stderr(Stdio::piped())
.spawn()?;
config.current_screen = "".to_string();
@ -52,6 +59,8 @@ fn record_screen(config: &mut Config, valid_screens: &Vec<String>) -> Result<Chi
output_str.as_str(),
])
.stdin(Stdio::piped())
.stdout(Stdio::piped())
.stderr(Stdio::piped())
.spawn()?;
cmd.stdin
@ -146,6 +155,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let stdout = match Command::new("bash")
.args(&["-c", "swaymsg -t subscribe -m \"['window']\""])
.stdout(Stdio::piped())
.stderr(Stdio::piped())
.stdin(Stdio::piped())
.spawn()?
.stdout
{