7c96bd081a
* Compatibility for FreeBSD's paste(1) According to FreeBSD's [paste(1)](https://www.freebsd.org/cgi/man.cgi?query=paste&sektion=1&manpath=FreeBSD+12.2-RELEASE+and+Ports), the extra `-` is needed (tested by myself). This obviously works for Linux as well, tested on Void Linux at least. > Create a colon-separated list of directories named bin, > suitable for use in the PATH environment variable: `find / -name bin -type d | paste -s -d : -` * Compatibility for FreeBSD's paste(1) According to FreeBSD's [paste(1)](https://www.freebsd.org/cgi/man.cgi?query=paste&sektion=1&manpath=FreeBSD+12.2-RELEASE+and+Ports), the extra `-` is needed (tested by myself). This obviously works for Linux as well, tested on Void Linux at least. > Create a colon-separated list of directories named bin, > suitable for use in the PATH environment variable: `find / -name bin -type d | paste -s -d : -`
19 lines
755 B
Bash
Executable file
19 lines
755 B
Bash
Executable file
#!/bin/sh
|
|
|
|
filter() { mpc | sed "/^volume:/d;s/\\&/&/g;s/\\[paused\\].*/⏸/g;/\\[playing\\].*/d" | paste -sd ' ' -;}
|
|
|
|
pidof -x mpdup >/dev/null 2>&1 || mpdup >/dev/null 2>&1 &
|
|
|
|
case $BLOCK_BUTTON in
|
|
1) mpc status | filter ; setsid -f "$TERMINAL" -e ncmpcpp ;; # right click, pause/unpause
|
|
2) mpc toggle | filter ;; # right click, pause/unpause
|
|
3) mpc status | filter ; notify-send "🎵 Music module" "\- Shows mpd song playing.
|
|
- ⏸ 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
|
|
6) mpc status | filter ; "$TERMINAL" -e "$EDITOR" "$0" ;;
|
|
*) mpc status | filter ;;
|
|
esac
|