Why wont this terminal command work in conky? [SOLVED]

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.
Post Reply
User avatar
Logansfury
Level 8
Level 8
Posts: 2423
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Why wont this terminal command work in conky? [SOLVED]

Post by Logansfury »

Hello everyone,

I am using the following command to get a readout of my motherboards UEFI: inxi -Mxx | awk '/UEFI:/ {uefi=$NF; getline; print uefi, $1, $2, $3, $4}'

It works perfectly in terminal, and I created a polkit for inxi so conky could launch it as root:

org.logan.inxi.policy

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN" "http://www.freedesktop.org/standards/PolicyKit/1.0/policyconfig.dtd">
<policyconfig>
  <vendor>The Logan Project</vendor>
  <vendor_url>http://www.logan.org/</vendor_url>
  <icon_name>inxi</icon_name>
  <action id="org.logan.inxi">
    <description gettext-domain="inxi">Run inxi as root</description>
    <message gettext-domain="inxi">Authentication is NOT required to run inxi as root</message>
    <defaults>
      <allow_any>yes</allow_any>
      <allow_inactive>yes</allow_inactive>
      <allow_active>yes</allow_active>
    </defaults>
    <annotate key="org.freedesktop.policykit.exec.path">/usr/bin/inxi</annotate>
    <annotate key="org.freedesktop.policykit.exec.allow_gui">false</annotate>

  </action>

</policyconfig>
I looked in /usr/bin and i found a program named lshw from my last polkit, but in this dir instead of an app, there was some kind of text document named inxi.

In conky I am using the same command prefix that is in place for performing lshw commands:

${exec pkexec inxi -Mxx | awk '/UEFI:/ {uefi=$NF; getline; print uefi, $1, $2, $3, $4}'}

taken from the example ${exec pkexec lshw -class system | grep -A 1 "description" | awk -F": " '{print $2}' | head -n 1}

I have rebooted my computer and I have done a chmod +x on the .policy file, I don't know if that is of any relevance with a .policy file but it seemed a reasonable troubleshooting step.

Can anyone help me get conky performing this command?

Thank you for reading,

Logan
Last edited by Logansfury on Mon Jul 15, 2024 12:57 am, edited 3 times in total.
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
IYmEVDc
Level 4
Level 4
Posts: 233
Joined: Mon Jan 27, 2020 8:27 pm

Re: Why wont this terminal command work in conky?

Post by IYmEVDc »

how are you running your conky? if you run it manually in a terminal do you get any info about why that command doesn't seem to be working?

Code: Select all

conky -c /path/to/config
User avatar
Logansfury
Level 8
Level 8
Posts: 2423
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Why wont this terminal command work in conky?

Post by Logansfury »

IYmEVDc wrote: Sat Jul 13, 2024 2:29 pm how are you running your conky? if you run it manually in a terminal do you get any info about why that command doesn't seem to be working?

Code: Select all

conky -c /path/to/config
This conky cannot be run from the terminal for some reason, the terminal window flashes onscreen for a split second then closes itself as if there were something wrong with the script, but launching the .conf file from CM2 causes it to run fine.

I just found an alternate command and I am going to try to work with it
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
zcot
Level 9
Level 9
Posts: 2959
Joined: Wed Oct 19, 2016 6:08 pm

Re: Why wont this terminal command work in conky?

Post by zcot »

most likely, and mentioned many times before, you can't just run that conky command on terminal in default ~ location.

this:

Code: Select all

conky -c /path/to/config
vs this:

Code: Select all

cd /path/to/config
conky -c config-file
it's completely different, the context of PWD and such. it's the location for all the current path references.

Conky-Manager2 does that automatically for you!



As for the inxi line, I can't see where you actually need elevated permission on that call anyway. inxi -Mxx -what is it giving with elevated permission? test it: sudo inxi -Mxx
User avatar
Logansfury
Level 8
Level 8
Posts: 2423
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Why wont this terminal command work in conky?

Post by Logansfury »

zcot wrote: Sun Jul 14, 2024 11:16 pm most likely, and mentioned many times before, you can't just run that conky command on terminal in default ~ location.

this:

Code: Select all

conky -c /path/to/config
vs this:

Code: Select all

cd /path/to/config
conky -c config-file
it's completely different, the context of PWD and such. it's the location for all the current path references.

Conky-Manager2 does that automatically for you!



As for the inxi line, I can't see where you actually need elevated permission on that call anyway. inxi -Mxx -what is it giving with elevated permission? test it: sudo inxi -Mxx
for craps sake!

Im not remembering what I had tried that got me using a sudo command. I think that damn bot must have suggested it. I see the inxi command it just fine as a standard command and am going back to that.
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Logansfury
Level 8
Level 8
Posts: 2423
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Why wont this terminal command work in conky?

Post by Logansfury »

I dont understand this.

I am no longer trying to use polkit or a sudo command.

inxi -Mxx | awk '/UEFI:/ {sub(/^.*UEFI:/, ""); getline next_line; print $0 next_line}' | sed 's/ */ /g' works perfectly in terminal but will not display in conky.

What is it about this command that conky doesn't like?
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Logansfury
Level 8
Level 8
Posts: 2423
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Why wont this terminal command work in conky?

Post by Logansfury »

I decided to not fight the code and just use Koentje's suggestion from a similar config file. I made a bash script to execute the inxi command, dump the info to a file, and now conky just does and exec cat on the file.

I got my info display :D
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
Post Reply

Return to “Compiz, Conky, Docks & Widgets”