Conky External Scrtipt Not Displaying

Add functionality to your desktop
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
Jator
Level 2
Level 2
Posts: 80
Joined: Sat Mar 13, 2021 10:58 am

Conky External Scrtipt Not Displaying

Post by Jator »

I have a call out in Conky to an external script (callout from conkyrc file below:

Code: Select all

${exec /home/jay/temp/dvr_openchannels_d}
I have the following in the dvr_openchannels_d file (it is set to be executable):

Code: Select all

#!/bin/sh

echo "\${goto 10}- ch8.1 WGAL-TV"
However, conky displays the following when it calls out to the script:

-$(goto 10)- Ch8.1 WGAL-TV.
The "-$goto 10}" is supposed to be part of the conky display settings like the rest of the script, but it displays like the above. What's weird is I have a similar script which shows my GPU info on my server with no problems. Any idea what I am doing wrong?

TIA

PS, here's the obligatory inxi display;

Code: Select all

System:
  Kernel: 5.11.0-22-generic x86_64 bits: 64 compiler: N/A 
  Desktop: Cinnamon 5.0.4 wm: muffin 5.0.1 dm: LightDM 1.30.0 
  Distro: Linux Mint 20.2 Uma base: Ubuntu 20.04 focal 
Machine:
  Type: Convertible System: LENOVO product: 81X2 v: IdeaPad Flex 5 14ARE05 
  serial: <filter> Chassis: type: 31 v: IdeaPad Flex 5 14ARE05 
  serial: <filter> 
  Mobo: LENOVO model: LNVNB161216 v: SDK0J40709 WIN serial: <filter> 
  UEFI: LENOVO v: EECN35WW date: 04/16/2021 
Battery:
  ID-1: BAT0 charge: 52.7 Wh condition: 53.6/52.5 Wh (102%) volts: 12.9/11.6 
  model: LGC L19L3PD6 type: Li-poly serial: <filter> status: Discharging 
  cycles: 12 
CPU:
  Topology: 6-Core model: AMD Ryzen 5 4500U with Radeon Graphics bits: 64 
  type: MCP arch: Zen rev: 1 L2 cache: 3072 KiB 
  flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm 
  bogomips: 28444 
  Speed: 1615 MHz min/max: 1400/2375 MHz boost: enabled Core speeds (MHz): 
  1: 1397 2: 1397 3: 1397 4: 1428 5: 1397 6: 1397 
Graphics:
  Device-1: AMD Renoir vendor: Lenovo driver: amdgpu v: kernel 
  bus ID: 04:00.0 chip ID: 1002:1636 
  Display: x11 server: X.Org 1.20.9 driver: amdgpu,ati 
  unloaded: fbdev,modesetting,vesa resolution: 1920x1080~60Hz 
  OpenGL: renderer: AMD RENOIR (DRM 3.40.0 5.11.0-22-generic LLVM 11.0.0) 
  v: 4.6 Mesa 20.2.6 direct render: Yes 
Audio:
  Device-1: AMD driver: snd_hda_intel v: kernel bus ID: 04:00.1 
  chip ID: 1002:1637 
  Device-2: AMD Raven/Raven2/FireFlight/Renoir Audio Processor 
  vendor: Lenovo driver: N/A bus ID: 04:00.5 chip ID: 1022:15e2 
  Device-3: AMD Family 17h HD Audio vendor: Lenovo driver: snd_hda_intel 
  v: kernel bus ID: 04:00.6 chip ID: 1022:15e3 
  Sound Server: ALSA v: k5.11.0-22-generic 
Network:
  Device-1: Realtek RTL8822CE 802.11ac PCIe Wireless Network Adapter 
  vendor: Lenovo driver: rtw_8822ce v: N/A port: 2000 bus ID: 02:00.0 
  chip ID: 10ec:c822 
  IF: wlp2s0 state: up mac: <filter> 
Drives:
  Local Storage: total: 465.76 GiB used: 14.71 GiB (3.2%) 
  ID-1: /dev/nvme0n1 vendor: Crucial model: CT500P5SSD8 size: 465.76 GiB 
  speed: 31.6 Gb/s lanes: 4 serial: <filter> rev: P4CR311 scheme: GPT 
Partition:
  ID-1: / size: 456.96 GiB used: 14.70 GiB (3.2%) fs: ext4 
  dev: /dev/nvme0n1p2 
Sensors:
  System Temperatures: cpu: 39.6 C mobo: 39.0 C gpu: amdgpu temp: 39 C 
  Fan Speeds (RPM): N/A 
Repos:
  No active apt repos in: /etc/apt/sources.list 
  Active apt repos in: /etc/apt/sources.list.d/google-chrome.list 
  1: deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main
  Active apt repos in: /etc/apt/sources.list.d/nm-l2tp-network-manager-l2tp-focal.list 
  1: deb http://ppa.launchpad.net/nm-l2tp/network-manager-l2tp/ubuntu focal main
  Active apt repos in: /etc/apt/sources.list.d/official-package-repositories.list 
  1: deb http://packages.linuxmint.com uma main upstream import backport #id:linuxmint_main
  2: deb http://archive.ubuntu.com/ubuntu focal main restricted universe multiverse
  3: deb http://archive.ubuntu.com/ubuntu focal-updates main restricted universe multiverse
  4: deb http://archive.ubuntu.com/ubuntu focal-backports main restricted universe multiverse
  5: deb http://security.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse
  6: deb http://archive.canonical.com/ubuntu/ focal partner
Info:
  Processes: 261 Uptime: 1d 8h 42m Memory: 15.08 GiB used: 2.23 GiB (14.8%) 
  Init: systemd v: 245 runlevel: 5 Compilers: gcc: 9.3.0 alt: 9 Shell: bash 
  v: 5.0.17 running in: gnome-terminal inxi: 3.0.38 
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
zcot
Level 9
Level 9
Posts: 2833
Joined: Wed Oct 19, 2016 6:08 pm

Re: Conky External Scrtipt Not Displaying

Post by zcot »

change the conkyrc to something like this

Code: Select all

#${exec /home/jay/temp/dvr_openchannels_d}
${lua conky_wtff}
and in the configuration block you add something like this:

Code: Select all

   lua_load = 'wtff.lua',
create that .lua file in the same location as the conky script, otherwise you can't use that relative path above and have to change it to a /full/path/to/wtff.lua.

in the wtff.lua script you have this:

Code: Select all

function conky_wtff()

    local file = io.popen ("/home/jay/temp/dvr_openchannels_d")
    var_wtff = file:read ("*l")
    file:close ()

    return conky_parse(var_wtff)

end
The above example is a brutal solution for what seems on the surface to be a weird problem, but it will work, but there might be a better solution approaching the whole thing differently.

Honestly it's a weird hamburger to eat. It would just seem like you would put "${goto 10}" in the conkyrc and make the $exec call after that, where you are just dealing with normally formatted output instead of conky markup. But I probably don't understand the full relationship because obviously some other work must be going on to get that kind of foreign formatting in the dvr_openchannels_d shell script anyway. And really, if you just cat the dvr_openchannels_d file then you would directly get the interesting data, although it's currently written with a bash script format so that would have to change too.
User avatar
trytip
Level 14
Level 14
Posts: 5366
Joined: Tue Jul 05, 2016 1:20 pm

Re: Conky External Scrtipt Not Displaying

Post by trytip »

are you using firejail with firecfg? exec does not work if you have your systemwide firecfg. if you do not have firejail installed then it's a script error and zcot knows a lot more about script errors
Image
User avatar
zcot
Level 9
Level 9
Posts: 2833
Joined: Wed Oct 19, 2016 6:08 pm

Re: Conky External Scrtipt Not Displaying

Post by zcot »

Ok, I realized another thing. Many of the commands can not be nested, which is unfortunate, but in this case, this is probably a better solution than having to revert to a lua solution which is just making it all the more convoluted. Anyway, simple solution, use the $eval function:

Code: Select all

#${exec /home/jay/temp/dvr_openchannels_d}
${eval ${exec /home/jay/temp/dvr_openchannels_d}}
I was digging through some earlier threads and realize that if you have multiple channels running, and obviously some other tool(s) is providing the dvr_openchannels_d script then it's an easy enough solution like this, -assuming each channel would be in a list on its own line, it's not as easy to just have conky try to handle all that formatting and depending on how many channels could be running at any given time. So, being able to just make a single call in the conky config makes that a single line solution. So, that's a much more tasty burger! :lol:
User avatar
Koentje
Level 7
Level 7
Posts: 1577
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: Conky External Scrtipt Not Displaying

Post by Koentje »

if you use ${execp ...} (p for paste) then all conky commands/variables from your bash script gets pasted!

Code: Select all

${execp /home/jay/temp/dvr_openchannels_d}
This should work!
Locked

Return to “Compiz, Conky, Docks & Widgets”