improved mpv scirpt
This commit is contained in:
parent
20110a0d5c
commit
74bf73c7ec
|
@ -1,11 +1,21 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Get the URL from the clipboard
|
||||||
link=$(wl-paste)
|
link=$(wl-paste)
|
||||||
|
|
||||||
|
# Check if the link is not empty
|
||||||
if [ -n "$link" ]; then
|
if [ -n "$link" ]; then
|
||||||
mpv "$link" &
|
# Notify the user that the link is about to be opened
|
||||||
|
notify-send "Opening Link" "$link"
|
||||||
|
|
||||||
notify-send "Opening Link" "$link" --icon=video-x-generic
|
# Try to open the link with mpv and capture any errors
|
||||||
else
|
error_message=$(mpv "$link" 2>&1)
|
||||||
notify-send "Error" "No URL provided." --icon=dialog-error
|
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
# If mpv fails, notify the user with the error message
|
||||||
|
notify-send "Error" "Failed to open the link with mpv:\n$error_message"
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
notify-send "Error" "No URL provided."
|
||||||
|
fi
|
||||||
|
i
|
||||||
|
|
Loading…
Reference in a new issue