From 2e3aa41343a7e581e997ca4f9bb367d18bd9f5e6 Mon Sep 17 00:00:00 2001 From: Joe Myre Date: Thu, 11 Aug 2005 16:05:44 +0000 Subject: [PATCH] Tried adding in additional variables for proper units git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky@98 7f574dfc-610e-0410-a909-a81674777703 --- conky.c | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/conky.c b/conky.c index c270405d..99532ed2 100644 --- a/conky.c +++ b/conky.c @@ -256,6 +256,7 @@ static char original_text[] = "$hr\n" "${color grey}Uptime:$color $uptime\n" "${color grey}Frequency (in MHz):$color $freq\n" + "${color grey}Frequency (in Ghz):$color $freq_G\n" "${color grey}RAM Usage:$color $mem/$memmax - $memperc% ${membar 4}\n" "${color grey}Swap Usage:$color $swap/$swapmax - $swapperc% ${swapbar 4}\n" "${color grey}CPU Usage:$color $cpu% ${cpubar 4}\n" @@ -263,6 +264,8 @@ static char original_text[] = "$hr\n" "${color grey}File systems:\n" " / $color${fs_free /}/${fs_size /} ${fs_bar 6 /}\n" + " / $color${fs_free /}/$$fs_size_G /} $(fs_bar 6 /}\n" + " / $color${fs_free /}/$$fs_size_T /} $(fs_bar 6 /}\n" "${color grey}Networking:\n" " Up:$color ${upspeed eth0} k/s${color grey} - Down:$color ${downspeed eth0} k/s\n" "${color grey}Temperatures:\n" @@ -668,11 +671,14 @@ enum text_object_type { OBJ_execbar, OBJ_execgraph, OBJ_freq, + OBJ_freq_G, OBJ_fs_bar, OBJ_fs_bar_free, OBJ_fs_free, OBJ_fs_free_perc, OBJ_fs_size, + OBJ_fs_size_G, + OBJ_fs_size_T, OBJ_fs_used, OBJ_fs_used_perc, OBJ_hr, @@ -927,8 +933,11 @@ if (s[0] == '#') { #endif /* X11 */ OBJ(acpitemp, 0) obj->data.i = open_acpi_temperature(arg); END OBJ(acpiacadapter, 0) - END OBJ(freq, 0) END OBJ(acpifan, 0) END OBJ(battery, - 0) char bat[64]; + END OBJ(freq, 0); + END OBJ(freq_G, 0); + END OBJ(acpifan, 0); + END OBJ(battery, 0); + char bat[64]; if (arg) sscanf(arg, "%63s", bat); else @@ -1049,6 +1058,12 @@ if (s[0] == '#') { END OBJ(fs_size, INFO_FS) if (!arg) arg = "/"; obj->data.fs = prepare_fs_stat(arg); + END OBJ(fs_size_G, INFO_FS) if (!arg) + arg = "/"; + obj->data.fs = prepare_fs_stat(arg); + END OBJ(fs_size_T, INFO_FS) if (!arg) + arg = "/"; + obj->data.fs = prepare_fs_stat(arg); END OBJ(fs_used, INFO_FS) if (!arg) arg = "/"; obj->data.fs = prepare_fs_stat(arg); @@ -1558,6 +1573,10 @@ static void generate_text() OBJ(freq) { snprintf(p, n, "%s", get_freq()); } + OBJ(freq_G) { + float ghz = (float)(atof(get_freq())/10); + snprintf(p, n, "%f", ghz); + } OBJ(adt746xcpu) { snprintf(p, n, "%s", get_adt746x_cpu()); } @@ -1820,6 +1839,16 @@ static void generate_text() human_readable(obj->data.fs->size, p, 255); } + OBJ(fs_size_G) { + if (obj->data.fs != NULL) + human_readable((obj->data.fs->size)/10, + p, 255); + } + OBJ(fs_size_T) { + if (obj->data.fs != NULL) + human_readable((obj->data.fs->size)/100, + p, 255); + } OBJ(fs_used) { if (obj->data.fs != NULL) human_readable(obj->data.fs->size -