Show artist if we have info about them, expand size limit

This commit is contained in:
Alex 2020-05-23 14:33:06 +02:00
parent de6c28f50d
commit 384ee7d385
Signed by: caskd
GPG Key ID: F92BA85F61F4C173
1 changed files with 2 additions and 2 deletions

View File

@ -79,6 +79,6 @@ function prompt_mpv_mpris() {
typeset -g _cprompts_mpv
local busout="$(busctl get-property -j --no-pager --timeout=300ms --user org.mpris.MediaPlayer2.mpv /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player Metadata 2>/dev/null)"
[ -z $busout ] && return
_cprompts_mpv="$(print $busout | jq -er '.data."xesam:title".data // empty')"
[ -z $_cprompts_mpv ] || p10k segment -b magenta -i '' -t "${_cprompts_mpv:0:25}$([ ${#_cprompts_mpv} -gt 25 ] && print ...)"
_cprompts_mpv="$(print $busout | jq -er '((.data."xesam:artist".data[0] // empty) + " - " + (.data."xesam:title".data // empty))')"
[ -z $_cprompts_mpv ] || p10k segment -b magenta -i '' -t "${_cprompts_mpv:0:40}$([ ${#_cprompts_mpv} -gt 40 ] && print ...)"
}