Skip to content

Commit 86c0023

Browse files
ctjhoacasperdcl
authored andcommitted
Fix load_status helper (#70)
load_status helper was based on cpu threshold whatever this percentage represents
1 parent 9f404e0 commit 86c0023

13 files changed

+17
-16
lines changed

scripts/cpu_bg_color.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ get_bg_color_settings() {
2020

2121
print_bg_color() {
2222
local cpu_percentage=$($CURRENT_DIR/cpu_percentage.sh | sed -e 's/%//')
23-
local load_status=$(load_status $cpu_percentage)
23+
local load_status=$(load_status $cpu_percentage "cpu")
2424
if [ $load_status == "low" ]; then
2525
echo "$cpu_low_bg_color"
2626
elif [ $load_status == "medium" ]; then

scripts/cpu_fg_color.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ get_fg_color_settings() {
2020

2121
print_fg_color() {
2222
local cpu_percentage=$($CURRENT_DIR/cpu_percentage.sh | sed -e 's/%//')
23-
local load_status=$(load_status $cpu_percentage)
23+
local load_status=$(load_status $cpu_percentage "cpu")
2424
if [ $load_status == "low" ]; then
2525
echo "$cpu_low_fg_color"
2626
elif [ $load_status == "medium" ]; then

scripts/cpu_icon.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ get_icon_settings() {
2222

2323
print_icon() {
2424
local cpu_percentage=$($CURRENT_DIR/cpu_percentage.sh | sed -e 's/%//')
25-
local load_status=$(load_status $cpu_percentage)
25+
local load_status=$(load_status $cpu_percentage "cpu")
2626
if [ $load_status == "low" ]; then
2727
echo "$cpu_low_icon"
2828
elif [ $load_status == "medium" ]; then

scripts/gpu_bg_color.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ get_bg_color_settings() {
2020

2121
print_bg_color() {
2222
local gpu_percentage=$($CURRENT_DIR/gpu_percentage.sh | sed -e 's/%//')
23-
local gpu_load_status=$(load_status $gpu_percentage)
23+
local gpu_load_status=$(load_status $gpu_percentage "gpu")
2424
if [ $gpu_load_status == "low" ]; then
2525
echo "$gpu_low_bg_color"
2626
elif [ $gpu_load_status == "medium" ]; then

scripts/gpu_fg_color.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ get_fg_color_settings() {
2020

2121
print_fg_color() {
2222
local gpu_percentage=$($CURRENT_DIR/gpu_percentage.sh | sed -e 's/%//')
23-
local gpu_load_status=$(load_status $gpu_percentage)
23+
local gpu_load_status=$(load_status $gpu_percentage "gpu")
2424
if [ $gpu_load_status == "low" ]; then
2525
echo "$gpu_low_fg_color"
2626
elif [ $gpu_load_status == "medium" ]; then

scripts/gpu_icon.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ get_icon_settings() {
2222

2323
print_icon() {
2424
local gpu_percentage=$($CURRENT_DIR/gpu_percentage.sh | sed -e 's/%//')
25-
local gpu_load_status=$(load_status $gpu_percentage)
25+
local gpu_load_status=$(load_status $gpu_percentage "gpu")
2626
if [ $gpu_load_status == "low" ]; then
2727
echo "$gpu_low_icon"
2828
elif [ $gpu_load_status == "medium" ]; then

scripts/gram_bg_color.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ get_bg_color_settings() {
2020

2121
print_bg_color() {
2222
local gram_percentage=$($CURRENT_DIR/gram_percentage.sh | sed -e 's/%//')
23-
local gram_load_status=$(load_status $gram_percentage)
23+
local gram_load_status=$(load_status $gram_percentage "gram")
2424
if [ $gram_load_status == "low" ]; then
2525
echo "$gram_low_bg_color"
2626
elif [ $gram_load_status == "medium" ]; then

scripts/gram_fg_color.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ get_fg_color_settings() {
2020

2121
print_fg_color() {
2222
local gram_percentage=$($CURRENT_DIR/gram_percentage.sh | sed -e 's/%//')
23-
local gram_load_status=$(load_status $gram_percentage)
23+
local gram_load_status=$(load_status $gram_percentage "gram")
2424
if [ $gram_load_status == "low" ]; then
2525
echo "$gram_low_fg_color"
2626
elif [ $gram_load_status == "medium" ]; then

scripts/gram_icon.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ get_icon_settings() {
2222

2323
print_icon() {
2424
local gram_percentage=$($CURRENT_DIR/gram_percentage.sh | sed -e 's/%//')
25-
local gram_load_status=$(load_status $gram_percentage)
25+
local gram_load_status=$(load_status $gram_percentage "gram")
2626
if [ $gram_load_status == "low" ]; then
2727
echo "$gram_low_icon"
2828
elif [ $gram_load_status == "medium" ]; then

scripts/helpers.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,12 @@ fcomp() {
4747

4848
load_status() {
4949
local percentage=$1
50-
cpu_medium_thresh=$(get_tmux_option "@cpu_medium_thresh" "30")
51-
cpu_high_thresh=$(get_tmux_option "@cpu_high_thresh" "80")
52-
if fcomp $cpu_high_thresh $percentage; then
50+
local prefix=$2
51+
medium_thresh=$(get_tmux_option "@${prefix}_medium_thresh" "30")
52+
high_thresh=$(get_tmux_option "@${prefix}_high_thresh" "80")
53+
if fcomp $high_thresh $percentage; then
5354
echo "high"
54-
elif fcomp $cpu_medium_thresh $percentage && fcomp $percentage $cpu_high_thresh; then
55+
elif fcomp $medium_thresh $percentage && fcomp $percentage $high_thresh; then
5556
echo "medium"
5657
else
5758
echo "low"

0 commit comments

Comments
 (0)