feat: Add MPV PIP
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
MPV=/opt/homebrew/bin/mpv
|
||||
|
||||
if [[ $# -eq 0 ]]; then
|
||||
echo "Usage: $(basename "$0") <file|url> [file|url ...]" >&2
|
||||
echo " $(basename "$0") mpv://open?url=<url-encoded target>" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TARGETS=()
|
||||
for arg in "$@"; do
|
||||
if [[ "$arg" == mpv://* ]]; then
|
||||
arg=$(python3 -c '
|
||||
import sys, urllib.parse as u
|
||||
q = u.parse_qs(u.urlparse(sys.argv[1]).query)
|
||||
print(q["url"][0])
|
||||
' "$arg")
|
||||
fi
|
||||
TARGETS+=("$arg")
|
||||
done
|
||||
|
||||
"$MPV" --ontop --on-all-workspaces --volume=0 "${TARGETS[@]}" &
|
||||
Reference in New Issue
Block a user