Add 2b2t queue (yes, another one) and fix different segments which were broken

This commit is contained in:
Alex 2020-04-12 14:50:26 +02:00
parent 6833e168e6
commit e87d4be46b
Signed by: caskd
GPG Key ID: F92BA85F61F4C173
5 changed files with 13 additions and 7 deletions

View File

@ -43,5 +43,5 @@ function man {
}
function interval {
typeset -g CTIME=$(date +%s)
[[ $(( $CTIME - ${LASTCTIME:=0} )) -gt 60 ]] && typeset -g LASTCTIME=$CTIME || return
[ -z $1 ] || [ $(( $CTIME - ${LASTCTIME:-0} )) -gt 60 ] && typeset -g LASTCTIME=$CTIME || return
}

View File

@ -13,11 +13,16 @@ function prompt_dbus_mpris() {
p10k segment -b purple -i '' -t "${_mpris_RFMT}" -c "${_mpris_RFMT}"
}
function prompt_new_mail() {
interval && 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}"
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 && typeset -g _upgrade_PACKAGES=$(pacman -Qu | wc -l)
p10k segment -b cyan -i '' -t "${_upgrade_PACKAGES}" -c "${_upgrade_PACKAGES/#%0}"
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]}"
}

@ -1 +1 @@
Subproject commit e1323716fe71a5da70b97aa06bcf229bbaaa86a5
Subproject commit 9d462b0ba99d11dc4ccf0253900dab87db7b1ddb

View File

@ -31,6 +31,7 @@ if [ -z "$SSH_CONNECTION" ] && ! [ -z "$DISPLAY" ]; then
pacman_upgrade
new_mail
docker_host
2b2t_queue
dbus_mpris
vcs
virtualenv

@ -1 +1 @@
Subproject commit ccb1da4ae8935f5b40ac7dbcdd6eeb694403c97f
Subproject commit 415e762ab21da7e0ebfe6dab09b8cc62df99bfcc