tmux/.local/bin/tmux-status #!/bin/sh # ██ # ░██ # ██████ ██████████ ██ ██ ██ ██ # ░░░██░ ░░██░░██░░██░██ ░██░░██ ██ # ░██ ░██ ░██ ░██░██ ░██ ░░███ # ░██ ░██ ░██ ░██░██ ░██ ██░██ # ░░██ ███ ░██ ░██░░██████ ██ ░░██ # ░░ ░░░ ░░ ░░ ░░░░░░ ░░ ░░ # ██ ██ # ░██ ░██ # ██████ ██████ ██████ ██████ ██ ██ ██████ # ██░░░░ ░░░██░ ░░░░░░██ ░░░██░ ░██ ░██ ██░░░░ #░░█████ ░██ ███████ ░██ ░██ ░██░░█████ # ░░░░░██ ░██ ██░░░░██ ░██ ░██ ░██ ░░░░░██ # ██████ ░░██ ░░████████ ░░██ ░░██████ ██████ #░░░░░░ ░░ ░░░░░░░░ ░░ ░░░░░░ ░░░░░░ # # ▓▓▓▓▓▓▓▓▓▓ # ░▓ author ▓ xero <x@xero.style> # ░▓ code ▓ https://code.x-e.ro/dotfiles # ░▓ mirror ▓ https://git.io/.files # ░▓▓▓▓▓▓▓▓▓▓ # ░░░░░░░░░░ FULL=▓ EMPTY=░ EOL=▒ SIZE=7 C0="#000000" C1="#222222" C2="#8FBCBB" C3="#B3291C" C4="#3A3A3A" C5="#efefef" C6="#878787" C7="#666666" draw(){ perc= SIZE= inc=$(( perc * SIZE / 100 )) out= for v in $(seq 0 $(( SIZE - 1 ))); do test "$v" -le "$inc" \ && out="${out}#[fg=$C1]${FULL}" \ || out="${out}#[fg=$C1]${EMPTY}" done echo "$out" } temp(){ t=$(sensors | awk '/Core\ 0/ {gsub(/\+/,"",); gsub(/\..+/,"",) ; print }') tc=$C0 case 1 in $((t <= 50))) tc=$C2 ;; $((t >= 75))) tc=$C3 ;; esac echo "#[fg=$tc]$t°c" } bat(){ BATPATH=/sys/class/power_supply/BAT0 STATUS=$BATPATH/status BAT_FULL=$BATPATH/charge_full BAT_NOW=$BATPATH/charge_now bf=$(cat $BAT_FULL) bn=$(cat $BAT_NOW) bp=$(( 100 * bn / bf )) stat=$(cat $STATUS) case $stat in Full) st="=" ;; Discharging) st="-" ;; Charging) st="+" ;; esac test "$bp" -lt 10 \ && bc=$C3 \ || bc=$C1 echo $st#[fg=$bc]$bp"%" } cpu(){ CPU_USE=$(grep 'cpu ' /proc/stat | awk '{usage=(+)*100/(++)} END {print usage}') printf "%.0f" "$CPU_USE" } ram(){ free | awk '/Mem:/ {print int(/ * 100.0)}' } vpn(){ pgrep openconnect >/dev/null 2>&1 && echo "#[fg=3]VPN" nmcli | \grep -i 'vpn connection' >/dev/null 2>&1 && echo "#[fg=3]VPN" } clock(){ mtime=$(date +'%H:%M') myear=$(date +'%Y-%m-') mday=$(date +'%d') echo "#[fg=$C5]#[bg=$C4] $mtime #[fg=$C6]$myear#[fg=$C5]$mday #[fg=$C6]$EOL" } front(){ echo "#[bg=$C7]#[fg=0]▓░" } CPU_INFO=$(cpu) RAM_INFO=$(ram) echo `front` ${RAM_INFO}% `draw $RAM_INFO 4` ${CPU_INFO}% `draw $CPU_INFO 7` `vpn` `clock`