Add youtube segment, improve covid, mpris, show few segments only if local, no dirstack
This commit is contained in:
parent
017e5aa8b1
commit
d60baa543e
|
@ -10,13 +10,20 @@ function prompt_new_mail() {
|
|||
[[ ${_cprompts_mail_count} -gt 0 ]] || return
|
||||
p10k segment -b yellow -i '' -t "${_cprompts_mail_count:-unknown}"
|
||||
}
|
||||
function prompt_youtube() {
|
||||
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:*"')"
|
||||
fi
|
||||
p10k segment -b red -i '' -t "${_cprompts_youtube}"
|
||||
}
|
||||
function prompt_covid_19() {
|
||||
local tmpfile=${CACHEPATH}/covid
|
||||
local -a stats
|
||||
if [ ! -v _cprompts_covid ]; then
|
||||
zstat -A stats +mtime -- $tmpfile 2>/dev/null
|
||||
if [[ $stats[1] < $(($epochtime[1]-86400)) ]]; then
|
||||
typeset -g _cprompts_covid=$(curl -sL https://api.covid19api.com/country/germany | jq -e '. |= sort_by (.Date) | .[-1] | (.Confirmed - .Recovered)')
|
||||
typeset -g _cprompts_covid=$(curl -sL https://api.covid19api.com/country/germany | jq -e '. |= sort_by (.Date) | .[-1].Active')
|
||||
[ ! -z $_cprompts_covid ] && print $_cprompts_covid > $tmpfile
|
||||
else
|
||||
typeset -g _cprompts_covid=$(< $tmpfile)
|
||||
|
@ -70,7 +77,7 @@ function prompt_weather() {
|
|||
|
||||
function prompt_mpv_mpris() {
|
||||
typeset -g _cprompts_mpv
|
||||
_cprompts_mpv=${${"$(busctl get-property --no-pager --timeout=300ms --user org.mpris.MediaPlayer2.mpv /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player Metadata 2>/dev/null)"##*\"xesam:title\" s \"}%%\"*}
|
||||
[ -z $_cprompts_mpv ] && return
|
||||
p10k segment -b magenta -i '' -t "${_cprompts_mpv:0:25}$([ ${#_cprompts_mpv} -gt 25 ] && print ...)"
|
||||
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 ] || _cprompts_mpv="$(print $busout | jq -er '.data."xesam:title".data // empty')"
|
||||
[ -z $_cprompts_mpv ] || p10k segment -b magenta -i '' -t "${_cprompts_mpv:0:25}$([ ${#_cprompts_mpv} -gt 25 ] && print ...)"
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(
|
|||
disk_usage
|
||||
ssh
|
||||
root_indicator
|
||||
vim_shell
|
||||
newline
|
||||
vi_mode
|
||||
status
|
||||
|
@ -12,15 +13,20 @@ typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(
|
|||
dir_writable
|
||||
)
|
||||
typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(
|
||||
command_execution_time
|
||||
background_jobs
|
||||
vim_shell
|
||||
new_mail
|
||||
)
|
||||
if [ ! -v SSH_CONNECTION ]; then
|
||||
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS+=(
|
||||
mpv_mpris
|
||||
new_mail
|
||||
# youtube
|
||||
weather
|
||||
covid_19
|
||||
)
|
||||
fi
|
||||
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS+=(
|
||||
public_ip
|
||||
newline
|
||||
docker_host
|
||||
command_execution_time
|
||||
background_jobs
|
||||
vcs
|
||||
)
|
||||
|
|
|
@ -3,8 +3,7 @@ typeset -g CACHEPATH=/tmp
|
|||
typeset -g HISTSIZE=1000
|
||||
typeset -g SAVEHIST=1000
|
||||
typeset -g ZLE_RPROMPT_INDENT=0
|
||||
setopt appendhistory autocd auto_pushd extendedglob nomatch notify hist_ignore_all_dups hist_ignore_space nobeep
|
||||
|
||||
setopt appendhistory autocd extendedglob nomatch notify hist_ignore_all_dups hist_ignore_space nobeep
|
||||
|
||||
if [[ $_set_prompt == "p9k" ]]; then
|
||||
source ${ZDOTDIR}/powerlevel10k/powerlevel10k.zsh-theme
|
||||
|
|
Loading…
Reference in New Issue