From fa3bbbba7a0246e697eb963c09764a7b7cd3f6f0 Mon Sep 17 00:00:00 2001 From: Price Hiller Date: Sun, 20 Aug 2023 22:00:36 -0500 Subject: [PATCH] feat(zsh): set custom TIMEFMT --- .../zsh/config/profile/profile/env.zsh | 50 ++++++++++++ dots/.config/zsh/lib/colors.zsh | 79 +++++++++++++++++++ 2 files changed, 129 insertions(+) create mode 100755 dots/.config/zsh/lib/colors.zsh diff --git a/dots/.config/zsh/config/profile/profile/env.zsh b/dots/.config/zsh/config/profile/profile/env.zsh index a7359a2a..516af811 100644 --- a/dots/.config/zsh/config/profile/profile/env.zsh +++ b/dots/.config/zsh/config/profile/profile/env.zsh @@ -8,6 +8,56 @@ export ZSH_HIGHLIGHT_MAXLENGTH=10000 export ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=2 export ZSH_AUTOSUGGEST_STRATEGY=(history completion) +source ~/.config/zsh/lib/colors.zsh + +read -r -d '' TIMEFMT <<-__EOS__ +${kanagawa[crystalBlue]}╭────────────────────────────────────────────────────────────────────────────────────╮ +│ ${kanagawa[roninYellow]}Job${reset_color}${kanagawa[crystalBlue]} │ +├────────────────────────────────────────────────────────────────────────────────────╯${reset_color} +${kanagawa[crystalBlue]}│${reset_color} %J +${kanagawa[crystalBlue]}├────────────────────────────────────────────────────────────────────────────────────╮ +│ ${kanagawa[roninYellow]}Stats${reset_color}${kanagawa[crystalBlue]} │ +├────────────────────────────────────────────────────────────────────────────────────╯${reset_color} +${kanagawa[crystalBlue]}│${reset_color} ${kanagawa[springGreen]}${UNDERLINE}${BOLD}Basic Stats${reset_color} +${kanagawa[crystalBlue]}│${reset_color} ${kanagawa[oniViolet2]}real:${reset_color} %E +${kanagawa[crystalBlue]}│${reset_color} ${kanagawa[oniViolet2]}user:${reset_color} %U +${kanagawa[crystalBlue]}│${reset_color} ${kanagawa[oniViolet2]}sys:${reset_color} %S +${kanagawa[crystalBlue]}│${reset_color} +${kanagawa[crystalBlue]}│${reset_color} ${kanagawa[springGreen]}${UNDERLINE}${BOLD}Detailed Stats${reset_color} +${kanagawa[crystalBlue]}│${reset_color} +${kanagawa[crystalBlue]}│${reset_color} ${kanagawa[carpYellow]}${UNDERLINE}CPU${reset_color} +${kanagawa[crystalBlue]}│${reset_color} ${kanagawa[oniViolet2]}CPU Percentage:${reset_color} %P +${kanagawa[crystalBlue]}│${reset_color} +${kanagawa[crystalBlue]}│${reset_color} ${kanagawa[carpYellow]}${UNDERLINE}Signals${reset_color} +${kanagawa[crystalBlue]}│${reset_color} ${kanagawa[oniViolet2]}Signals Received:${reset_color} %k +${kanagawa[crystalBlue]}│${reset_color} +${kanagawa[crystalBlue]}│${reset_color} ${kanagawa[carpYellow]}${UNDERLINE}Memory${reset_color} +${kanagawa[crystalBlue]}│${reset_color} ${kanagawa[oniViolet2]}Max Memory Used:${reset_color} %M KB +${kanagawa[crystalBlue]}│${reset_color} ${kanagawa[oniViolet2]}Total Space Used:${reset_color} %K KB +${kanagawa[crystalBlue]}│${reset_color} ${kanagawa[oniViolet2]}Average Shared Space Used:${reset_color} %X KB +${kanagawa[crystalBlue]}│${reset_color} ${kanagawa[oniViolet2]}Average Unshared Space Used:${reset_color} %D KB +${kanagawa[crystalBlue]}│${reset_color} +${kanagawa[crystalBlue]}│${reset_color} ${kanagawa[carpYellow]}${UNDERLINE}Page Faults${reset_color} +${kanagawa[crystalBlue]}│${reset_color} ${kanagawa[oniViolet2]}Major Page Faults:${reset_color} %F +${kanagawa[crystalBlue]}│${reset_color} ${kanagawa[oniViolet2]}Minor Page Faults:${reset_color} %R +${kanagawa[crystalBlue]}│${reset_color} +${kanagawa[crystalBlue]}│${reset_color} ${kanagawa[carpYellow]}${UNDERLINE}I/O Operations${reset_color} +${kanagawa[crystalBlue]}│${reset_color} ${kanagawa[oniViolet2]}Input Operations:${reset_color} %I +${kanagawa[crystalBlue]}│${reset_color} ${kanagawa[oniViolet2]}Output Operations:${reset_color} %O +${kanagawa[crystalBlue]}│${reset_color} +${kanagawa[crystalBlue]}│${reset_color} ${kanagawa[carpYellow]}${UNDERLINE}Context Switches${reset_color} +${kanagawa[crystalBlue]}│${reset_color} ${kanagawa[oniViolet2]}Voluntary Context Switches:${reset_color} %w +${kanagawa[crystalBlue]}│${reset_color} ${kanagawa[oniViolet2]}Involuntary Context Switches:${reset_color} %c +${kanagawa[crystalBlue]}│${reset_color} +${kanagawa[crystalBlue]}│${reset_color} ${kanagawa[carpYellow]}${UNDERLINE}Socket Messages${reset_color} +${kanagawa[crystalBlue]}│${reset_color} ${kanagawa[oniViolet2]}Socket Messages Sent:${reset_color} %s +${kanagawa[crystalBlue]}│${reset_color} ${kanagawa[oniViolet2]}Socket Messages Received:${reset_color} %r +${kanagawa[crystalBlue]}╰${reset_color} +__EOS__ + +export TIMEFMT +export REPORTTIME=600 + ### SSH ### export SSH_AUTH_SOCK="${XDG_RUNTIME_DIR}/ssh-agent.sock" ssh-add -l >/dev/null 2>&1 diff --git a/dots/.config/zsh/lib/colors.zsh b/dots/.config/zsh/lib/colors.zsh new file mode 100755 index 00000000..99d0ea5a --- /dev/null +++ b/dots/.config/zsh/lib/colors.zsh @@ -0,0 +1,79 @@ +#!/usr/bin/env zsh + +reset_color="$(tput sgr0)" +UNDERLINE="$(tput smul)" +BOLD="$(tput bold)" +STANDOUT="$(tput smso)" +BLINK="$(tput blink)" + +echo_rgb() { + local red + local green + local blue + + red="${1}" + green="${2}" + blue="${3}" + + printf "\e[0;38;2;%s;%s;%sm" "${red}" "${green}" "${blue}" +} + +echo_hex() { + local hex="${1:1}" + local hex_rgb + IFS=" " read -A hex_rgb <<< "$(printf "%d %d %d" 0x"${hex:0:2}" 0x"${hex:2:2}" 0x"${hex:4:2}")" + echo_rgb ${hex_rgb[@]} +} + +cleanup-colors() { + unset echo_hex + unset echo_rgb + unset reset_color + unset underline + unset bold + unset standout + unset blink + unset kanagawa +} + +typeset -A kanagawa=( + sumiInk0 $(echo_hex "#16161D") + sumiInk1 $(echo_hex "#181820") + sumiInk2 $(echo_hex "#1a1a22") + sumiInk3 $(echo_hex "#1F1F28") + sumiInk4 $(echo_hex "#2A2A37") + sumiInk5 $(echo_hex "#363646") + sumiInk6 $(echo_hex "#54546D") + waveBlue1 $(echo_hex "#223249") + waveBlue2 $(echo_hex "#2D4F67") + winterGreen $(echo_hex "#2B3328") + winterYellow $(echo_hex "#49443C") + winterRed $(echo_hex "#43242B") + winterBlue $(echo_hex "#252535") + autumnGreen $(echo_hex "#76946A") + autumnRed $(echo_hex "#C34043") + autumnYellow $(echo_hex "#DCA561") + samuraiRed $(echo_hex "#E82424") + roninYellow $(echo_hex "#FF9E3B") + waveAqua1 $(echo_hex "#6A9589") + oldWhite $(echo_hex "#C8C093") + fujiWhite $(echo_hex "#DCD7BA") + fujiGray $(echo_hex "#727169") + oniViolet $(echo_hex "#957FB8") + oniViolet2 $(echo_hex "#b8b4d0") + crystalBlue $(echo_hex "#7E9CD8") + springViolet1 $(echo_hex "#938AA9") + springViolet2 $(echo_hex "#9CABCA") + springBlue $(echo_hex "#7FB4CA") + lightBlue $(echo_hex "#A3D4D5") + waveAqua2 $(echo_hex "#7AA89F") + springGreen $(echo_hex "#98BB6C") + boatYellow1 $(echo_hex "#938056") + boatYellow2 $(echo_hex "#C0A36E") + carpYellow $(echo_hex "#E6C384") + sakuraPink $(echo_hex "#D27E99") + waveRed $(echo_hex "#E46876") + peachRed $(echo_hex "#FF5D62") + surimiOrange $(echo_hex "#FFA066") + katanaGray $(echo_hex "#717C7C") +)