Do not set state to 'warning' if tasks are complete

* Also, show complete/total
This commit is contained in:
Brian Buller 2021-04-29 11:36:05 -05:00
parent 2ba309fe36
commit c9813b1aaf
1 changed files with 7 additions and 3 deletions

View File

@ -28,12 +28,16 @@ func (a *AppState) opI3Status(args []string) int {
if state != "Warning" {
warning := a.config.Get("i3status_warning")
if warning != "" {
if len(*a.getFilteredList(warning)) > 0 {
state = "Warning"
t := a.getFilteredList(warning)
for _, v := range *t {
if !v.HasCompletedDate() {
state = "Warning"
break
}
}
}
}
fmt.Printf("{\"icon\":\"tasks\",\"state\":\"%s\", \"text\": \"%s: %d/%d\"}", state, filterString, incomplete, total)
fmt.Printf("{\"icon\":\"tasks\",\"state\":\"%s\", \"text\": \"%s: %d/%d\"}", state, filterString, (total - incomplete), total)
return 0
}