1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-17 10:35:10 +00:00

fixed tab code, changed $tab to $offset

git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky@36 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
Brenden Matthews 2005-07-31 19:49:39 +00:00
parent 296c451135
commit 4435a165b7
3 changed files with 15 additions and 14 deletions

2
README
View File

@ -271,7 +271,7 @@
swapmax Total amount of swap swapmax Total amount of swap
swapperc Percentage of swap in use swapperc Percentage of swap in use
sysname System name, Linux for example sysname System name, Linux for example
tab pixels Move text over by N pixels offset pixels Move text over by N pixels
tail logfile, lines (interval) tail logfile, lines (interval)
Displays last N lines of supplied text Displays last N lines of supplied text
text file. If interval is not supplied, text file. If interval is not supplied,

23
conky.c
View File

@ -216,7 +216,7 @@ enum {
ALIGNR, ALIGNR,
ALIGNC, ALIGNC,
GRAPH, GRAPH,
TAB, OFFSET,
}; };
static struct special_t { static struct special_t {
@ -385,9 +385,9 @@ static inline void new_outline(char *buf, long c)
new_special(buf, OUTLINE)->arg = c; new_special(buf, OUTLINE)->arg = c;
} }
static inline void new_tab(char *buf, long c) static inline void new_offset(char *buf, long c)
{ {
new_special(buf, TAB)->arg = c; new_special(buf, OFFSET)->arg = c;
} }
static inline void new_alignr(char *buf, long c) static inline void new_alignr(char *buf, long c)
@ -489,7 +489,7 @@ enum text_object_type {
OBJ_fs_used, OBJ_fs_used,
OBJ_fs_used_perc, OBJ_fs_used_perc,
OBJ_hr, OBJ_hr,
OBJ_tab, OBJ_offset,
OBJ_alignr, OBJ_alignr,
OBJ_alignc, OBJ_alignc,
OBJ_i2c, OBJ_i2c,
@ -857,7 +857,7 @@ static void construct_text_object(const char *s, const char *arg)
arg = "/"; arg = "/";
obj->data.fs = prepare_fs_stat(arg); obj->data.fs = prepare_fs_stat(arg);
END OBJ(hr, 0) obj->data.i = arg ? atoi(arg) : 1; END OBJ(hr, 0) obj->data.i = arg ? atoi(arg) : 1;
END OBJ(tab, 0) obj->data.i = arg ? atoi(arg) : 1; END OBJ(offset, 0) obj->data.i = arg ? atoi(arg) : 1;
END OBJ(i2c, INFO_I2C) char buf1[64], buf2[64]; END OBJ(i2c, INFO_I2C) char buf1[64], buf2[64];
int n; int n;
@ -1679,8 +1679,8 @@ static void generate_text()
OBJ(hr) { OBJ(hr) {
new_hr(p, obj->data.i); new_hr(p, obj->data.i);
} }
OBJ(tab) { OBJ(offset) {
new_tab(p, obj->data.i); new_offset(p, obj->data.i);
} }
OBJ(i2c) { OBJ(i2c) {
double r; double r;
@ -2819,11 +2819,12 @@ static void draw_line(char *s)
arg); arg);
break; break;
case TAB: case OFFSET:
{ {
int pos_x = text_start_x + text_width - cur_x - 1; w = text_start_x + specials[special_index].arg;
if ( pos_x > specials[special_index].arg) printf("w %i width %i\n", w, text_width);
w = pos_x - specials[special_index].arg; if ((w + get_string_width(p)) > text_width)
w = text_width - get_string_width(p);
} }
break; break;

View File

@ -256,7 +256,7 @@ metar_station CYBW
# swapmax Total amount of swap # swapmax Total amount of swap
# swapperc Percentage of swap in use # swapperc Percentage of swap in use
# sysname System name, Linux for example # sysname System name, Linux for example
# tab pixels Move text over by N pixels # offset pixels Move text over by N pixels
# tail logfile, lines (interval) # tail logfile, lines (interval)
# Displays last N lines of supplied text # Displays last N lines of supplied text
# text file. If interval is not supplied, # text file. If interval is not supplied,