function prompt_docker_host() { p10k segment -b blue -i '' -t "${DOCKER_HOST#*://}" -c "${DOCKER_HOST}" } typeset -g POWERLEVEL9K_DOCKER_HOST_SHOW_ON_COMMAND='docker' function prompt_dbus_mpris() { typeset -g _mpris_LASTRESP=${_mpris_RESP:=0} typeset -g _mpris_RESP="$(qdbus org.mpris.MediaPlayer2.mpv /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Metadata 2>/dev/null)" if [[ $_mpris_RESP != $_mpris_LASTRESP ]]; then typeset -g _mpris_RFMT="$(print ${_mpris_RESP} | grep -oP '(?<=^xesam:title: ).+')" local ARTIST="$(print ${_mpris_RESP} | grep -oP '(?<=^xesam:artist: ).+')" [ ! -z ${ARTIST} ] && _mpris_RFMT="${ARTIST} - ${_mpris_RFMT}" fi p10k segment -b purple -i '' -t "${_mpris_RFMT}" -c "${_mpris_RFMT}" } function prompt_new_mail() { interval $_new_mail_MAILS && typeset -g _new_mail_MAILS=$(find ~/Mail/*/Inbox/new -type f | wc -l) p10k segment -b yellow -i '' -t "${_new_mail_MAILS}" -c "(( $_new_mail_MAILS > 0 ))" } function prompt_pacman_upgrade() { interval $_upgrade_PACKAGES && typeset -g _upgrade_PACKAGES=$(pacman -Qu | wc -l) p10k segment -b cyan -i '' -t "${_upgrade_PACKAGES}" -c "(( $_upgrade_PACKAGES > 0 ))" } typeset -g POWERLEVEL9K_PACMAN_UPGRADE_SHOW_ON_COMMAND='pacman' function prompt_2b2t_queue() { local FILE=~/.local/share/multimc/instances/Impact\ 4.8.3\ -\ 1.12.2\ -\ Forge/.minecraft/logs/latest.log [ -r $FILE ] && interval $_last_LOG && typeset -g _last_LOG=($(tail -n1 $FILE)) [ ${_last_LOG[-2]:-0} = 'queue:' ] && p10k segment -b green -i '' -t "${_last_LOG[-1]}" }