aboutsummaryrefslogtreecommitdiff
path: root/dotfiles/.local/bin/i3barmusic
blob: 5647a811f1b5adfb16b0e6149b66c623c1227e1e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/sh

filter() {
	sed "/^volume:/d" | tac | sed -e "s/\\&/&amp;/g;s/\\[paused\\].*/<span color=\"gray\" font_style=\"italic\">/g;s/\\[playing\\].*/<span>/g" | tr -d '\n' | sed -e "s/$/<\\/span>/g"
	}

case $BLOCK_BUTTON in
    1) mpc toggle | filter ;;
    2) mpc status | filter && setsid "$TERMINAL" -e ncmpcpp & ;;
    3) mpc status | filter && notify-send "🎵 Music module" "\- Shows mpd song playing.
- Italic when paused.
- Left click opens ncmpcpp.
- Middle click pauses.
- Scroll changes track.";;  # right click, pause/unpause
    4) mpc prev   | filter ;;  # scroll up, previous
    5) mpc next   | filter ;;  # scroll down, next
    *) mpc status | filter ;;
esac; exit