From 580682ff01096b3d40ba73a8d4dbf12c10993d39 Mon Sep 17 00:00:00 2001 From: benj Date: Wed, 16 Jun 2021 17:54:38 -0700 Subject: quite a few changes...many specific to an ad2 setup (to be weeded out) --- des/i3/i3blocks/config | 17 ++++------------- des/i3/i3blocks/scripts/applefan | 10 ++++++++++ des/i3/i3blocks/scripts/archupdates | 2 +- des/i3/i3blocks/scripts/fan | 10 ---------- des/i3/i3blocks/scripts/genfan | 14 ++++++++++++++ des/i3/i3blocks/scripts/memory | 4 ++-- des/i3/i3blocks/scripts/temperature | 2 +- 7 files changed, 32 insertions(+), 27 deletions(-) create mode 100755 des/i3/i3blocks/scripts/applefan delete mode 100755 des/i3/i3blocks/scripts/fan create mode 100755 des/i3/i3blocks/scripts/genfan (limited to 'des/i3/i3blocks') diff --git a/des/i3/i3blocks/config b/des/i3/i3blocks/config index 1866bb9..7ea5984 100644 --- a/des/i3/i3blocks/config +++ b/des/i3/i3blocks/config @@ -3,37 +3,28 @@ separator=false separator_block_width=15 markup=pango -[battery] -interval=1 -color=#a8afb0 - -[brightness] -interval=once -signal=9 -color=#ffff33 - [volume] instance=Master interval=once signal=10 color=#4ca2df -[fan] +[genfan] interval=1 color=#a8afb0 [bandwidth] -instance=wlp114s0 +instance=wlp114s0 #wlp11420 for laptop interval=1 # color=#859900 [memory] -label= +label= interval=1 color=#e6ccff [temperature] -label= +label= interval=10 color=#cb4b16 diff --git a/des/i3/i3blocks/scripts/applefan b/des/i3/i3blocks/scripts/applefan new file mode 100755 index 0000000..84f1725 --- /dev/null +++ b/des/i3/i3blocks/scripts/applefan @@ -0,0 +1,10 @@ +#!/usr/bin/bash + +FAN_DIR=/sys/devices/platform/applesmc.768 +MAX_FAN=$(cat $FAN_DIR/fan1_max) +CURR_FAN=$(cat $FAN_DIR/fan1_output) + +ICON_FAN="" +FAN_P=$(echo - | awk -v max="$MAX_FAN" -v curr="$CURR_FAN" '{printf "%1.0f\n", (curr / max)*100}') + +echo "$ICON_FAN $FAN_P%" diff --git a/des/i3/i3blocks/scripts/archupdates b/des/i3/i3blocks/scripts/archupdates index 52538b0..b74f872 100755 --- a/des/i3/i3blocks/scripts/archupdates +++ b/des/i3/i3blocks/scripts/archupdates @@ -7,4 +7,4 @@ if [[ $PAC_UPDATES -gt 0 || $AUR_UPDATES -gt 0 ]]; then echo " [$PAC_UPDATES .. $AUR_UPDATES]" else echo " 0" -fi \ No newline at end of file +fi diff --git a/des/i3/i3blocks/scripts/fan b/des/i3/i3blocks/scripts/fan deleted file mode 100755 index 84f1725..0000000 --- a/des/i3/i3blocks/scripts/fan +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/bash - -FAN_DIR=/sys/devices/platform/applesmc.768 -MAX_FAN=$(cat $FAN_DIR/fan1_max) -CURR_FAN=$(cat $FAN_DIR/fan1_output) - -ICON_FAN="" -FAN_P=$(echo - | awk -v max="$MAX_FAN" -v curr="$CURR_FAN" '{printf "%1.0f\n", (curr / max)*100}') - -echo "$ICON_FAN $FAN_P%" diff --git a/des/i3/i3blocks/scripts/genfan b/des/i3/i3blocks/scripts/genfan new file mode 100755 index 0000000..7a52e8b --- /dev/null +++ b/des/i3/i3blocks/scripts/genfan @@ -0,0 +1,14 @@ +#!/usr/bin/bash + +FAN_RPMS=() +ICON_FAN="" + +IFS=$'\n' +for i in $(sensors | grep RPM); do + RPM=$(echo $i | awk '{print $2}') + if [ "$RPM" -ne "0" ]; then + FAN_RPMS+="$ICON_FAN $RPM " + fi +done + +echo "${FAN_RPMS[@]}" diff --git a/des/i3/i3blocks/scripts/memory b/des/i3/i3blocks/scripts/memory index e28af4e..20cebdd 100755 --- a/des/i3/i3blocks/scripts/memory +++ b/des/i3/i3blocks/scripts/memory @@ -38,9 +38,9 @@ awk -v type=$TYPE ' END { # full text if (type == "swap") - printf("%.1fG\n", (swap_total-swap_free)/1024/1024) + printf(" %.1fG\n", (swap_total-swap_free)/1024/1024) else - printf("%.1fG\n", mem_free/1024/1024) + printf(" %.1fG\n", mem_free/1024/1024) # TODO: short text diff --git a/des/i3/i3blocks/scripts/temperature b/des/i3/i3blocks/scripts/temperature index ad745c3..c47247e 100755 --- a/des/i3/i3blocks/scripts/temperature +++ b/des/i3/i3blocks/scripts/temperature @@ -56,7 +56,7 @@ close(SENSORS); $temperature eq -9999 and die 'Cannot find temperature'; # Print short_text, full_text -print "$temperature°C\n" x2; +print " $temperature°C\n" x2; # Print color, if needed if ($temperature >= $t_crit) { -- cgit v1.2.3