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.

  • 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 Apr 1 '15 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); – RYN Apr 1 '15 at 21:11
2

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
  • Thank you; but what if i want to change -s 150x150 option based on each image (So keep the aspect ratio)? – RYN Apr 2 '15 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 Apr 2 '15 at 11:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.