I am working on a display monitors info widget for my conky. The following 3 bash scripts work perfectly in terminal:
[code[
logansfury@OptiPlex-5040:~$ freq=$(xrandr | sed -n '/^HDMI-A-0/,/^[^[:space:]]/p' | awk 'sub("*"," "){print $2}'); echo "${freq:-No monitor detected}"
59.95
logansfury@OptiPlex-5040:~$ freq=$(xrandr | sed -n '/^HDMI-A-1/,/^[^[:space:]]/p' | awk 'sub("*"," "){print $2}'); echo "${freq:-No monitor detected}"
59.95
logansfury@OptiPlex-5040:~$ freq=$(xrandr | sed -n '/^DisplayPort-0/,/^[^[:space:]]/p' | awk 'sub("*"," "){print $2}'); echo "${freq:-No monitor detected}"
No monitor detected
logansfury@OptiPlex-5040:~$ [/code]
However, when I try to use in conky, it prevents the entire widget from displaying and I cannot get a start from terminal to keep a terminal open long enough to read anything:
Code: Select all
${color1}${goto 35}Display 1 Refesh Rate: ${alignr}${color0}${exec freq=$(xrandr | sed -n '/^HDMI-A-0/,/^[^[:space:]]/p' | awk 'sub("*"," "){print $2}'); echo "${freq:-No monitor detected}"}