dotfiles

custom linux config files managed with gnu stow

dotfiles

tmux/.local/bin/tmux-status


#!/bin/bash
#        ██
#       ░██
#      ██████ ██████████  ██   ██ ██   ██
#     ░░░██░ ░░██░░██░░██░██  ░██░░██ ██
#       ░██   ░██ ░██ ░██░██  ░██ ░░███
#       ░██   ░██ ░██ ░██░██  ░██  ██░██
#       ░░██  ███ ░██ ░██░░██████ ██ ░░██
#        ░░  ░░░  ░░  ░░  ░░░░░░ ░░   ░░
#           ██               ██
#          ░██              ░██
#  ██████ ██████  ██████   ██████ ██   ██  ██████
# ██░░░░ ░░░██░  ░░░░░░██ ░░░██░ ░██  ░██ ██░░░░
#░░█████   ░██    ███████   ░██  ░██  ░██░░█████
# ░░░░░██  ░██   ██░░░░██   ░██  ░██  ░██ ░░░░░██
# ██████   ░░██ ░░████████  ░░██ ░░██████ ██████
#░░░░░░     ░░   ░░░░░░░░    ░░   ░░░░░░ ░░░░░░
#
#  ▓▓▓▓▓▓▓▓▓▓
# ░▓ author ▓ xero <x@xero.style>
# ░▓ code   ▓ https://code.x-e.ro/dotfiles
# ░▓ mirror ▓ https://git.io/.files
# ░▓▓▓▓▓▓▓▓▓▓
# ░░░░░░░░░░
#
#-----------------------------------------------------------------------// vars
FULL=━
EMPTY=┄
C0="#000000"
C1="#222222"
C2="#8FBCBB"
C3="#B3291C"
C4="#685742"
C5="#d7c483"
C6="#C9A554"
C7="#78824b"
C8="#B36D43"
#---------------------------------------------------------------// progress bar
draw() {
	perc=
	size=
	inc=$((perc * size / 125))
	out=
	for v in $(seq 0 $((size - 1))); do
		[[ "$v" -le "$inc" ]] &&
			out="${out}#[fg=$C1]${FULL}" ||
			out="${out}#[fg=$C6]${EMPTY}"
	done
	printf "%s" "$out"
}
#--------------------------------------------------------------------// compute
FRONT="#[bg=$C7]#[fg=0]▓▒░"
D1=$(df -h | grep '/$' | tr -s ' ' | cut -d ' ' -f5 | sed 's/%//')
D2=$(df -h | grep 'x0' | tr -s ' ' | cut -d ' ' -f5 | sed 's/%//')
BAT=$({
	BATPATH=/sys/class/power_supply/BAT0
	bf="$(<"$BATPATH/charge_full")"
	bn="$(<"$BATPATH/charge_now")"
	bp=$((100 * bn / bf))
	stat="$(<"$BATPATH/status")"
	case "$stat" in
		Full) : "󱟢" ;;
		Discharging) : "󱟤" ;;
		Charging) : "󱟦" ;;
	esac
	st="$_"
	printf "#[fg=0]%s %s%s" "$st" "$bp" "%"
})
RAM=$(free | awk '/Mem:/ {print int(/ * 100.0)}')
CPU=$(printf "%.0f" "$(grep 'cpu ' /proc/stat |
	awk '{usage=(+)*100/(++)} END {print usage}')")
TIME=$({
	printf "#[bg=%s]#[fg=%s]░▒#[bg=%s]#[fg=%s]▓\
		#[fg=%s]#[bg=%s] %s #[fg=%s]%s#[fg=%s]%s #[bg=0]#[fg=%s]▒░" \
		"$C9" "$C4" "$C9" "$C9" "$C5" "$C4" \
		"$(date +'%H:%M')" "$C6" "$(date +'%Y-%m-')" "$C5" "$(date +'%d')" "$C4"
})
#---------------------------------------------------------------------// render
echo "$FRONT" \
	"#[fg=0] ${RAM}%" "$(draw "$RAM" 4)" \
	"#[fg=0] ${CPU}%" "$(draw "$CPU" 4)" \
	"#[fg=0]󰽄 ${D1}%" "$(draw "$D1" 4)" \
	"#[fg=0]󰖟 ${D2}%" "$(draw "$D2" 4)" \
	"$BAT" \
	"$TIME"

Download

raw zip tar