1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2025-01-12 19:06:36 +00:00

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
This commit is contained in:
Philip Kovacs 2007-06-23 00:29:54 +00:00
parent d5e94d1f9a
commit 6c95750cc6
2 changed files with 11 additions and 13 deletions

View File

@ -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)

View File

@ -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);
}