* Alias
# for mopidy visualizer
open_mopidy_fifo() {
local fifo
readonly fifo='/tmp/mpd.fifo'
mkfifo "$fifo"
while :; do socat -d -T 1 -u UDP4-LISTEN:5555 OPEN:"$fifo"; done &
}
# for mpd or mopidy
ncmpcpp() {
if ! pidof "$(type mpd)" >/dev/null; then
mpd
#[[ -z $(pgrep -xU $UID socat) ]] && open_mopidy_fifo;
if type mpdscribble >/dev/null; then
killall mpdscribble >&/dev/null
mpdscribble
fi
$(type /usr/bin/ncmpcpp) "$@" -S visualizer
else
$(type /usr/bin/ncmpcpp) "$@" -S visualizer
fi
printf "\e]20;;100x100+1000+1000\a"
pkill mpd
}
## fzf : mpd
fmpc() {
local song_position
song_position=$(mpc -f "%position%) %artist% - %title%" playlist | \
fzf-tmux --header="♬ MPD Playlist Queue" --query="$1" --reverse --select-1 --exit-0 | \
sed -n 's/^\([0-9]\+\)).*/\1/p') || return 1
[ -n "$song_position" ] && mpc -q play $song_position
}
$ ncmpcpp
$ fmpc