My problems is to merge these two functions into one:

  1. ${fs_bar 6 dev/sr0} or ${fs_bar 6 /run/media/'home folder name'/'dvd label'}

  2. blkid -s LABEL -o value /dev/sr0

I want to obtain a sort of this:

${fs_bar 6 blkid -s LABEL -o value /dev/sr0}

sr0 is the DVD device.

Basically I want to get the DVD label automatically and pass it to the fs_bar variable. I don't want to type the mount point in the ${fs_bar...} cause it changes based on the DVD.

  • So the blkid -s LABEL -o value /dev/sr0 command returns the value of the LABEL tag. That value doesn't seem to be a valid input for the fs_bar command. Can you provide a example of doing this manually, hopefully with some sample output for each command? – Haxiel Feb 14 at 10:19
  • blkid -s LABEL -o value /dev/sr0 gives you the name of the dvd label: for example if you burn a dvd and you call it "Cars of the world", when you type that command in the terminal you get the label "Cars of the world" (you can try it for yourself, put a dvd into the device and type the command in the terminal, you'll get the name of the dvd). I know it is not a standard input for ${fs_bar...} conky variable, that's why i'm here to ask for help. ${fs_bar 6 /} gives the used/free space for the sda disk as a bar (see pic1 ibb.co/KWzjxq2). – Ignorant Feb 14 at 10:40
  • if i type ${fs_bar 6 dev/sr0} in conky, the bar doesn't work but if i type this ${fs_bar 6 /run/media/'home folder name'/'dvd label'} it works; the point is that every dvd has a different label so i have to get it automatically and to do that i need to pass that to the fs_bar variable in some ways. – Ignorant Feb 14 at 10:40

You can do this using ${eval} to reparse the output of the command ${execi}:

${eval $${fs_bar 6 /run/media/${execi 9999 id -nu}/${execi 5 blkid -s LABEL -o value /dev/sr0}}

Note the double $$ to stop fs_bar from being parsed. The first execi runs only once every 9999 seconds. It gets your user name from the usual id command.

The second execi runs (for example) every 5 seconds to find the label of the dvd. Choose an appropriate polling interval.

The resulting final string is then given to fs_bar by eval.

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.