0

You can use bash code, and call bash scripts, in conky.text. Is there any way to use it in conky.config?

The reason I want this is to have window specifications depending on whether I have an external monitor connected or not.

So I want logic similar to this:

if xrandr -q | grep -oP 'HDMI2\sconnected' > /dev/null ; then
    x=-900
else
    x=0
fi

gap_x=$x
jkazan
  • 1,149
  • 12
  • 29

2 Answers2

0

I personally do not encourage the following solution, but if all else fails, this will at least work very well.

Make a copy of your .conkyrc file, let's call it .conkyrc_dual, and make the bash file below:

#!/bin/bash
pkill conky

if xrandr -q | grep -oP 'HDMI2\sconnected' > /dev/null ; then
    conky -c ~/.conkyrc_dual
    notify-send 'Conky' 'Dual monitors'
else
    conky
    notify-send 'Conky' 'Single monitor'
fi

Now run this file when you want to start conky.

jkazan
  • 1,149
  • 12
  • 29
0

You could also have a bash script use sed to edit the gap_x variable in your .conkyrc file as needed before starting conky. That way, you'd only need a single config file. Keep a backup of .conkyrc, of course, just in case something goes terribly awry.

David Yockey
  • 595
  • 3
  • 11