song: Fix detection.

This commit is contained in:
Dylan Araps 2018-06-19 09:37:10 +10:00
parent 94362674f2
commit 01bd13a3b5

View file

@ -2340,7 +2340,8 @@ get_song() {
)
printf -v players "|%s" "${players[@]}"
player="$(ps -e | awk -v pattern="(${players:1})$" '$0 ~ pattern {print $NF; exit}')"
player="$(ps aux | awk -v pattern="(${players:1})" \
'!/ awk / && match($0,pattern){print substr($0,RSTART,RLENGTH); exit}')"
[[ "$music_player" && "$music_player" != "auto" ]] && \
player="$music_player"