commit dddee901f09274ff6540a8d8e30acc77b7ee590b
parent 24dfacb6a571b6a5bffd80604945f28ce392ef8c
Author: Santtu Lakkala <inz@inz.fi>
Date: Mon, 9 Nov 2015 06:44:11 +0000
Made conky eval useful
Diffstat:
1 file changed, 27 insertions(+), 0 deletions(-)
diff --git a/posts/made-conky-eval-useful.md b/posts/made-conky-eval-useful.md
@@ -0,0 +1,27 @@
+# Made conky eval useful
+
+ 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):
+
+ diff --git a/src/conky.c b/src/conky.c
+ index 5848b61..8702cea 100644
+ --- a/src/conky.c
+ +++ b/src/conky.c
+ @@ -1103,7 +1103,9 @@ void generate_text_internal(char *p, int p_max_size,
+ }
+ #endif /* IMLIB2 */
+ OBJ(eval) {
+ - evaluate(obj->data.s, p, p_max_size);
+ + char buffer[max_user_text];
+ + evaluate(obj->data.s, buffer, sizeof(buffer));
+ + evaluate(buffer, p, p_max_size);
+ }
+ OBJ(exec) {
+ print_exec(obj, p, p_max_size);
+
+ 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):
+
+ ${eval $${addr ${gw_iface}}}
+
+The [patch](http://inz.fi/p/raw/eval-fix.patch) applies against conky 1.9.0, unfortunately not against the heavily rewritten git master.
+
+**Update:** similar patch I made against the 1.10.x has been merged to upstream conky; yay!