From 411d6e7ab9365e8bc24c1a10d13f5e19e39aa8cb Mon Sep 17 00:00:00 2001 From: Navneet Vikram Tey <40721108+teynav@users.noreply.github.com> Date: Mon, 22 Jan 2024 14:45:26 +0530 Subject: [PATCH] Used socket for better killing the process Using socket means 1. You are killing the mpv you intended to not just "any" process that match description of "pfkill" 2. You can write scripts to interact with mpv running in background , like turning on it's video etc. It provides that flexibility. --- config/hypr/UserScripts/RofiBeats.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/hypr/UserScripts/RofiBeats.sh b/config/hypr/UserScripts/RofiBeats.sh index 405451f..a23a26f 100755 --- a/config/hypr/UserScripts/RofiBeats.sh +++ b/config/hypr/UserScripts/RofiBeats.sh @@ -38,11 +38,11 @@ main() { # Check if the link is a playlist if [[ $link == *playlist* ]]; then - mpv --shuffle --vid=no "$link" + mpv --input-ipc-server=$HOME/.cache/mpvsocket --shuffle --vid=no "$link" else - mpv "$link" + mpv --input-ipc-server=$HOME/.cache/mpvsocket "$link" fi } # Check if an online music process is running and send a notification, otherwise run the main function -pkill -f http && notify-send -u low -i "$iDIR/music.png" "Online Music stopped" || main +echo stop | socat - $HOME/.cache/mpvsocket && notify-send -u low -i "$iDIR/music.png" "Online Music stopped" || main