From 63f480ddd1ea8496c272b505d721fe9a54b782eb Mon Sep 17 00:00:00 2001 From: Tom van der Lee Date: Sun, 13 Sep 2015 14:17:52 +0200 Subject: Added support for mpd in music panel indicator --- herbstluftwm/.config/herbstluftwm/dependencylist | 1 + herbstluftwm/.config/herbstluftwm/panel_indicators.sh | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) (limited to 'herbstluftwm') diff --git a/herbstluftwm/.config/herbstluftwm/dependencylist b/herbstluftwm/.config/herbstluftwm/dependencylist index 84c61d7..25684e6 100644 --- a/herbstluftwm/.config/herbstluftwm/dependencylist +++ b/herbstluftwm/.config/herbstluftwm/dependencylist @@ -5,6 +5,7 @@ dmenu2 feh i3lock lemonbar-xft-git +mpc playerctl pulseaudio pulseaudio-alsa diff --git a/herbstluftwm/.config/herbstluftwm/panel_indicators.sh b/herbstluftwm/.config/herbstluftwm/panel_indicators.sh index 0ad6996..8388c83 100755 --- a/herbstluftwm/.config/herbstluftwm/panel_indicators.sh +++ b/herbstluftwm/.config/herbstluftwm/panel_indicators.sh @@ -10,12 +10,24 @@ volume_icon=("\uf026" "\uf027" "\uf028") music() { # Music - player_status=$(playerctl status) - if [ $player_status = "Playing" ]; then + mpd_status=$(mpc | sed -nr "s/^\[(.*)\].*$/\1/p") + if [ $mpd_status = "playing" ]; then + player_title=$(mpc -f "%title%" current) + player_artist=$(mpc -f "%artist%" current) + if [ -n "$player_artist" ]; then + playing="$player_title - $player_artist" + else + playing="$player_title" + fi + elif [ $(playerctl status) = "Playing" ]; then player_artist=$(playerctl metadata artist) player_title=$(playerctl metadata title) playing="$player_title - $player_artist" + else + playing="" + fi + if [ -n "$playing" ]; then if [ "$current" != "$playing" ] ; then current=$playing scrolling=$current -- cgit v1.2.3