ZSHFiles/custom/segments/prompt_c_mpv

7 lines
381 B
Plaintext
Raw Normal View History

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\"([^[:print:]])#:([^[:print:]])#\"}%%(\"~\\\")*}"
exec {REPLY}>&-
[ -z $_cprompts_mpv[2] ] || p10k segment -b magenta -i '' -t "${_cprompts_mpv[2]}"