From 99971f77814fa2b5596de2d5409c935af59c3238 Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 16 Apr 2020 03:36:10 +0200 Subject: [PATCH] Fuck it, -340ms --- .zshrc | 2 +- custom.zsh | 6 +++--- custom/segments.zsh | 23 ----------------------- preferences.zsh | 4 +--- 4 files changed, 5 insertions(+), 30 deletions(-) diff --git a/.zshrc b/.zshrc index 4286c51..f5e6468 100644 --- a/.zshrc +++ b/.zshrc @@ -2,7 +2,7 @@ if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]] source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" fi [[ ! -f ${ZDOTDIR}/.p10k.zsh ]] || source ${ZDOTDIR}/.p10k.zsh -source "${ZDOTDIR}/completions.zsh" source "${ZDOTDIR}/preferences.zsh" +source "${ZDOTDIR}/completions.zsh" source "${ZDOTDIR}/bindings.zsh" source "${ZDOTDIR}/custom.zsh" diff --git a/custom.zsh b/custom.zsh index a3d3241..bf0a5f7 100644 --- a/custom.zsh +++ b/custom.zsh @@ -1,7 +1,7 @@ +source "${ZDOTDIR}/custom/segments.zsh" +source "${ZDOTDIR}/custom/prependsudo.zsh" source "${ZDOTDIR}/custom/aliases.zsh" source "${ZDOTDIR}/custom/dirstack.zsh" source "${ZDOTDIR}/custom/docker.zsh" -source "${ZDOTDIR}/custom/functions.zsh" source "${ZDOTDIR}/custom/gpg.zsh" -source "${ZDOTDIR}/custom/prependsudo.zsh" -source "${ZDOTDIR}/custom/segments.zsh" +source "${ZDOTDIR}/custom/functions.zsh" diff --git a/custom/segments.zsh b/custom/segments.zsh index 1445df7..b044fa2 100644 --- a/custom/segments.zsh +++ b/custom/segments.zsh @@ -1,36 +1,13 @@ -typeset -gi _pacman_check_time typeset -gi _mail_count -typeset -gi _upgrade_packages 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="$(busctl --user --json=short get-property org.mpris.MediaPlayer2.mpv /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player Metadata 2>/dev/null | jq '.data')" - if [[ $_mpris_RESP != $_mpris_LASTRESP ]]; then - typeset -g _mpris_RFMT="$(print ${_mpris_RESP} | jq --raw-output '."xesam:title".data // ""')" - local ARTIST="$(print ${_mpris_RESP} | jq --raw-output '."xesam:artist".data[0] // ""')" - [ ! -z ${ARTIST} ] && _mpris_RFMT="${ARTIST} - ${_mpris_RFMT%% \(*\)}" - fi - p10k segment -b purple -i '' -t "${_mpris_RFMT}" -c "${_mpris_RFMT}" -} function prompt_new_mail() { _mail_count=(~/Mail/*/Inbox/new/*(.N)) (( ${#_mail_count} > 0 )) || return p10k segment -b yellow -i '' -t "${#_mail_count}" } -function prompt_pacman_upgrade() { - local -a stats - zstat -A stats +mtime -- /var/lib/pacman/sync 2>/dev/null - if [[ $stats[1] != $_pacman_check_time ]]; then - _upgrade_packages=$(pacman -Qu | wc -l) - _pacman_check_time=$stats[1] - fi - (( $_upgrade_packages > 0 )) || return - p10k segment -b cyan -i '' -t "${_upgrade_packages}" -} -typeset -g POWERLEVEL9K_PACMAN_UPGRADE_SHOW_ON_COMMAND='pacman' function prompt_covid_19() { local tmpfile=~/.cache/covidres local -a stats diff --git a/preferences.zsh b/preferences.zsh index 0662c05..9ea8ea1 100644 --- a/preferences.zsh +++ b/preferences.zsh @@ -5,7 +5,7 @@ typeset -g ZLE_RPROMPT_INDENT=0 setopt appendhistory autocd auto_pushd correct_all extendedglob nomatch notify hist_ignore_all_dups hist_ignore_space nobeep typeset -g POWERLEVEL9K_DISABLE_HOT_RELOAD=true -#typeset -g POWERLEVEL9K_MODE='nerdfont-fontconfig' +typeset -g POWERLEVEL9K_MODE='nerdfont-fontconfig' if [ -z "$SSH_CONNECTION" ] && ! [ -z "$DISPLAY" ]; then source ${ZDOTDIR}/powerlevel10k/powerlevel10k.zsh-theme [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh @@ -30,11 +30,9 @@ if [ -z "$SSH_CONNECTION" ] && ! [ -z "$DISPLAY" ]; then vim_shell new_mail covid_19 - dbus_mpris public_ip newline docker_host - pacman_upgrade vcs virtualenv pyenv