From cfaef26e8718916adcc68fbfb63b15f2389b2cd2 Mon Sep 17 00:00:00 2001 From: Mike Vink Date: Fri, 6 Oct 2023 23:10:55 +0200 Subject: move all the files --- shell-scripts/spectrwmbar | 59 ----------------------------------------------- 1 file changed, 59 deletions(-) delete mode 100644 shell-scripts/spectrwmbar (limited to 'shell-scripts/spectrwmbar') diff --git a/shell-scripts/spectrwmbar b/shell-scripts/spectrwmbar deleted file mode 100644 index a106b01..0000000 --- a/shell-scripts/spectrwmbar +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/env sh -# script for spectrwm status bar - -trap 'update' 5 - -fgcolors=("+@fg=1;" "+@fg=2;" "+@fg=3;" "+@fg=4;" "+@fg=5;" "+@fg=6;" "+@fg=7;" "+@fg=8;") -nfgcolors=${#fgcolors[@]} - -SLEEP_SEC=5m - -repeat() { - i=0; while [ $i -lt $1 ] - do - echo -ne "$TOKEN" - i=$(( i + 1 )) - done -} - -cpu() { - read cpu a b c previdle rest < /proc/stat - prevtotal=$((a+b+c+previdle)) - sleep 0.5 - read cpu a b c idle rest < /proc/stat - total=$((a+b+c+idle)) - cpu=$((100*( (total-prevtotal) - (idle-previdle) ) / (total-prevtotal) )) - echo -e "CPU: $cpu%" -} - -battery() { - BATTERY="$(cat /sys/class/power_supply/BAT0/capacity)" - - BAR_LEFT=$BATTERY - BATTERY_BAR="" - BLOCK=$(( 100 / nfgcolors )) - TOKEN=$(printf '\u2588') - - BAT_COL=$(( $nfgcolors -1 )) - #loops forever outputting a line every SLEEP_SEC secs - while [ $(( BAR_LEFT - BLOCK )) -gt 0 ] - do - BATTERY_BAR="${fgcolors[$BAT_COL]}$(repeat $BLOCK)${BATTERY_BAR}" - BAR_LEFT=$(( BAR_LEFT - BLOCK )) - BAT_COL=$(( BAT_COL - 1)) - done - - BATTERY_BAR="BATTERY: ${fgcolors[$BAT_COL]}$(repeat $BAR_LEFT)${BATTERY_BAR}" - echo $BATTERY_BAR -} - -update() { - echo "$(cpu) $(battery)" - wait -} - -while :; do - update - sleep $SLEEP_SEC & - wait -done -- cgit v1.2.3