From e9478f548ee97e6c30f9e34b645f9774cbf662ca Mon Sep 17 00:00:00 2001 From: Alexis Date: Sun, 26 Aug 2018 21:47:35 +0200 Subject: [PATCH] chore: add mediaplayer script --- resources/config | 2 +- resources/mediaplayer.sh | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100755 resources/mediaplayer.sh diff --git a/resources/config b/resources/config index 772bda4..b7a0826 100644 --- a/resources/config +++ b/resources/config @@ -46,7 +46,7 @@ "custom/spotify": { "format": " {}", "max-length": 40, - "exec": "$HOME/.config/waybar/mediaplayer.sh", + "exec": "$HOME/.config/waybar/mediaplayer.sh", // Script in resources folder "exec-if": "pgrep spotify" } } diff --git a/resources/mediaplayer.sh b/resources/mediaplayer.sh new file mode 100755 index 0000000..e069de3 --- /dev/null +++ b/resources/mediaplayer.sh @@ -0,0 +1,7 @@ +#!/bin/sh +player_status=$(playerctl status 2> /dev/null) +if [ "$player_status" = "Playing" ]; then + echo "$(playerctl metadata artist) - $(playerctl metadata title)" +elif [ "$player_status" = "Paused" ]; then + echo " $(playerctl metadata artist) - $(playerctl metadata title)" +fi \ No newline at end of file