#!/bin/sh
# Toggles the cmus aaa mode (all,album,artist)

cmus-remote -C "toggle aaa_mode"
mode=$(cmus-remote -Q | grep "aaa_mode" | cut -d ' ' -f 3)
artist=$(cmus-remote -Q | grep "tag artist" | cut -d ' ' -f 3-)
album=$(cmus-remote -Q | grep "tag album" | cut -d ' ' -f 3-)

[ "$mode" = "all" ] && dunstctl close-all && notify-send "Playing from full library" \
		&& exit
[ "$mode" = "artist" ] && dunstctl close-all && notify-send "Playing by artist: $artist" \
		&& exit
[ "$mode" = "album" ] && dunstctl close-all && notify-send "Playing from album: $album" \
		&& exit