24 lines
916 B
Bash
Executable File
24 lines
916 B
Bash
Executable File
#!/bin/sh
|
|
|
|
HEART=' '
|
|
WIFI='直'
|
|
THERM=''
|
|
|
|
if [ -d /sys/class/power_supply/BAT0 ]; then
|
|
battery_info="$(head -n 1 /sys/class/power_supply/BAT0/capacity)%"
|
|
current_charge=$(echo "$battery_info" | grep -o '[0-9]\+%' | awk '{sub (/%/, "", $1); print $1}')
|
|
printf '#[fg=colour123] %s' "$HEART$current_charge"
|
|
fi
|
|
|
|
if ping -q -w 1 -c 1 "$(ip r | awk '/default/ {print $3}')" >/dev/null; then
|
|
net="$(awk 'NR == 3 { print substr($3, 1, length($3) - 1) }' /proc/net/wireless)"
|
|
printf '#[fg=colour177] %s' "$WIFI$net"
|
|
fi
|
|
|
|
temp="$(sensors | awk '(/Core 0/){printf $3}' | sed 's/\.0//; s/+//')"
|
|
printf '#[fg=default] %s' "$THERM $temp"
|
|
|
|
# ip -o -4 a show dev tun0 | awk '{print $4}'
|
|
# ip -4 -br a | awk '/UP/ {print $3}' | cut -f1 -d'/'
|
|
# chequear tmux show-env|grep ^SSH_CONNECTION=|cut -d= -f2|cut -d" " -f1 o tmux show-env|sed -n "/^SSH_CONNECTION=/{s/[^=]*=//;s/ .*//;p;} y usar eso como condicion?
|