Add binary deps to custom prompts

This commit is contained in:
Alex 2020-06-20 11:10:50 +02:00
parent 2073809dac
commit 9177967124
Signed by: caskd
GPG Key ID: F92BA85F61F4C173
1 changed files with 4 additions and 0 deletions

View File

@ -11,6 +11,7 @@ function prompt_c_new_mail() {
p10k segment -b yellow -i '' -t "${_cprompts_mail_count:-unknown}"
}
function prompt_c_youtube() {
[ -v commands\[sqlite3\] ] || return
local newsboatdb=~/.newsboat/cache.db
if [ ! -v _cprompts_youtube ]; then
typeset -g _cprompts_youtube="$(sqlite3 ${newsboatdb} --ascii 'SELECT COUNT(id) FROM rss_item WHERE unread == 1 AND guid GLOB "yt:video:*"')"
@ -18,6 +19,7 @@ function prompt_c_youtube() {
p10k segment -b red -i '' -t "${_cprompts_youtube}"
}
function prompt_c_covid_19() {
([ -v commands\[curl\] ] && [ -v commands\[jq\] ]) || return
local tmpfile=${CACHEPATH}/covid
local REPLY
zstyle -s ':custom:prompts:covid' country REPLY
@ -37,6 +39,7 @@ function cprompts:cache:async:covid() {
[ ! -z $_cprompts_covid ] && print ${_cprompts_covid} > $tmpfile
}
function prompt_c_weather() {
([ -v commands\[curl\] ] && [ -v commands\[jq\] ]) || return
local tmpfile=${CACHEPATH}/weather
local -a stats
@ -87,6 +90,7 @@ function cprompts:cache:async:weather() {
}
function prompt_c_mpv_mpris() {
([ -v commands\[busctl\] ] && [ -v commands\[jq\] ]) || return
typeset -g _cprompts_mpv
local busout="$(busctl get-property -j --no-pager --timeout=300ms --user org.mpris.MediaPlayer2.mpv /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player Metadata 2>/dev/null)"
[ -z $busout ] && return