mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-12-24 11:55:43 +00:00
Let membar work in shell
This commit is contained in:
parent
0cb91fc3db
commit
bfc791f08b
@ -38,7 +38,7 @@ ${scroll 16 $nodename - $sysname $kernel on $machine | }
|
||||
Uptime: $uptime
|
||||
Frequency (in MHz): $freq
|
||||
Frequency (in GHz): $freq_g
|
||||
RAM Usage: $mem/$memmax - $memperc%
|
||||
RAM Usage: $mem/$memmax - $memperc% ${membar 4}
|
||||
Swap Usage: $swap/$swapmax - $swapperc%
|
||||
CPU Usage: $cpu%
|
||||
Processes: $processes Running: $running_processes
|
||||
|
29
src/conky.c
29
src/conky.c
@ -2241,9 +2241,11 @@ static struct text_object *construct_text_object(const char *s,
|
||||
END OBJ(memgauge, INFO_MEM)
|
||||
SIZE_DEFAULTS(gauge);
|
||||
scan_gauge(arg, &obj->data.pair.a, &obj->data.pair.b);
|
||||
#endif /* X11*/
|
||||
END OBJ(membar, INFO_MEM)
|
||||
SIZE_DEFAULTS(bar);
|
||||
scan_bar(arg, &obj->data.pair.a, &obj->data.pair.b);
|
||||
#ifdef X11
|
||||
END OBJ(memgraph, INFO_MEM)
|
||||
char *buf = 0;
|
||||
SIZE_DEFAULTS(graph);
|
||||
@ -2253,7 +2255,7 @@ static struct text_object *construct_text_object(const char *s,
|
||||
if (buf) {
|
||||
free(buf);
|
||||
}
|
||||
#endif
|
||||
#endif /* X11*/
|
||||
END OBJ(mixer, INFO_MIXER)
|
||||
obj->data.l = mixer_init(arg);
|
||||
END OBJ(mixerl, INFO_MIXER)
|
||||
@ -3937,7 +3939,7 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
new_gauge(p, obj->a, obj->b, round_to_int(barnum * 255.0));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif /* X11 */
|
||||
OBJ(execbar) {
|
||||
double barnum;
|
||||
|
||||
@ -3950,12 +3952,12 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
barnum /= 100;
|
||||
new_bar(p, obj->a, obj->b, round_to_int(barnum * 255.0));
|
||||
}else{
|
||||
#endif
|
||||
#endif /* X11 */
|
||||
if(!obj->a) obj->a = DEFAULT_BAR_WIDTH_NO_X;
|
||||
new_bar_in_shell(p, p_max_size, barnum, obj->a);
|
||||
#ifdef X11
|
||||
}
|
||||
#endif
|
||||
#endif /* X11 */
|
||||
}
|
||||
}
|
||||
#ifdef X11
|
||||
@ -4043,7 +4045,7 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
}
|
||||
new_gauge(p, obj->a, obj->b, round_to_int(obj->f));
|
||||
}
|
||||
#endif
|
||||
#endif /* X11 */
|
||||
OBJ(execi) {
|
||||
if (current_update_time - obj->data.execi.last_update
|
||||
>= obj->data.execi.interval
|
||||
@ -4573,16 +4575,27 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
new_gauge(p, obj->data.pair.a, obj->data.pair.b,
|
||||
cur->memmax ? (cur->mem * 255) / (cur->memmax) : 0);
|
||||
}
|
||||
#endif /* X11 */
|
||||
OBJ(membar) {
|
||||
new_bar(p, obj->data.pair.a, obj->data.pair.b,
|
||||
cur->memmax ? (cur->mem * 255) / (cur->memmax) : 0);
|
||||
#ifdef X11
|
||||
if(output_methods & TO_X) {
|
||||
new_bar(p, obj->data.pair.a, obj->data.pair.b,
|
||||
cur->memmax ? (cur->mem * 255) / (cur->memmax) : 0);
|
||||
}else{
|
||||
#endif /* X11 */
|
||||
if(!obj->data.pair.a) obj->data.pair.a = DEFAULT_BAR_WIDTH_NO_X;
|
||||
new_bar_in_shell(p, p_max_size, cur->memmax ? (cur->mem * 100) / (cur->memmax) : 0, obj->data.pair.a);
|
||||
#ifdef X11
|
||||
}
|
||||
#endif /* X11 */
|
||||
}
|
||||
#ifdef X11
|
||||
OBJ(memgraph) {
|
||||
new_graph(p, obj->a, obj->b, obj->c, obj->d,
|
||||
cur->memmax ? (cur->mem * 100.0) / (cur->memmax) : 0.0,
|
||||
100, 1, obj->char_a, obj->char_b);
|
||||
}
|
||||
#endif
|
||||
#endif /* X11 */
|
||||
/* mixer stuff */
|
||||
OBJ(mixer) {
|
||||
percent_print(p, p_max_size, mixer_get_avg(obj->data.l));
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include "colours.h"
|
||||
#ifdef X11
|
||||
#include "fonts.h"
|
||||
#endif
|
||||
#endif /* X11 */
|
||||
#include "logging.h"
|
||||
#include "specials.h"
|
||||
#include <math.h>
|
||||
@ -46,7 +46,7 @@ int default_bar_width = 0, default_bar_height = 6;
|
||||
#ifdef X11
|
||||
int default_graph_width = 0, default_graph_height = 25;
|
||||
int default_gauge_width = 40, default_gauge_height = 25;
|
||||
#endif
|
||||
#endif /* X11 */
|
||||
|
||||
/*
|
||||
* Scanning arguments to various special text objects
|
||||
@ -73,6 +73,7 @@ const char *scan_gauge(const char *args, int *w, int *h)
|
||||
|
||||
return args;
|
||||
}
|
||||
#endif /* X11 */
|
||||
|
||||
const char *scan_bar(const char *args, int *w, int *h)
|
||||
{
|
||||
@ -92,6 +93,7 @@ const char *scan_bar(const char *args, int *w, int *h)
|
||||
return args;
|
||||
}
|
||||
|
||||
#ifdef X11
|
||||
char *scan_font(const char *args)
|
||||
{
|
||||
if (args && *args) {
|
||||
@ -195,7 +197,7 @@ char *scan_graph(const char *args, int *w, int *h,
|
||||
return strndup(buf, text_buffer_size);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif /* X11 */
|
||||
|
||||
/*
|
||||
* Printing various special text objects
|
||||
@ -378,7 +380,7 @@ void new_bg(char *buf, long c)
|
||||
|
||||
new_special(buf, BG)->arg = c;
|
||||
}
|
||||
#endif
|
||||
#endif /* X11 */
|
||||
|
||||
void new_bar_in_shell(char* buffer, int buf_max_size, double usage, int width)
|
||||
{
|
||||
|
@ -88,10 +88,10 @@ extern int default_gauge_height;
|
||||
/* max number of specials allowed (TODO: use linked list instead) */
|
||||
extern int max_specials;
|
||||
|
||||
#ifdef X11
|
||||
/* scanning special arguments */
|
||||
const char *scan_gauge(const char *, int *, int *);
|
||||
const char *scan_bar(const char *, int *, int *);
|
||||
#ifdef X11
|
||||
const char *scan_gauge(const char *, int *, int *);
|
||||
char *scan_font(const char *);
|
||||
char *scan_graph(const char *, int *, int *, unsigned int *,
|
||||
unsigned int *, unsigned int *, char *, char *);
|
||||
|
@ -156,7 +156,7 @@ enum text_object_type {
|
||||
OBJ_smapi,
|
||||
#ifdef X11
|
||||
OBJ_smapi_bat_bar,
|
||||
#endif
|
||||
#endif /* X11 */
|
||||
OBJ_smapi_bat_perc,
|
||||
OBJ_smapi_bat_temp,
|
||||
OBJ_smapi_bat_power,
|
||||
@ -182,7 +182,7 @@ enum text_object_type {
|
||||
OBJ_wireless_link_qual_perc,
|
||||
#ifdef X11
|
||||
OBJ_wireless_link_bar,
|
||||
#endif
|
||||
#endif /* X11 */
|
||||
#endif /* __linux__ */
|
||||
#if defined(__FreeBSD__) || defined(__linux__)
|
||||
OBJ_if_up,
|
||||
@ -221,9 +221,9 @@ enum text_object_type {
|
||||
OBJ_memfree,
|
||||
#ifdef X11
|
||||
OBJ_memgauge,
|
||||
OBJ_membar,
|
||||
OBJ_memgraph,
|
||||
#endif
|
||||
#endif /* X11 */
|
||||
OBJ_membar,
|
||||
OBJ_memmax,
|
||||
OBJ_memperc,
|
||||
OBJ_mixer,
|
||||
@ -233,12 +233,12 @@ enum text_object_type {
|
||||
OBJ_mixerbar,
|
||||
OBJ_mixerlbar,
|
||||
OBJ_mixerrbar,
|
||||
#endif
|
||||
#endif /* X11 */
|
||||
OBJ_if_mixer_mute,
|
||||
#ifdef X11
|
||||
OBJ_monitor,
|
||||
OBJ_monitor_number,
|
||||
#endif
|
||||
#endif /* X11 */
|
||||
OBJ_nameserver,
|
||||
OBJ_nodename,
|
||||
OBJ_nvidia,
|
||||
@ -251,7 +251,7 @@ enum text_object_type {
|
||||
OBJ_swap,
|
||||
#ifdef X11
|
||||
OBJ_swapbar,
|
||||
#endif
|
||||
#endif /* X11 */
|
||||
OBJ_swapmax,
|
||||
OBJ_swapperc,
|
||||
OBJ_sysname,
|
||||
@ -266,7 +266,7 @@ enum text_object_type {
|
||||
OBJ_upspeedf,
|
||||
#ifdef X11
|
||||
OBJ_upspeedgraph,
|
||||
#endif
|
||||
#endif /* X11 */
|
||||
OBJ_uptime,
|
||||
OBJ_uptime_short,
|
||||
OBJ_user_names,
|
||||
|
Loading…
Reference in New Issue
Block a user