Added readme
This commit is contained in:
parent
4800758796
commit
1e2fb1bb4f
15
README.md
Normal file
15
README.md
Normal 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.
|
11
src/main.rs
11
src/main.rs
|
@ -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
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue