ZSHFiles/powerlevel-config/segments/prompt_c_twitch

11 lines
400 B
Plaintext

local cachefile=~/.cache/twitch
[ -r $cachefile ] || return
local -a stats
zstat -A stats +mtime -- $cachefile 2>/dev/null
if [ "${_cprompts_twitch[2]:-1}" -ne "${stats[1]:-0}" ]; then
local IFS=$'\n'
local streaming=($(< $cachefile))
typeset -g _cprompts_twitch=(${#streaming} $stats[1])
fi
[ ${_cprompts_twitch[1]} -gt 0 ] && p10k segment -b purple -i '' -t "${_cprompts_twitch[1]:-unknown}"