ulthar.xyz > Repos

dotfiles

Seven years worth of accumulated configuration cruft
About Files Commits git clone https://ulthar.xyz/repos/dotfiles/dotfiles.git

dotfiles/scripts/.local/bin/playurl

Download raw file: scripts/.local/bin/playurl

#!/bin/sh
# Stream a video in MPV from a URL in the clipboard

set -eu

url="$(xclip -o -selection clipboard)"

if [ "$url" = "${url#http}" ] && [ "$url" = "${url#gopher}" ]; then
	notify-send "📺 Play URL" "Clipboard doesn't contain a known URL\n$url"
	exit 1
else
	# Assume it's a video
	echo "$url" | rofi -dmenu -p "Play Video?" >/dev/null && {
		notify-send "📺 Play URL" "Streaming Video...\n$url"
		mpv "$url" || {
			notify-send "📺 Play Url" "Failed to play video."
			exit 1
		}
	}
fi
Generated 2025-03-07 15:24:27 -0700 by RepoRat