add options to customize the threshold

This commit is contained in:
Yuta Katayama 2020-08-09 15:15:54 +09:00
parent 20120a38ad
commit de5bd9cf04
2 changed files with 7 additions and 2 deletions

View file

@ -111,6 +111,9 @@ Here are all available options with their default values:
@cpu_high_bg_color "#[bg=red]" # background color when cpu is high
@cpu_percentage_format "%3.1f%%" # printf format to use to display percentage
@tmux_cpu_medium_threshold "70" # medium threshold
@tmux_cpu_high_threshold "90" # high threshold
```
Same options are valid with `@gpu`

View file

@ -41,9 +41,11 @@ fcomp() {
load_status() {
local percentage=$1
if fcomp 80 $percentage; then
tmux_cpu_high_threshold=$(get_tmux_option "@tmux_cpu_high_threshold" "80")
tmux_cpu_medium_threshold=$(get_tmux_option "@tmux_cpu_medium_threshold" "30")
if fcomp $tmux_cpu_high_threshold $percentage; then
echo "high"
elif fcomp 30 $percentage && fcomp $percentage 80; then
elif fcomp $tmux_cpu_medium_threshold $percentage && fcomp $percentage $tmux_cpu_high_threshold; then
echo "medium"
else
echo "low"