linux-utils/dwmstatus

16 lines
725 B
Bash
Executable file

#!/bin/sh
########################################
# /!\ THIS SCRIPT IS OBSOLETE /!\ #
# Use slstatus instead #
# https://tools.suckless.org/slstatus/ #
########################################
bat="$(awk 'BEGIN{c[0]="ff0000";c[1]="ff8800";c[2]="ddff00";c[3]="00ff00";}{print "^r0,7,2,4^^r2,4,22,10^^c#000000^^r3,5,20,8^^c#"c[int(($1-1)/25)]"^^r"3+20-int($1/5)",5,"int($1/5)",8^^f24^^d^"}' /sys/class/power_supply/BAT1/capacity)"
t="$(date '+%d/%m %T')"
wifi="$(nmcli -f ACTIVE,SIGNAL,BARS dev wifi list | grep "yes")"
wifi_lvl="$(echo $wifi | awk 'BEGIN{c[0]="ff0000";c[1]="ff8800";c[2]="ddff00";c[3]="00ff00";}/yes/{print "^c#"c[int(($2-1)/25)]"^"$3}')"
xsetroot -name "$t $bat $wifi_lvl"
sleep 5s