diff --git a/src/core.c b/src/core.c index 69b748f5..1ddf0333 100644 --- a/src/core.c +++ b/src/core.c @@ -582,7 +582,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long obj->callbacks.free = &free_exec; #endif /* X11 */ END OBJ_ARG(execibar, 0, "execibar needs arguments") - scan_execi_arg(obj, arg); + scan_execi_bar_arg(obj, arg); obj->callbacks.barval = &execi_barval; obj->callbacks.free = &free_execi; #ifdef X11 @@ -592,7 +592,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long obj->callbacks.free = &free_execi; #endif /* X11 */ END OBJ_ARG(execigauge, 0, "execigauge needs arguments") - scan_execi_arg(obj, arg); + scan_execi_gauge_arg(obj, arg); obj->callbacks.gaugeval = &execi_barval; obj->callbacks.free = &free_execi; END OBJ_ARG(execi, 0, "execi needs arguments") diff --git a/src/exec.c b/src/exec.c index 1d74764e..be72485e 100644 --- a/src/exec.c +++ b/src/exec.c @@ -253,6 +253,20 @@ void scan_execi_arg(struct text_object *obj, const char *arg) obj->data.opaque = ed; } +void scan_execi_bar_arg(struct text_object *obj, const char *arg) +{ + /* XXX: do real bar parsing here */ + scan_bar(obj, "", 100); + scan_execi_arg(obj, arg); +} + +void scan_execi_gauge_arg(struct text_object *obj, const char *arg) +{ + /* XXX: do real gauge parsing here */ + scan_gauge(obj, "", 100); + scan_execi_arg(obj, arg); +} + #ifdef X11 void scan_execgraph_arg(struct text_object *obj, const char *arg) { @@ -360,7 +374,7 @@ double execbarval(struct text_object *obj) return read_exec_barnum(obj->data.s); } -uint8_t execi_barval(struct text_object *obj) +double execi_barval(struct text_object *obj) { struct execi_data *ed = obj->data.opaque; @@ -368,10 +382,10 @@ uint8_t execi_barval(struct text_object *obj) return 0; if (time_to_update(ed)) { - ed->barnum = read_exec_barnum(ed->cmd) * 2.55; + ed->barnum = read_exec_barnum(ed->cmd); ed->last_update = current_update_time; } - return round_to_int(ed->barnum); + return ed->barnum; } void free_exec(struct text_object *obj) diff --git a/src/exec.h b/src/exec.h index cde5a163..ffb00e29 100644 --- a/src/exec.h +++ b/src/exec.h @@ -36,6 +36,8 @@ extern pid_t childpid; void scan_exec_arg(struct text_object *, const char *); void scan_pre_exec_arg(struct text_object *, const char *); void scan_execi_arg(struct text_object *, const char *); +void scan_execi_bar_arg(struct text_object *, const char *); +void scan_execi_gauge_arg(struct text_object *, const char *); void scan_execgraph_arg(struct text_object *, const char *); void print_exec(struct text_object *, char *, int); void print_execp(struct text_object *, char *, int); @@ -43,7 +45,7 @@ void print_execi(struct text_object *, char *, int); void print_execpi(struct text_object *, char *, int); void print_texeci(struct text_object *, char *, int); double execbarval(struct text_object *); -uint8_t execi_barval(struct text_object *); +double execi_barval(struct text_object *); void free_exec(struct text_object *); void free_execi(struct text_object *); #endif /* _EXEC_H */