From ca3ef3185e5d915c8ea6906ee8f6b2346347fc60 Mon Sep 17 00:00:00 2001 From: Inhji Date: Fri, 20 Oct 2023 23:57:52 +0200 Subject: [PATCH] now-playing: tweaks --- config/scripts/now-playing.sh | 20 +++++++++++++++++--- config/waybar/config | 12 ++++++++---- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/config/scripts/now-playing.sh b/config/scripts/now-playing.sh index f0c9a99..14c42ed 100755 --- a/config/scripts/now-playing.sh +++ b/config/scripts/now-playing.sh @@ -1,8 +1,22 @@ #!/usr/bin/env bash -TITLE=$(cmus-remote -Q | grep title | cut --delimiter=' ' --fields=3-) -ARTIST=$(cmus-remote -Q | grep ' artist ' | cut --delimiter=' ' --fields=3-) + +#STATUS=$(cmus-remote -Q | grep status | cut --delimiter=' ' --fields=2) +STATUS=$(playerctl status) + +#TITLE=$(cmus-remote -Q | grep title | cut --delimiter=' ' --fields=3-) +TITLE=$(playerctl metadata title) +#ARTIST=$(cmus-remote -Q | grep ' artist ' | cut --delimiter=' ' --fields=3-) +ARTIST=$(playerctl metadata artist) + +if [ $STATUS = "Playing" ] ; then + ICON=" " +elif [ $STATUS = "Paused" ] ; then + ICON=" " +else + ICON="" +fi if [ -n "$ARTIST" ] || [ -n "$TITLE" ] ; then - echo "$ARTIST - $TITLE" + echo "$ICON $ARTIST - $TITLE" fi \ No newline at end of file diff --git a/config/waybar/config b/config/waybar/config index c3f010b..a7fb55d 100644 --- a/config/waybar/config +++ b/config/waybar/config @@ -45,13 +45,17 @@ "format": " {capacity}%", "format-charging": " {capacity}%", "format-plugged": " {capacity}%", - "format-full": " }capacity}%" + "format-full": " {capacity}%" }, "custom/cmus": { - "format": " {}", - "max-length": 30, "interval": 1, - "exec": "now-playing.sh" + "max-length": 40, + "exec": "now-playing.sh", + "on-click": "playerctl play-pause", + "on-click-right": "playerctl stop", + "on-scroll-up": "playerctl next", + "on-scroll-down": "playerctl previous", + "escape": true }, "custom/stat": { "format": "{}",