From 01aae48c384f4b07c2f204bff81ba2398cbd3065 Mon Sep 17 00:00:00 2001 From: David Luevano Alvarado <55825613+luevano@users.noreply.github.com> Date: Thu, 24 Dec 2020 18:22:27 -0700 Subject: Update script/module of player_mpris --- .local/bin/statusbar/player_mpris_module | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) (limited to '.local/bin/statusbar') diff --git a/.local/bin/statusbar/player_mpris_module b/.local/bin/statusbar/player_mpris_module index 42d6df6..3701cbf 100755 --- a/.local/bin/statusbar/player_mpris_module +++ b/.local/bin/statusbar/player_mpris_module @@ -14,15 +14,31 @@ show_panel (){ } send_notification (){ - artist="$(playerctl metadata artist)" - album="$(playerctl metadata album)" - title="$(playerctl metadata title)" + player_status=$(playerctl status 2> /dev/null) + if [ "$player_status" = "Playing" ]; then + artist="$(playerctl metadata artist)" + album="$(playerctl metadata album)" + title="$(playerctl metadata title)" - if [ $album = "\n"]; then - notify-send "$artist - $album" "$title" + if [ $album = "\n"]; then + notify-send " $artist - $album" "$title" + else + notify-send " $artist" "$title" + fi + elif [ "$player_status" = "Paused" ]; then + artist="$(playerctl metadata artist)" + album="$(playerctl metadata album)" + title="$(playerctl metadata title)" + + if [ $album = "\n"]; then + notify-send " (Paused) $artist - $album" "$title" + else + notify-send " (Paused) $artist" "$title" + fi else - notify-send "$artist" "$title" + notify-send " Nothing playing" fi + } case $1 in -- cgit v1.2.3-54-g00ecf