diff options
author | Archie Hilton (thytom) <archie.hilton1@gmail.com> | 2019-10-21 23:51:27 +0100 |
---|---|---|
committer | Archie Hilton (thytom) <archie.hilton1@gmail.com> | 2019-10-21 23:51:27 +0100 |
commit | e611703e037621493ead5a4c6d4debbdf4597904 (patch) | |
tree | cafd929b2e1ec9e1830056c34b5384a1a1feccdc /modules/mpd | |
parent | 63399b33197214c10f2477ee400f2546edda920c (diff) |
Added volumebar and mpd modules.
Diffstat (limited to 'modules/mpd')
-rwxr-xr-x | modules/mpd | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/modules/mpd b/modules/mpd new file mode 100755 index 0000000..5db0d64 --- /dev/null +++ b/modules/mpd @@ -0,0 +1,24 @@ +#!/bin/bash + +PREFIX_PLAY=' ' +PREFIX_PAUSE=' ' + +get_mpd() +{ + current_song=$(mpc current) + + if [[ "$current_song" = "" ]]; then + exit 0 + else + playpause=$(mpc | awk '/\[.*]/{split($0, a, " "); print a[1]}') + if [[ "$playpause" = "[playing]" ]]; then + current_song=$PREFIX_PLAY$current_song + elif [[ "$playpause" = "[paused]" ]]; then + current_song=$PREFIX_PAUSE$current_song + fi + fi + + echo $current_song +} + +get_mpd |