mirror of
https://github.com/tmux-plugins/tmux-cpu.git
synced 2026-09-10 07:16:16 -04:00
add options to customize the threshold
This commit is contained in:
parent
20120a38ad
commit
de5bd9cf04
|
|
@ -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`
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Reference in a new issue