mirror of
https://github.com/tmux-plugins/tmux-cpu.git
synced 2026-09-10 07:16:16 -04:00
Fix load_status helper (#70)
load_status helper was based on cpu threshold whatever this percentage represents
This commit is contained in:
parent
9f404e0e0b
commit
86c0023473
|
|
@ -20,7 +20,7 @@ get_bg_color_settings() {
|
|||
|
||||
print_bg_color() {
|
||||
local cpu_percentage=$($CURRENT_DIR/cpu_percentage.sh | sed -e 's/%//')
|
||||
local load_status=$(load_status $cpu_percentage)
|
||||
local load_status=$(load_status $cpu_percentage "cpu")
|
||||
if [ $load_status == "low" ]; then
|
||||
echo "$cpu_low_bg_color"
|
||||
elif [ $load_status == "medium" ]; then
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ get_fg_color_settings() {
|
|||
|
||||
print_fg_color() {
|
||||
local cpu_percentage=$($CURRENT_DIR/cpu_percentage.sh | sed -e 's/%//')
|
||||
local load_status=$(load_status $cpu_percentage)
|
||||
local load_status=$(load_status $cpu_percentage "cpu")
|
||||
if [ $load_status == "low" ]; then
|
||||
echo "$cpu_low_fg_color"
|
||||
elif [ $load_status == "medium" ]; then
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ get_icon_settings() {
|
|||
|
||||
print_icon() {
|
||||
local cpu_percentage=$($CURRENT_DIR/cpu_percentage.sh | sed -e 's/%//')
|
||||
local load_status=$(load_status $cpu_percentage)
|
||||
local load_status=$(load_status $cpu_percentage "cpu")
|
||||
if [ $load_status == "low" ]; then
|
||||
echo "$cpu_low_icon"
|
||||
elif [ $load_status == "medium" ]; then
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ get_bg_color_settings() {
|
|||
|
||||
print_bg_color() {
|
||||
local gpu_percentage=$($CURRENT_DIR/gpu_percentage.sh | sed -e 's/%//')
|
||||
local gpu_load_status=$(load_status $gpu_percentage)
|
||||
local gpu_load_status=$(load_status $gpu_percentage "gpu")
|
||||
if [ $gpu_load_status == "low" ]; then
|
||||
echo "$gpu_low_bg_color"
|
||||
elif [ $gpu_load_status == "medium" ]; then
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ get_fg_color_settings() {
|
|||
|
||||
print_fg_color() {
|
||||
local gpu_percentage=$($CURRENT_DIR/gpu_percentage.sh | sed -e 's/%//')
|
||||
local gpu_load_status=$(load_status $gpu_percentage)
|
||||
local gpu_load_status=$(load_status $gpu_percentage "gpu")
|
||||
if [ $gpu_load_status == "low" ]; then
|
||||
echo "$gpu_low_fg_color"
|
||||
elif [ $gpu_load_status == "medium" ]; then
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ get_icon_settings() {
|
|||
|
||||
print_icon() {
|
||||
local gpu_percentage=$($CURRENT_DIR/gpu_percentage.sh | sed -e 's/%//')
|
||||
local gpu_load_status=$(load_status $gpu_percentage)
|
||||
local gpu_load_status=$(load_status $gpu_percentage "gpu")
|
||||
if [ $gpu_load_status == "low" ]; then
|
||||
echo "$gpu_low_icon"
|
||||
elif [ $gpu_load_status == "medium" ]; then
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ get_bg_color_settings() {
|
|||
|
||||
print_bg_color() {
|
||||
local gram_percentage=$($CURRENT_DIR/gram_percentage.sh | sed -e 's/%//')
|
||||
local gram_load_status=$(load_status $gram_percentage)
|
||||
local gram_load_status=$(load_status $gram_percentage "gram")
|
||||
if [ $gram_load_status == "low" ]; then
|
||||
echo "$gram_low_bg_color"
|
||||
elif [ $gram_load_status == "medium" ]; then
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ get_fg_color_settings() {
|
|||
|
||||
print_fg_color() {
|
||||
local gram_percentage=$($CURRENT_DIR/gram_percentage.sh | sed -e 's/%//')
|
||||
local gram_load_status=$(load_status $gram_percentage)
|
||||
local gram_load_status=$(load_status $gram_percentage "gram")
|
||||
if [ $gram_load_status == "low" ]; then
|
||||
echo "$gram_low_fg_color"
|
||||
elif [ $gram_load_status == "medium" ]; then
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ get_icon_settings() {
|
|||
|
||||
print_icon() {
|
||||
local gram_percentage=$($CURRENT_DIR/gram_percentage.sh | sed -e 's/%//')
|
||||
local gram_load_status=$(load_status $gram_percentage)
|
||||
local gram_load_status=$(load_status $gram_percentage "gram")
|
||||
if [ $gram_load_status == "low" ]; then
|
||||
echo "$gram_low_icon"
|
||||
elif [ $gram_load_status == "medium" ]; then
|
||||
|
|
|
|||
|
|
@ -47,11 +47,12 @@ fcomp() {
|
|||
|
||||
load_status() {
|
||||
local percentage=$1
|
||||
cpu_medium_thresh=$(get_tmux_option "@cpu_medium_thresh" "30")
|
||||
cpu_high_thresh=$(get_tmux_option "@cpu_high_thresh" "80")
|
||||
if fcomp $cpu_high_thresh $percentage; then
|
||||
local prefix=$2
|
||||
medium_thresh=$(get_tmux_option "@${prefix}_medium_thresh" "30")
|
||||
high_thresh=$(get_tmux_option "@${prefix}_high_thresh" "80")
|
||||
if fcomp $high_thresh $percentage; then
|
||||
echo "high"
|
||||
elif fcomp $cpu_medium_thresh $percentage && fcomp $percentage $cpu_high_thresh; then
|
||||
elif fcomp $medium_thresh $percentage && fcomp $percentage $high_thresh; then
|
||||
echo "medium"
|
||||
else
|
||||
echo "low"
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ get_bg_color_settings() {
|
|||
|
||||
print_bg_color() {
|
||||
local ram_percentage=$($CURRENT_DIR/ram_percentage.sh | sed -e 's/%//')
|
||||
local ram_load_status=$(load_status $ram_percentage)
|
||||
local ram_load_status=$(load_status $ram_percentage "ram")
|
||||
if [ $ram_load_status == "low" ]; then
|
||||
echo "$ram_low_bg_color"
|
||||
elif [ $ram_load_status == "medium" ]; then
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ get_fg_color_settings() {
|
|||
|
||||
print_fg_color() {
|
||||
local ram_percentage=$($CURRENT_DIR/ram_percentage.sh | sed -e 's/%//')
|
||||
local ram_load_status=$(load_status $ram_percentage)
|
||||
local ram_load_status=$(load_status $ram_percentage "ram")
|
||||
if [ $ram_load_status == "low" ]; then
|
||||
echo "$ram_low_fg_color"
|
||||
elif [ $ram_load_status == "medium" ]; then
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ get_icon_settings() {
|
|||
|
||||
print_icon() {
|
||||
local ram_percentage=$($CURRENT_DIR/ram_percentage.sh | sed -e 's/%//')
|
||||
local ram_load_status=$(load_status $ram_percentage)
|
||||
local ram_load_status=$(load_status $ram_percentage "ram")
|
||||
if [ $ram_load_status == "low" ]; then
|
||||
echo "$ram_low_icon"
|
||||
elif [ $ram_load_status == "medium" ]; then
|
||||
|
|
|
|||
Loading…
Reference in a new issue