aboutsummaryrefslogtreecommitdiff
path: root/.config
diff options
context:
space:
mode:
authorLuca Matei Pintilie <luca@lucamatei.com>2024-08-10 17:08:24 +0000
committerLuca Matei Pintilie <luca@lucamatei.com>2024-08-10 17:08:24 +0000
commitfb97ace1667c5f6841a5978526f516b9e0f16b19 (patch)
tree0d0882e5c141c99fd5d96172587ead06efbd524b /.config
parentff1dfb49ab1eec7e9412261c56bcdb69cbe06ce1 (diff)
downloaddotfiles-fb97ace1667c5f6841a5978526f516b9e0f16b19.tar
dotfiles-fb97ace1667c5f6841a5978526f516b9e0f16b19.tar.gz
dotfiles-fb97ace1667c5f6841a5978526f516b9e0f16b19.tar.bz2
dotfiles-fb97ace1667c5f6841a5978526f516b9e0f16b19.tar.lz
dotfiles-fb97ace1667c5f6841a5978526f516b9e0f16b19.tar.xz
dotfiles-fb97ace1667c5f6841a5978526f516b9e0f16b19.tar.zst
dotfiles-fb97ace1667c5f6841a5978526f516b9e0f16b19.zip
swayrbar: fix scripts
Diffstat (limited to '.config')
-rwxr-xr-x.config/swayrbar/scripts/brightness-status14
-rwxr-xr-x.config/swayrbar/scripts/temp-status16
2 files changed, 15 insertions, 15 deletions
diff --git a/.config/swayrbar/scripts/brightness-status b/.config/swayrbar/scripts/brightness-status
index 562ee62..db93076 100755
--- a/.config/swayrbar/scripts/brightness-status
+++ b/.config/swayrbar/scripts/brightness-status
@@ -1,17 +1,7 @@
#!/usr/bin/env sh
-brightness_path=/sys/class/backlight/*/brightness
-brightness_max_path=/sys/class/backlight/*/max_brightness
-
-if [ -f "${brightness_path}" ]
-then
- brightness="$(cat $brightness_path)"
-fi
-
-if [ -f "${brightness_max_path}" ]
-then
- brightness_max="$(cat /sys/class/backlight/*/max_brightness)"
-fi
+brightness="$(cat /sys/class/backlight/*/brightness)"
+brightness_max="$(cat /sys/class/backlight/*/max_brightness)"
if [ -n "${brightness}" ] && [ -n "${brightness_max}" ]
then
diff --git a/.config/swayrbar/scripts/temp-status b/.config/swayrbar/scripts/temp-status
index 60220d2..2d54d39 100755
--- a/.config/swayrbar/scripts/temp-status
+++ b/.config/swayrbar/scripts/temp-status
@@ -1,6 +1,16 @@
#!/usr/bin/env sh
-temps="$(cat /sys/class/hwmon/hwmon*/temp*_input)"
-temp=$(echo \("$(echo -n "$temps" | tr '\n' '+')) / $(echo "$temps" | wc -l) / 1000" | bc)
+total_temp=0
+i=0
-echo -n "$temp" °C
+for temp_file in /sys/class/hwmon/hwmon*/temp*_input
+do
+ temp="$(cat "${temp_file}")"
+ if [ "${temp}" != "0" ]
+ then
+ total_temp="$(( ${total_temp} + ${temp} ))"
+ i="$(( ${i} + 1 ))"
+ fi
+done
+
+echo -n "$(( ${total_temp} / ${i} / 1000 ))" °C