diff options
| author | 2015-09-13 14:17:52 +0200 | |
|---|---|---|
| committer | 2015-09-13 14:17:52 +0200 | |
| commit | 63f480ddd1ea8496c272b505d721fe9a54b782eb (patch) | |
| tree | b75f1bc95068bcf712e2a00963d8045ca3786e22 | |
| parent | 3cf7a66a66f31e60e14665156c5e19d09a1f7b95 (diff) | |
| download | dotfiles-63f480ddd1ea8496c272b505d721fe9a54b782eb.tar.gz dotfiles-63f480ddd1ea8496c272b505d721fe9a54b782eb.tar.bz2 dotfiles-63f480ddd1ea8496c272b505d721fe9a54b782eb.zip | |
Added support for mpd in music panel indicator
| -rw-r--r-- | herbstluftwm/.config/herbstluftwm/dependencylist | 1 | ||||
| -rwxr-xr-x | herbstluftwm/.config/herbstluftwm/panel_indicators.sh | 16 |
2 files changed, 15 insertions, 2 deletions
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 | |||
| 5 | feh | 5 | feh |
| 6 | i3lock | 6 | i3lock |
| 7 | lemonbar-xft-git | 7 | lemonbar-xft-git |
| 8 | mpc | ||
| 8 | playerctl | 9 | playerctl |
| 9 | pulseaudio | 10 | pulseaudio |
| 10 | pulseaudio-alsa | 11 | 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") | |||
| 10 | music() | 10 | music() |
| 11 | { | 11 | { |
| 12 | # Music | 12 | # Music |
| 13 | player_status=$(playerctl status) | 13 | mpd_status=$(mpc | sed -nr "s/^\[(.*)\].*$/\1/p") |
| 14 | if [ $player_status = "Playing" ]; then | 14 | if [ $mpd_status = "playing" ]; then |
| 15 | player_title=$(mpc -f "%title%" current) | ||
| 16 | player_artist=$(mpc -f "%artist%" current) | ||
| 17 | if [ -n "$player_artist" ]; then | ||
| 18 | playing="$player_title - $player_artist" | ||
| 19 | else | ||
| 20 | playing="$player_title" | ||
| 21 | fi | ||
| 22 | elif [ $(playerctl status) = "Playing" ]; then | ||
| 15 | player_artist=$(playerctl metadata artist) | 23 | player_artist=$(playerctl metadata artist) |
| 16 | player_title=$(playerctl metadata title) | 24 | player_title=$(playerctl metadata title) |
| 17 | playing="$player_title - $player_artist" | 25 | playing="$player_title - $player_artist" |
| 26 | else | ||
| 27 | playing="" | ||
| 28 | fi | ||
| 18 | 29 | ||
| 30 | if [ -n "$playing" ]; then | ||
| 19 | if [ "$current" != "$playing" ] ; then | 31 | if [ "$current" != "$playing" ] ; then |
| 20 | current=$playing | 32 | current=$playing |
| 21 | scrolling=$current | 33 | scrolling=$current |
