diff --git a/doc/wf-shadow.1 b/doc/wf-shadow.1 index 742ef0f..7deb3da 100644 --- a/doc/wf-shadow.1 +++ b/doc/wf-shadow.1 @@ -5,7 +5,7 @@ .nh .ad l .\" Begin generated content: -.TH "wf-shadow" "1" "2023-05-14" "wf-shadow" "General Commands Manual" +.TH "wf-shadow" "1" "2023-05-16" "wf-shadow" "General Commands Manual" .P .SH NAME .P @@ -47,9 +47,9 @@ clips over the course of a session'\&s lifetime.\& Sets the bash(1) \fI-x\fR option.\& .P .RE -\fB-e, --end\fR [\fIMONITOR\fR] +\fB-e, --end\fR [\fIOUTPUT\fR] .RS 4 -End the current instance running on monitor \fIMONITOR\fR.\& +End the current instance running on output \fIOUTPUT\fR.\& .P .RE \fB-h, --help\fR @@ -70,18 +70,18 @@ option disables it.\& Saved between clips over the course of a session'\&s lifetime.\& .P .RE -\fB-r, --record\fR [\fIMONITOR\fR] +\fB-r, --record\fR [\fIOUTPUT\fR] .RS 4 Record the last few moments of video using a wofi(1) menu.\& .P -This will use the same \fIMONITOR\fR number as any running session of +This will use the same \fIOUTPUT\fR number as any running session of \fBwf-shadow\fR.\& .P .RE -\fB-s, --start\fR [\fIMONITOR\fR] +\fB-s, --start\fR [\fIOUTPUT\fR] .RS 4 -Starts a wf-shadow instance on monitor number \fIMONITOR\fR, if no \fIMONITOR\fR -is specified, then use monitor #1.\& +Starts a wf-shadow instance on output number \fIOUTPUT\fR, if no \fIOUTPUT\fR +is specified, then use output #1.\& .P .RE \fB-V, --video\fR \fIDEVICE\fR @@ -143,9 +143,9 @@ after default variables are set.\& Use standard bash variable definitions in ord to set either environment variables found in \fBENVIRONMENT\fR, or the following variables.\& .P -\fBMONITOR\fR +\fBOUTPUT\fR .RS 4 -The monitor number to use to start, end, or record on.\& Default is 1.\& +The output number to use to start, end, or record on.\& Default is 1.\& .P .RE \fBAUDIO_DEV\fR @@ -193,24 +193,24 @@ This variable is non-empty if verbose output should be enabled.\& Same as .P \fBwf-shadow\fR \fI-s\fR \fI1\fR .RS 4 -Start a \fBwf-shadow\fR session on monitor #1.\& +Start a \fBwf-shadow\fR session on output #1.\& .P .RE \fBwf-shadow\fR \fI-r\fR \fI1\fR .RS 4 Show a wofi(1) menu of time intervals to save as a clip for the -\fBwf-shadow\fR session on monitor #1.\& Fails if no such session exists.\& +\fBwf-shadow\fR session on output #1.\& Fails if no such session exists.\& .P .RE \fBwf-shadow\fR \fI-e\fR \fI3\fR .RS 4 -End the \fBwf-shadow\fR session running on monitor #3.\& Fails if no such +End the \fBwf-shadow\fR session running on output #3.\& Fails if no such session exists.\& .P .RE \fBwf-shadow\fR \fI-s\fR \fI2\fR \fI-V\fR \fI/dev/dri/renderD128\fR \fI-v\fR .RS 4 -Start a \fBwf-shadow\fR session on monitor #2, using /dev/dri/renderD128 as +Start a \fBwf-shadow\fR session on output #2, using /dev/dri/renderD128 as the video encoder.\& Print verbose output.\& .P .RE diff --git a/doc/wf-shadow.1.scd b/doc/wf-shadow.1.scd index 7827009..ca6efae 100644 --- a/doc/wf-shadow.1.scd +++ b/doc/wf-shadow.1.scd @@ -32,8 +32,8 @@ and wofi(1) in order to accomplish the task. *-d, --debug* Sets the bash(1) _-x_ option. -*-e, --end* [_MONITOR_] - End the current instance running on monitor _MONITOR_. +*-e, --end* [_OUTPUT_] + End the current instance running on output _OUTPUT_. *-h, --help* Shows a simple help menu. @@ -47,15 +47,15 @@ and wofi(1) in order to accomplish the task. option disables it. Saved between clips over the course of a session's lifetime. -*-r, --record* [_MONITOR_] +*-r, --record* [_OUTPUT_] Record the last few moments of video using a wofi(1) menu. - This will use the same _MONITOR_ number as any running session of + This will use the same _OUTPUT_ number as any running session of *wf-shadow*. -*-s, --start* [_MONITOR_] - Starts a wf-shadow instance on monitor number _MONITOR_, if no _MONITOR_ - is specified, then use monitor #1. +*-s, --start* [_OUTPUT_] + Starts a wf-shadow instance on output number _OUTPUT_, if no _OUTPUT_ + is specified, then use output #1. *-V, --video* _DEVICE_ This option is passed directly to wf-recorder(1)'s _-d_ option. @@ -98,8 +98,8 @@ after default variables are set. Use standard bash variable definitions in order to set either environment variables found in *ENVIRONMENT*, or the following variables. -*MONITOR* - The monitor number to use to start, end, or record on. Default is 1. +*OUTPUT* + The output number to use to start, end, or record on. Default is 1. *AUDIO_DEV* This variable is the same as what is passed to _-a_. See *OPTIONS* for @@ -131,18 +131,18 @@ variables. # EXAMPLES *wf-shadow* _-s_ _1_ - Start a *wf-shadow* session on monitor #1. + Start a *wf-shadow* session on output #1. *wf-shadow* _-r_ _1_ Show a wofi(1) menu of time intervals to save as a clip for the - *wf-shadow* session on monitor #1. Fails if no such session exists. + *wf-shadow* session on output #1. Fails if no such session exists. *wf-shadow* _-e_ _3_ - End the *wf-shadow* session running on monitor #3. Fails if no such + End the *wf-shadow* session running on output #3. Fails if no such session exists. *wf-shadow* _-s_ _2_ _-V_ _/dev/dri/renderD128_ _-v_ - Start a *wf-shadow* session on monitor #2, using /dev/dri/renderD128 as + Start a *wf-shadow* session on output #2, using /dev/dri/renderD128 as the video encoder. Print verbose output. # EXIT STATUS diff --git a/wf-shadow b/wf-shadow index 884296d..a569dfe 100755 --- a/wf-shadow +++ b/wf-shadow @@ -26,7 +26,7 @@ if [ ! -f "$CONFIG" ]; then printf '' >> "$CONFIG" fi -MONITOR=1 +OUTPUT=1 AUDIO_DEV="" AUDIO_CODEC="" NO_AUDIO="" @@ -85,9 +85,9 @@ wf-shadow: A Wayland shadow recorder using wf-recorder and wofi USAGE: wf-shadow OPTION [OPTIONS...] OPTIONS: - -s, --start [MONITOR] Start a wf-shadow instance with display number MONITOR. - -r, --record [MONITOR] Record the last few moments of video using a wofi menu. - -e, --end [MONITOR] End wf-shadow instance with display number MONITOR. + -s, --start [OUTPUT] Start a wf-shadow instance with output number OUTPUT. + -r, --record [OUTPUT] Record the last few moments of video using a wofi menu. + -e, --end [OUTPUT] End wf-shadow instance with output number OUTPUT. -a, --audio DEVICE Use DEVICE for audio recording. Passed to wf-recorder -a. -V, --video DEVICE Use DEVICE for video encoding. Passed to wf-recorder -d. -A, --acodec CODEC Use CODEC as the audio codec in ffmpeg encoding. @@ -121,16 +121,16 @@ record() { start() { local WOFI_STRING="5 seconds\n10 seconds\n15 seconds\n30 seconds\n1 minute\n5 minutes\n10 minutes\nCancel\n" while true; do - for i in /tmp/wf-shadow/"$MONITOR"-{00..10}.mp4; do + for i in /tmp/wf-shadow/"$OUTPUT"-{00..10}.mp4; do printf '' >> "$i" if [ -n "$VERBOSE" ]; then - wf-recorder ${VIDEO_DEV:+-d "$VIDEO_DEV"} ${NO_AUDIO:--a} ${AUDIO_DEV:+"${NO_AUDIO:-$AUDIO_DEV}"} -f "$i" <<< y$'\n'$MONITOR & + wf-recorder ${VIDEO_DEV:+-d "$VIDEO_DEV"} ${NO_AUDIO:--a} ${AUDIO_DEV:+"${NO_AUDIO:-$AUDIO_DEV}"} -f "$i" <<< y$'\n'$OUTPUT & else - wf-recorder ${VIDEO_DEV:+-d "$VIDEO_DEV"} ${NO_AUDIO:--a} ${AUDIO_DEV:+"${NO_AUDIO:-$AUDIO_DEV}"} -f "$i" <<< y$'\n'$MONITOR &>/dev/null & + wf-recorder ${VIDEO_DEV:+-d "$VIDEO_DEV"} ${NO_AUDIO:--a} ${AUDIO_DEV:+"${NO_AUDIO:-$AUDIO_DEV}"} -f "$i" <<< y$'\n'$OUTPUT &>/dev/null & fi - printf "%s" "$!" > "$RUNTIME"/"$MONITOR".pid + printf "%s" "$!" > "$RUNTIME"/"$OUTPUT".pid fg || exit - . "$RUNTIME"/"$MONITOR".env + . "$RUNTIME"/"$OUTPUT".env case "$(eval "printf '$WOFI_STRING' | wofi --dmenu -i -H 500 -W 250 -x 0 -y 0 ${VERBOSE:-2>/dev/null}")" in @@ -154,7 +154,7 @@ until [ -z "$1" ]; do '-e' | '--end') END=1 if [[ "$2" =~ $re ]]; then - MONITOR="$2" + OUTPUT="$2" shift 2 else shift 1 @@ -162,7 +162,7 @@ until [ -z "$1" ]; do '-r' | '--record') RECORD=1 if [[ "$2" =~ $re ]]; then - MONITOR="$2" + OUTPUT="$2" shift 2 else shift 1 @@ -170,7 +170,7 @@ until [ -z "$1" ]; do '-s' | '--start') START=1 if [[ "$2" =~ $re ]]; then - MONITOR="$2" + OUTPUT="$2" shift 2 else shift 1 @@ -217,10 +217,10 @@ until [ -z "$1" ]; do esac done -declare -p AUDIO_CODEC > "$RUNTIME"/"$MONITOR".env -declare -p NO_AUDIO >> "$RUNTIME"/"$MONITOR".env -declare -p VIDEO_CODEC >> "$RUNTIME"/"$MONITOR".env -declare -p NO_VIDEO >> "$RUNTIME"/"$MONITOR".env +declare -p AUDIO_CODEC > "$RUNTIME"/"$OUTPUT".env +declare -p NO_AUDIO >> "$RUNTIME"/"$OUTPUT".env +declare -p VIDEO_CODEC >> "$RUNTIME"/"$OUTPUT".env +declare -p NO_VIDEO >> "$RUNTIME"/"$OUTPUT".env if [ -n "$NO_VIDEO" ] && [ -n "$NO_AUDIO" ]; then printf "Must have either audio or video recording enabled.\n" @@ -228,28 +228,28 @@ if [ -n "$NO_VIDEO" ] && [ -n "$NO_AUDIO" ]; then fi if [ "$START" == 1 ]; then - if [ ! -e "$RUNTIME"/"$MONITOR"_host.pid ]; then - printf "%s" "$$" > "$RUNTIME"/"$MONITOR"_host.pid + if [ ! -e "$RUNTIME"/"$OUTPUT"_host.pid ]; then + printf "%s" "$$" > "$RUNTIME"/"$OUTPUT"_host.pid start else - printf "A wf-shadow instance is already running on display %d (%s/%d_host.pid)\n" "$MONITOR" "$RUNTIME" "$MONITOR" + printf "A wf-shadow instance is already running on output %d (%s/%d_host.pid)\n" "$OUTPUT" "$RUNTIME" "$OUTPUT" fi fi if [ "$RECORD" == 1 ]; then - if [ -e "$RUNTIME"/"$MONITOR"_host.pid ]; then - kill -2 "$(<"$RUNTIME"/"$MONITOR".pid)" + if [ -e "$RUNTIME"/"$OUTPUT"_host.pid ]; then + kill -2 "$(<"$RUNTIME"/"$OUTPUT".pid)" else - printf "No such session on monitor %d\n" "$MONITOR" + printf "No such session on output %d\n" "$OUTPUT" fi fi if [ "$END" == 1 ]; then - if [ -e "$RUNTIME"/"$MONITOR"_host.pid ]; then - kill "$(<"$RUNTIME"/"$MONITOR"_host.pid)" - rm -f "$RUNTIME"/"$MONITOR"_host.pid - rm -f "$RUNTIME"/"$MONITOR".env + if [ -e "$RUNTIME"/"$OUTPUT"_host.pid ]; then + kill "$(<"$RUNTIME"/"$OUTPUT"_host.pid)" + rm -f "$RUNTIME"/"$OUTPUT"_host.pid + rm -f "$RUNTIME"/"$OUTPUT".env else - printf "No such session on monitor %d\n" "$MONITOR" + printf "No such session on output %d\n" "$OUTPUT" fi fi