2

I'm trying to use conky's image variable in a way that it read the image file path from a file or a pipe.
Something like ${image ${execp cat /home/r1y4n/.conky/imagepath.txt} -p 30,0 -s 150x150 }
But it seems conky doesn't support nesting variables.

here says image variable can be modified at runtime using $execp

So how can I change the image argument in each conky loop?

I want to be able to control the image is shown from outside of conky by creating a bash script or something and setting a shortcut for it.

2
  • Please edit your question and explain what your final objective is. There may be better ways to do it. Are you trying to display a different image every few seconds?
    – terdon
    Commented Apr 1, 2015 at 20:47
  • @terdon: I want to control the image is shown from outside of conky (By creating a bash script or something and setting a shortcut for it);
    – Ariyan
    Commented Apr 1, 2015 at 21:11

1 Answer 1

3

I would simply use a symlink and change its target as needed. For example, create a link called conkyimage.png which points to ~/myimages/unicorn.png:

ln -s ~/myimages/unicorn.png ~/conkyimage

Then, in conkyrc, have it show that image (note the -n, which tells conky not to cache the image):

${image ~/conkyimage.png -p 30,0 -s 150x150 -n }

Finally, write a script that changes the link's target:

#!/usr/bin/env bash

## Update the link's target
ln -fs "$1" ~/conkyimage.png

You then run the script giving it the target image as an argument:

script.sh /path/to/new/image.png
2
  • Thank you; but what if i want to change -s 150x150 option based on each image (So keep the aspect ratio)?
    – Ariyan
    Commented Apr 2, 2015 at 10:52
  • 1
    @4r1y4n I think you will have to write a lua script that conky loads for that but I have no experience with that sort of thing. Alternatively, you can write a more complex bash script that runs ImageMagick's convert to resize the image.
    – terdon
    Commented Apr 2, 2015 at 11:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .