Add mumble prompt

This commit is contained in:
Alex 2020-06-20 21:04:45 +02:00
parent e006f98367
commit 8b49f0b882
Signed by: caskd
GPG Key ID: F92BA85F61F4C173
3 changed files with 11 additions and 1 deletions

View File

@ -2,6 +2,6 @@ source "${ZDOTDIR}/custom/prependsudo.zsh"
source "${ZDOTDIR}/custom/aliases.zsh"
source "${ZDOTDIR}/custom/gpg.zsh"
fpath+=("${ZDOTDIR}/custom/functions" "${ZDOTDIR}/custom/segments")
function {prompt_c_{covid_19,docker_host,mpv_mpris,new_mail,todo,weather,youtube},cprompts:cache:async:{covid,weather},get{mangareader,nhentai},gitsubrepo,osutab,ffmpeg-{compress,gif}}() {
function {prompt_c_{covid_19,docker_host,mpv_mpris,new_mail,todo,weather,youtube,mumble},cprompts:cache:async:{covid,weather},get{mangareader,nhentai},gitsubrepo,osutab,ffmpeg-{compress,gif}}() {
autoload -X
}

View File

@ -0,0 +1,9 @@
([ -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]}"

View File

@ -20,6 +20,7 @@ POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS+=(
c_todo
c_new_mail
# c_youtube
# c_mumble
c_weather
c_covid_19
)