Fixed mpv script for polybar not handling a socket error case where an mpv instance not using the socket was running

master
Meliurwen 3 years ago
parent 2cbc01acbb
commit 3205e32199
Signed by: meliurwen
GPG Key ID: 818A8B35E9F1CE10
  1. 4
      polybar/.config/polybar/scripts/mpv.sh

@ -27,7 +27,9 @@ if pgrep -u "$(id -u)" -x mpv > /dev/null; then
# The "16) Connection refused" error happens at the row below # The "16) Connection refused" error happens at the row below
# See: https://github.com/deterenkelt/Nadeshiko/wiki/Known-issues-for-Nadeshiko%E2%80%91mpv#----connection-refused # See: https://github.com/deterenkelt/Nadeshiko/wiki/Known-issues-for-Nadeshiko%E2%80%91mpv#----connection-refused
TIME=$(echo '{ "command": ["get_property", "time-pos"] }' | socat - "$MPV_SOCKET_PATH") if ! TIME="$(echo '{ "command": ["get_property", "time-pos"] }' | socat - "$MPV_SOCKET_PATH" 2> "\dev\null")"; then
exit 1
fi
if [ "$(echo "$TIME" | jq -r .error)" = "success" ]; then if [ "$(echo "$TIME" | jq -r .error)" = "success" ]; then
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
COMMAND=$1 COMMAND=$1

Loading…
Cancel
Save