commit - 70a17dbad95de2858111c141ddbe611c075f8271
commit + 289051ee3ce04da6c07f5374fa5ba1c7606cf9d7
blob - 3c4604e86e25caf28184ccc3b31f0bc74e9ab765
blob + ac0ced07c00da77075897439b5c526f27a5071e9
--- mpc-notify
+++ mpc-notify
# issue an mpc command based on arguments and assemble notification message
case "$command" in
- "")
- # use defaults
+"")
+ # use defaults
+ song_head="Now Playing"
+ use_preview=1
+ ;;
+"toggle")
+ mpc -q toggle
+ state="$(mpc status %state%)"
+ case "$state" in
+ "playing")
song_head="Now Playing"
use_preview=1
;;
- "toggle")
- mpc -q toggle
- state="$(mpc status %state%)"
- if [ "$state" = "playing" ]; then
- song_head="Now Playing"
- use_preview=1
- elif [ "$state" = "paused" ]; then
- song_head="Paused"
- song_icon="media-playback-pause"
- fi
+ "paused")
+ song_head="Paused"
+ song_icon="media-playback-pause"
;;
- "shuffle")
- mpc -q shuffle
- song_head="Shuffled Playlist"
- song_icon="media-playlist-shuffle"
- ;;
- "single")
- mpc -q single
- state="$(mpc status %single%)"
- if [ "$state" = "on" ]; then
- song_head="Single Mode: On"
- elif [ "$state" = "once" ]; then
- song_head="Single Mode: Once"
- elif [ "$state" = "off" ]; then
- song_head="Single Mode: Off"
- fi
- song_icon="multimedia-player"
- ;;
- "random")
- mpc -q random
- state="$(mpc status %random%)"
- if [ "$state" = "on" ]; then
- song_head="Random Mode: On"
- elif [ "$state" = "off" ]; then
- song_head="Random Mode: Off"
- fi
- song_icon="media-eject"
- ;;
- "repeat")
- mpc -q repeat
- state="$(mpc status %repeat%)"
- if [ "$state" = "on" ]; then
- song_head="Repeat Mode: On"
- elif [ "$state" = "off" ]; then
- song_head="Repeat Mode: Off"
- fi
- song_icon="media-playlist-repeat"
- ;;
- *)
- mpc -q "$command"
- # Don't notify if mpc changed song because ncmpcpp would notify on
- # song change.
- [ "$command" = "next" ] || [ "$command" = "prev" ] && exit
- ;;
+ esac
+ ;;
+"shuffle")
+ mpc -q shuffle
+ song_head="Shuffled Playlist"
+ song_icon="media-playlist-shuffle"
+ ;;
+"single")
+ mpc -q single
+ state="$(mpc status %single%)"
+ case "$state" in
+ "on")
+ song_head="Single Mode: On";;
+ "once")
+ song_head="Single Mode: Once";;
+ "off")
+ song_head="Single Mode: Off";;
+ esac
+ song_icon="multimedia-player"
+ ;;
+"random")
+ mpc -q random
+ state="$(mpc status %random%)"
+ case "$state" in
+ "on")
+ song_head="Random Mode: On";;
+ "off")
+ song_head="Random Mode: Off";;
+ esac
+ song_icon="media-eject"
+ ;;
+"repeat")
+ mpc -q repeat
+ state="$(mpc status %repeat%)"
+ case "$state" in
+ "on")
+ song_head="Repeat Mode: On";;
+ "off")
+ song_head="Repeat Mode: Off";;
+ esac
+ song_icon="media-playlist-repeat"
+ ;;
+*)
+ mpc -q "$command"
+ # don't notify if mpc changed song because ncmpcpp would notify on
+ # song change anway
+ [ "$command" = "next" ] || [ "$command" = "prev" ] && exit
+ ;;
esac
# use album preview for song icon