ZSHFiles/p10k-segments/prompt_c_mpv

10 lines
385 B
Plaintext

local REPLY
zstyle -s ':custom:prompts:mpv' socket REPLY
[ -S $REPLY ] && zsocket $REPLY 2>/dev/null || return
_cprompts_mpv[2]="${${$(\
print -u $REPLY '{ "command": ["get_property", "media-title"] }' && \
read -eEu $REPLY \
)#*\"data\"([:blank:])#:([:blank:])#\"}%%(\"~\\\")*}"
exec {REPLY}>&-
[ -z $_cprompts_mpv[2] ] || p10k segment -b magenta -i '' -t "${_cprompts_mpv[2]}"