From 6c95750cc6c4cd54d1a253be3f0c70e74b813ee5 Mon Sep 17 00:00:00 2001 From: Philip Kovacs Date: Sat, 23 Jun 2007 00:29:54 +0000 Subject: [PATCH] Right-justify top/top_mem vars (pid/cpu/mem} so they align on the decimal. git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@881 7f574dfc-610e-0410-a909-a81674777703 --- ChangeLog | 3 +++ src/conky.c | 21 ++++++++------------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3b414271..aa12aa22 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ # $Id$ +2007-06-21 + * Right-justify top/top_mem vars (pid/cpu/mem} so they align on the decimal. + 2007-04-25 * Added color[0-9] variable patch (thanks jieryn) diff --git a/src/conky.c b/src/conky.c index de122318..c77d0aec 100644 --- a/src/conky.c +++ b/src/conky.c @@ -4939,25 +4939,23 @@ static void generate_text_internal(char *p, int p_max_size, struct text_object * if (obj->data.top.type == TOP_NAME && obj->data.top.num >= 0 && obj->data.top.num < 10) { - // if we limit the buffer and add a bunch of space after, it stops the thing from - // moving other shit around, which is really fucking annoying - snprintf(p, 17, "%s ", cur->cpu[obj->data.top.num]->name); + snprintf(p, 17, "%-17s", cur->cpu[obj->data.top.num]->name); } else if (obj->data.top.type == TOP_CPU && obj->data.top.num >= 0 && obj->data.top.num < 10) { - snprintf(p, 7, "%3.2f ", + snprintf(p, 7, "%7.3f", cur->cpu[obj->data.top. num]->amount); } else if (obj->data.top.type == TOP_PID && obj->data.top.num >= 0 && obj->data.top.num < 10) { - snprintf(p, 8, "%i ", + snprintf(p, 8, "%8i", cur->cpu[obj->data.top. num]->pid); } else if (obj->data.top.type == TOP_MEM && obj->data.top.num >= 0 && obj->data.top.num < 10) { - snprintf(p, 7, "%3.2f ", + snprintf(p, 7, "%7.3f", cur->cpu[obj->data.top. num]->totalmem); } @@ -4966,28 +4964,25 @@ static void generate_text_internal(char *p, int p_max_size, struct text_object * if (obj->data.top.type == TOP_NAME && obj->data.top.num >= 0 && obj->data.top.num < 10) { - // if we limit the buffer and add a bunch of space after, it stops the thing from - // moving other shit around, which is really fucking annoying - snprintf(p, 17, - "%s ", + snprintf(p, 17, "%-17s", cur->memu[obj->data.top. num]->name); } else if (obj->data.top.type == TOP_CPU && obj->data.top.num >= 0 && obj->data.top.num < 10) { - snprintf(p, 7, "%3.2f ", + snprintf(p, 7, "%7.3f", cur->memu[obj->data.top. num]->amount); } else if (obj->data.top.type == TOP_PID && obj->data.top.num >= 0 && obj->data.top.num < 10) { - snprintf(p, 8, "%i ", + snprintf(p, 8, "%8i", cur->memu[obj->data.top. num]->pid); } else if (obj->data.top.type == TOP_MEM && obj->data.top.num >= 0 && obj->data.top.num < 10) { - snprintf(p, 7, "%3.2f ", + snprintf(p, 7, "%7.3f", cur->memu[obj->data.top. num]->totalmem); }