improved mpv scirpt
This commit is contained in:
parent
20110a0d5c
commit
74bf73c7ec
|
@ -1,11 +1,21 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Get the URL from the clipboard
|
||||
link=$(wl-paste)
|
||||
|
||||
# Check if the link is not empty
|
||||
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
|
||||
else
|
||||
notify-send "Error" "No URL provided." --icon=dialog-error
|
||||
# Try to open the link with mpv and capture any errors
|
||||
error_message=$(mpv "$link" 2>&1)
|
||||
|
||||
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
|
||||
else
|
||||
notify-send "Error" "No URL provided."
|
||||
fi
|
||||
i
|
||||
|
|
Loading…
Reference in a new issue