Skip to content

Commit 48f29e1

Browse files
committed
updated vidopen.sh
1 parent 7aa0117 commit 48f29e1

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

media/vidopen.sh

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,14 @@ Used by the following scripts:
4242

4343
# used by usage() in lib/utils.sh
4444
# shellcheck disable=SC2034
45-
usage_args="<video_file>"
45+
usage_args="<video_file> [<player_specific_commandline_options>]"
4646

4747
help_usage "$@"
4848

49-
num_args 1 "$@"
49+
min_args 1 "$@"
5050

5151
video="$1"
52+
shift || :
5253

5354
# Will be tried in this order
5455
linux_commands=(
@@ -69,16 +70,19 @@ if is_mac; then
6970
if [ -z "${PLAY_VIDEO:-}" ]; then
7071
opts+=("--pause=yes")
7172
fi
73+
if [ -z "${BACKGROUND_VIDEO:-}" ]; then
74+
opts+=("--focus-on=never")
75+
fi
7276
fi
73-
"$DEFAULT_VIDEO_PLAYER" "${opts[@]}" -- "$video" &
77+
"$DEFAULT_VIDEO_PLAYER" "${opts[@]}" "$@" -- "$video" &
7478
else
7579
if [ -n "${BACKGROUND_VIDEO:-}" ]; then
7680
opts+=(-g)
7781
fi
7882
if [ -n "${DEFAULT_VIDEO_PLAYER:-}" ]; then
7983
opts+=(-a "$DEFAULT_VIDEO_PLAYER")
8084
fi
81-
open "${opts[@]}" "$video"
85+
open "${opts[@]}" "$@" "$video"
8286
if [ -n "${PLAY_VIDEO:-}" ]; then
8387
osascript -e "tell application \"${DEFAULT_VIDEO_PLAYER:-QuickTime Player}\" to play document 1"
8488
fi
@@ -88,7 +92,7 @@ else # assume Linux
8892
for linux_command in "${linux_commands[@]}"; do
8993
if type -P "$linux_command" &>/dev/null; then
9094
found=1
91-
"$linux_command" -- "$video" &
95+
"$linux_command" "$@" -- "$video" &
9296
break
9397
fi
9498
done

0 commit comments

Comments
 (0)