From d122fa42b83ec0b22b4b402f9a48122037b0ba35 Mon Sep 17 00:00:00 2001 From: "Skylar \"The Cobra\" Widulski" Date: Wed, 17 May 2023 18:27:19 -0400 Subject: [PATCH] Add version information Signed-off-by: Skylar "The Cobra" Widulski --- doc/wf-shadow-tui.1 | 40 ++++++++++++++++++++++++++++++++++++++++ doc/wf-shadow-tui.1.scd | 29 +++++++++++++++++++++++++++++ doc/wf-shadow.1 | 14 ++++++++++++-- doc/wf-shadow.1.scd | 10 ++++++++-- wf-shadow | 19 ++++++++++++++----- wf-shadow-tui | 36 +++++++++++++++++++++++++++++------- 6 files changed, 132 insertions(+), 16 deletions(-) create mode 100644 doc/wf-shadow-tui.1 create mode 100644 doc/wf-shadow-tui.1.scd diff --git a/doc/wf-shadow-tui.1 b/doc/wf-shadow-tui.1 new file mode 100644 index 0000000..a53ea91 --- /dev/null +++ b/doc/wf-shadow-tui.1 @@ -0,0 +1,40 @@ +.\" Generated by scdoc 1.11.2 +.\" Complete documentation for this program is not available as a GNU info page +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.nh +.ad l +.\" Begin generated content: +.TH "wf-shadow-tui" "1" "2023-05-17" "wf-shadow" "General Commands Manual" +.P +.SH NAME +.P +\fBwf-shadow-tui\fR — A TUI menu system for wf-shadow(1) +.P +.SH SYNOPSIS +.P +\fBwf-shadow-tui\fR [\fIOPTION\fR] +.P +.SH DESCRIPTION +.P +\fBwf-shadow-tui\fR is a script intended to simplify the use of wf-shadow(1) by +displaying a dialog(1)-based curses menu to the user.\& +.P +.SH OPTIONS +.P +\fB-h, --help\fR +.RS 4 +Show a help menu.\& +.P +.RE +\fB-v, --version\fR +.RS 4 +Get version number of \fBwf-shadow-tui\fR.\& +.P +.RE +.SH SEE ALSO +.P +wf-shadow(1) dialog(1) wlr-randr(1) +.P +.SH AUTHOR +Skylar "The Cobra" Widulski diff --git a/doc/wf-shadow-tui.1.scd b/doc/wf-shadow-tui.1.scd new file mode 100644 index 0000000..63f34bd --- /dev/null +++ b/doc/wf-shadow-tui.1.scd @@ -0,0 +1,29 @@ +wf-shadow-tui(1) "wf-shadow" "General Commands Manual" + +# NAME + +*wf-shadow-tui* — A TUI menu system for wf-shadow(1) + +# SYNOPSIS + +*wf-shadow-tui* [_OPTION_] + +# DESCRIPTION + +*wf-shadow-tui* is a script intended to simplify the use of wf-shadow(1) by +displaying a dialog(1)-based curses menu to the user. + +# OPTIONS + +*-h, --help* + Show a help menu. + +*-v, --version* + Get version number of *wf-shadow-tui*. + +# SEE ALSO + +wf-shadow(1) dialog(1) wlr-randr(1) + +# AUTHOR +Skylar "The Cobra" Widulski diff --git a/doc/wf-shadow.1 b/doc/wf-shadow.1 index bccb2b9..0742b56 100644 --- a/doc/wf-shadow.1 +++ b/doc/wf-shadow.1 @@ -66,6 +66,11 @@ By default, \fBwf-shadow\fR enables the -a option of wf-recorder(1).\& This option disables it.\& .P .RE +\fB-R, --raw-record\fR +.RS 4 +Pass arguments directly to the record function.\& Somewhat like an API.\& +.P +.RE \fB-r, --record\fR [\fIOUTPUT\fR] .RS 4 Record the last few moments of video using a wofi(1) menu.\& Any arbitrary @@ -101,6 +106,11 @@ Enable video recording.\& Overrides \fI-N\fR.\& Enable audio recording.\& Overrides \fI-n\fR.\& .P .RE +\fB--version\fR +.RS 4 +Display version information of \fBwf-shadow\fR and its dependencies.\& +.P +.RE .SH ENVIRONMENT .P \fBWF_SHADOW_DIR\fR @@ -211,7 +221,7 @@ the video encoder.\& Print verbose output.\& .RE .SH SEE ALSO .P -wf-recorder(1) wofi(1) ffmpeg(1) pactl(1) date(1) bash(1) +wf-shadow-tui(1) wf-recorder(1) wofi(1) ffmpeg(1) pactl(1) date(1) bash(1) .P .SH AUTHOR -Skylar "The Cobra" Widulski +Skylar "The Cobra" Widulski diff --git a/doc/wf-shadow.1.scd b/doc/wf-shadow.1.scd index 8e6ad71..03c104d 100644 --- a/doc/wf-shadow.1.scd +++ b/doc/wf-shadow.1.scd @@ -43,6 +43,9 @@ and wofi(1) in order to accomplish the task. By default, *wf-shadow* enables the -a option of wf-recorder(1). This option disables it. +*-R, --raw-record* + Pass arguments directly to the record function. Somewhat like an API. + *-r, --record* [_OUTPUT_] Record the last few moments of video using a wofi(1) menu. Any arbitrary number of seconds can be input. @@ -66,6 +69,9 @@ and wofi(1) in order to accomplish the task. *-y, --yes-audio* Enable audio recording. Overrides _-n_. +*--version* + Display version information of *wf-shadow* and its dependencies. + # ENVIRONMENT *WF_SHADOW_DIR* @@ -142,7 +148,7 @@ variables. # SEE ALSO -wf-recorder(1) wofi(1) ffmpeg(1) pactl(1) date(1) bash(1) +wf-shadow-tui(1) wf-recorder(1) wofi(1) ffmpeg(1) pactl(1) date(1) bash(1) # AUTHOR -Skylar "The Cobra" Widulski +Skylar "The Cobra" Widulski diff --git a/wf-shadow b/wf-shadow index 48bb50a..4f94ce0 100755 --- a/wf-shadow +++ b/wf-shadow @@ -15,6 +15,8 @@ # this program. If not, see . # +VER='v1.5.5' + RUNTIME="${XDG_RUNTIME_DIR:-/run}/wf-shadow" CONFIG="${WF_SHADOW_CONFIG:-${XDG_CONFIG_HOME:-$HOME/.config}/wf-shadow/config.sh}" @@ -74,11 +76,6 @@ if ! command -v wf-recorder &>/dev/null; then exit 1 fi -if ! command -v wofi &>/dev/null; then - printf "Need wofi\n" - exit 1 -fi - print_help() { cat << EOF wf-shadow: A Wayland shadow recorder using wf-recorder and wofi @@ -100,6 +97,7 @@ OPTIONS: -R, --raw-record OUTPUT FILE SECONDS Low level record. Passed directly to the \`record\` function. -v, --verbose Verbose output. -h, --help Show this menu. + --version Display version information. For a more in-depth guide, see wf-shadow(1) EOF @@ -212,6 +210,13 @@ until [ -z "$1" ]; do '-v' | '--verbose') VERBOSE=" " shift 1 ;; + '--version') + printf "wf-shadow %s\n" "$VER" + wf-recorder -v + if command -v wofi &>/dev/null; then + printf "wofi %s\n" "$(wofi -v)" + fi + exit ;; *) print_help ;; esac done @@ -238,6 +243,10 @@ if [ "$RAW_RECORD" == 1 ]; then fi if [ "$RECORD" == 1 ]; then + if ! command -v wofi &>/dev/null; then + printf "Need wofi\n" + exit 1 + fi if [ -e "$RUNTIME"/"$OUTPUT"_host.pid ]; then WOFI_STRING="5 seconds\n10 seconds\n15 seconds\n30 seconds\n1 minute\n5 minutes\n10 minutes\nCancel\n" TIME="$(eval "printf '$WOFI_STRING' | wofi --dmenu -i -H 500 -W 250 -x 0 -y 0 ${VERBOSE:-2>/dev/null}")" diff --git a/wf-shadow-tui b/wf-shadow-tui index f435161..78e658b 100755 --- a/wf-shadow-tui +++ b/wf-shadow-tui @@ -15,6 +15,8 @@ # this program. If not, see . # +VER="v1.3.0" + RUNTIME="${XDG_RUNTIME_DIR:-/run}/wf-shadow" CONFIG="${WF_SHADOW_CONFIG:-${XDG_CONFIG_HOME:-$HOME/.config}/wf-shadow/config.sh}" @@ -156,16 +158,16 @@ get_option_wrap() { unset OPTION get_option case "$OPTION" in - AUDIO_DEV) AUDIO_DEV="$(option_inputbox AUDIO_DEV 120 $(pactl list sources | sed -n 's/\s*Name:\s*\(.*\)/\1/p' | tail -1 2>/dev/null))" ;; - AUDIO_CODEC) AUDIO_CODEC="$(option_inputbox AUDIO_CODEC 24 aac)" ;; + AUDIO_DEV) AUDIO_DEV="$(option_inputbox AUDIO_DEV 120 ${AUDIO_DEV:-$(pactl list sources | sed -n 's/\s*Name:\s*\(.*\)/\1/p' | tail -1 2>/dev/null)})" ;; + AUDIO_CODEC) AUDIO_CODEC="$(option_inputbox AUDIO_CODEC 24 ${AUDIO_CODEC:-aac})" ;; NO_AUDIO) NO_AUDIO="$(option_yesno AUDIO)" ;; - VIDEO_DEV) VIDEO_DEV="$(option_inputbox VIDEO_DEV 64 /dev/dri/renderD128)" ;; - VIDEO_CODEC) VIDEO_CODEC="$(option_inputbox VIDEO_CODEC 24 libx264)" ;; + VIDEO_DEV) VIDEO_DEV="$(option_inputbox VIDEO_DEV 64 ${VIDEO_DEV:-/dev/dri/renderD128})" ;; + VIDEO_CODEC) VIDEO_CODEC="$(option_inputbox VIDEO_CODEC 24 ${VIDEO_CODEC:-libx264})" ;; NO_VIDEO) NO_VIDEO="$(option_yesno VIDEO)" ;; WF_SHADOW_DIR) WF_SHADOW_DIR="$(option_dir)" ;; - WF_SHADOW_FMT) WF_SHADOW_FMT="$(option_inputbox WF_SHADOW_FMT 24 %Y%m%d_%H:%M:%S)" ;; - WF_SHADOW_EXT) WF_SHADOW_EXT="$(option_inputbox WF_SHADOW_EXT 24 mp4)" ;; - WF_SHADOW_SAVE) WF_SHADOW_SAVE="$(option_inputbox WF_SHADOW_SAVE 120 '')" ;; + WF_SHADOW_FMT) WF_SHADOW_FMT="$(option_inputbox WF_SHADOW_FMT 24 ${WF_SHADOW_FMT:-%Y%m%d_%H:%M:%S})" ;; + WF_SHADOW_EXT) WF_SHADOW_EXT="$(option_inputbox WF_SHADOW_EXT 24 ${WF_SHADOW_EXT:-mp4})" ;; + WF_SHADOW_SAVE) WF_SHADOW_SAVE="$(option_inputbox WF_SHADOW_SAVE 120)" ;; *) config_to_file; get_main_wrap; exit ;; esac get_option_wrap @@ -184,4 +186,24 @@ get_main_wrap() { esac } +until [ -z "$1" ]; do + case "$1" in + '-v' | '--version') + printf "wf-shadow-tui %s\n" "$VER" + wf-shadow --version + printf "dialog %s\n" "$(dialog --version)" + exit ;; + '-h' | '--help') + cat << EOF +USAGE: wf-shadow-tui [OPTION] + +OPTIONS: + -h, --help Show this help menu + -v, --version Show version information + +EOF + exit ;; + esac +done + get_main_wrap