made-conky-eval-useful.md (1122B)
1 # Made conky eval useful 2 3 Conky's eval seems rather useless, at least I couldn't get it do anything I wanted, so I added a little patch to make it more useful (to me): 4 5 diff --git a/src/conky.c b/src/conky.c 6 index 5848b61..8702cea 100644 7 --- a/src/conky.c 8 +++ b/src/conky.c 9 @@ -1103,7 +1103,9 @@ void generate_text_internal(char *p, int p_max_size, 10 } 11 #endif /* IMLIB2 */ 12 OBJ(eval) { 13 - evaluate(obj->data.s, p, p_max_size); 14 + char buffer[max_user_text]; 15 + evaluate(obj->data.s, buffer, sizeof(buffer)); 16 + evaluate(buffer, p, p_max_size); 17 } 18 OBJ(exec) { 19 print_exec(obj, p, p_max_size); 20 21 Probably not the best thing ever, but seems to do the trick for me; now I can get the address of the interface connected to the big bad internets with (note: won't work correctly when multiple interfaces with default route): 22 23 ${eval $${addr ${gw_iface}}} 24 25 The [patch](http://inz.fi/p/raw/eval-fix.patch) applies against conky 1.9.0, unfortunately not against the heavily rewritten git master. 26 27 **Update:** similar patch I made against the 1.10.x has been merged to upstream conky; yay!