Created
June 25, 2013 16:15
-
-
Save jjrh/5859843 to your computer and use it in GitHub Desktop.
Toggles mpd to play if it's stopped or paused, toggles mpd to pause if it's playing. Useful if you have a keybinding to toggle music.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/sh | |
status=$(mpc status | grep play) | |
if [ -n "$status" ] | |
then | |
mpc pause >> /dev/null | |
else | |
mpc play >> /dev/null | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A one-liner:
[[ $(mpc status | grep paused) == *"paused"* ]] && mpc play || mpc pause
UPDATE 2021-02-14:
mpc toggle
(see man page)