2024-08-31 16:04:57 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
2024-10-09 16:45:33 +02:00
|
|
|
# Get the URL from the clipboard
|
2024-08-31 16:04:57 +02:00
|
|
|
link=$(wl-paste)
|
|
|
|
|
2024-10-09 16:45:33 +02:00
|
|
|
# Check if the link is not empty
|
2024-08-31 16:04:57 +02:00
|
|
|
if [ -n "$link" ]; then
|
2024-10-09 16:45:33 +02:00
|
|
|
# Notify the user that the link is about to be opened
|
|
|
|
notify-send "Opening Link" "$link"
|
2024-10-09 13:02:52 +02:00
|
|
|
|
2024-10-09 16:45:33 +02:00
|
|
|
# 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
|
2024-08-31 16:04:57 +02:00
|
|
|
else
|
2024-10-09 16:45:33 +02:00
|
|
|
notify-send "Error" "No URL provided."
|
2024-08-31 16:04:57 +02:00
|
|
|
fi
|
2024-10-09 16:45:33 +02:00
|
|
|
i
|