ZSHFiles/p10k-segments/prompt_c_mumble

10 lines
715 B
Plaintext
Raw Permalink Normal View History

2020-06-20 19:04:45 +00:00
([ -v commands\[busctl\] ] && [ -v commands\[jq\] ]) || return
typeset -g _cprompts_mumble=("" "")
local muted=($(busctl get-property --timeout=300ms --user net.sourceforge.mumble.mumble / net.sourceforge.mumble.Mumble mute 2>/dev/null))
[ -z $muted[2] ] && return
local chan="$(busctl call -j --no-pager --timeout=300ms --user net.sourceforge.mumble.mumble / net.sourceforge.mumble.Mumble getCurrentUrl 2>/dev/null)"
local _chan=$(print $chan | jq -er '(.data[0] // empty)')
_cprompts_mumble[1]="${(g::)${${${_chan:gs/%/\\x}##mumble\:\/\/*\/}%\?*}}"
[[ $muted[2] = "true" ]] && _cprompts_mumble[2]=""
[ -z $_cprompts_mumble[1] ] || p10k segment -b green -i ${_cprompts_mumble[2]} -t "${_cprompts_mumble[1]}"