diff options
| author | Mike Vink <mike1994vink@gmail.com> | 2023-10-06 23:10:55 +0200 |
|---|---|---|
| committer | Mike Vink <mike1994vink@gmail.com> | 2023-10-06 23:10:55 +0200 |
| commit | cfaef26e8718916adcc68fbfb63b15f2389b2cd2 (patch) | |
| tree | 3989af4514d31d0a5cb89e8b96d51210ad7bf152 /shell-scripts/spectrwmbar | |
| parent | 654ec06ab6a885ea851c4cbf68d06a00b41b0e14 (diff) | |
move all the files
Diffstat (limited to 'shell-scripts/spectrwmbar')
| -rw-r--r-- | shell-scripts/spectrwmbar | 59 |
1 files changed, 0 insertions, 59 deletions
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 |
