[SOLVED] Conky Question in Debian bullseye/sid

New to Debian (Or Linux in general)? Ask your questions here!

[SOLVED] Conky Question in Debian bullseye/sid

Postby supusr » 2020-05-13 17:19

I am using testing, but purged firefox esr and set up the system to pull in regular firefox from sid. That is the only modification I made. I have a conky config that includes the line: "Distro: ${alignr}${distribution}" that displays "Debian" when I run conky. I would like it to display the full version description instead, which would be more accurate. According to the output of lsb_version -a the description or pretty name is Debian GNU/Linux bullseye/sid, but I would like to cut out GNU/Linux and just display "Debian bullseye/sid" in my conky display. This may be partly a bash question. I have consulted the man page for conky without finding the specific help I need. If any conky or bash experts out there can tell me how to get conky to do what I want it to in this case I would appreciate it very much. Thanks, in advance.
Last edited by supusr on 2020-05-13 19:34, edited 2 times in total.
supusr
 
Posts: 29
Joined: 2016-11-09 20:07

Re: Conky Question in Debian bullseye/sid

Postby Head_on_a_Stick » 2020-05-13 17:35

This will cut out the name:
Code: Select all
awk -F'"' '/PRETTY/{gsub(/GNU\/Linux /, "");print $2}' /etc/os-release

I would recommend placing that in a $pre_exec statement but apparently conky has removed them and the devs now say that lua should be used instead: https://github.com/brndnmtthws/conky/issues/62

EDIT: https://stackoverflow.com/questions/583 ... onky-files
User avatar
Head_on_a_Stick
 
Posts: 12129
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Conky Question in Debian bullseye/sid

Postby supusr » 2020-05-13 18:22

awk -F'"' '/PRETTY/{gsub(/GNU\/Linux /, "");print $2}' /etc/os-release works perfectly in the terminal, as you say. The part about pre_exec went over my head, though, when I read the links you included. I do not know lua coding. Is there now no way to execute this command in conky?
This works, ${exec lsb_release -ds | tr -d '"' | tr -d '\n'} except that it still has GNU/Linux. How would I cut just that phrase out?
Last edited by supusr on 2020-05-13 19:12, edited 1 time in total.
supusr
 
Posts: 29
Joined: 2016-11-09 20:07

Re: Conky Question in Debian bullseye/sid

Postby Head_on_a_Stick » 2020-05-13 19:11

Well you can use
Code: Select all
${exec awk -F'"' '/PRETTY/{gsub(/GNU\/Linux /, "");print $2}' /etc/os-release}

But that would be run every time conky updates itself, which is silly because the value never changes.

Older versions of conky had a $pre_exec object that would only run the command once then keep it at that value as conky updated itself but the devs now say that lua has to be used to set constants like that. See the link in my EDIT for some examples of how to do that.
User avatar
Head_on_a_Stick
 
Posts: 12129
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Conky Question in Debian bullseye/sid

Postby supusr » 2020-05-13 19:14

Head_on_a_Stick wrote:Well you can use
Code: Select all
${exec awk -F'"' '/PRETTY/{gsub(/GNU\/Linux /, "");print $2}' /etc/os-release}

But that would be run every time conky updates itself, which is silly because the value never changes.

Older versions of conky had a $pre_exec object that would only run the command once then keep it at that value as conky updated itself but the devs now say that lua has to be used to set constants like that. See the link in my EDIT for some examples of how to do that.


I don't know if you saw my last edit:
This works, ${exec lsb_release -ds | tr -d '"' | tr -d '\n'} except that it still has GNU/Linux. How would I cut just that phrase out?
supusr
 
Posts: 29
Joined: 2016-11-09 20:07

Re: Conky Question in Debian bullseye/sid

Postby Head_on_a_Stick » 2020-05-13 19:18

supusr wrote:This works, ${exec lsb_release -ds | tr -d '"' | tr -d '\n'}

A single awk command is better than three commands and two pipes (IMO) and it cuts out GNU/Linux for you as well.
User avatar
Head_on_a_Stick
 
Posts: 12129
Joined: 2014-06-01 17:46
Location: /dev/chair

[SOLVED] Re: Conky Question in Debian bullseye/sid

Postby supusr » 2020-05-13 19:32

Head_on_a_Stick wrote:
supusr wrote:This works, ${exec lsb_release -ds | tr -d '"' | tr -d '\n'}

A single awk command is better than three commands and two pipes (IMO) and it cuts out GNU/Linux for you as well.


Yes, you are right. So, I'll use: Distro: ${alignr}${exec awk -F'"' '/PRETTY/{gsub(/GNU\/Linux /, "");print $2}' /etc/os-release}
Thanks very much.
supusr
 
Posts: 29
Joined: 2016-11-09 20:07

Re: [SOLVED] Conky Question in Debian bullseye/sid

Postby Head_on_a_Stick » 2020-05-13 19:44

It would be better to learn how to use a lua function to set the value as a parameter, using $exec will be running an extra process every update cycle and eating up your RAM & CPU unnecessarily.
User avatar
Head_on_a_Stick
 
Posts: 12129
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: [SOLVED] Conky Question in Debian bullseye/sid

Postby supusr » 2020-05-13 20:37

Head_on_a_Stick wrote:It would be better to learn how to use a lua function to set the value as a parameter, using $exec will be running an extra process every update cycle and eating up your RAM & CPU unnecessarily.


OK, Thanks.
supusr
 
Posts: 29
Joined: 2016-11-09 20:07

Re: [SOLVED] Conky Question in Debian bullseye/sid

Postby Usoop » 2020-05-14 13:53

Thanks
Usoop
 
Posts: 2
Joined: 2020-04-16 10:34

Re: [SOLVED] Conky Question in Debian bullseye/sid

Postby supusr » 2020-05-14 14:50

supusr wrote:
Head_on_a_Stick wrote:It would be better to learn how to use a lua function to set the value as a parameter, using $exec will be running an extra process every update cycle and eating up your RAM & CPU unnecessarily.


OK, Thanks.


If I use execi 86400, wouldn't it only execute the process every 24 hours, resolving the concern about excessive RAM usage?
supusr
 
Posts: 29
Joined: 2016-11-09 20:07

Re: [SOLVED] Conky Question in Debian bullseye/sid

Postby Head_on_a_Stick » 2020-05-17 12:02

supusr wrote:the concern about excessive RAM usage

It's not really a concern, as such — a single awk command for every refresh would only use a few KiB and CPU cycles.
User avatar
Head_on_a_Stick
 
Posts: 12129
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: [SOLVED] Conky Question in Debian bullseye/sid

Postby supusr » 2020-05-17 13:02

Head_on_a_Stick wrote:
supusr wrote:the concern about excessive RAM usage

It's not really a concern, as such — a single awk command for every refresh would only use a few KiB and CPU cycles.


Thank-you.
supusr
 
Posts: 29
Joined: 2016-11-09 20:07


Return to Beginners Questions

Who is online

Users browsing this forum: No registered users and 9 guests

fashionable