Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

[SOLVED] Conky Question in Debian bullseye/sid

New to Debian (Or Linux in general)? Ask your questions here!
Post Reply
Message
Author
User avatar
supusr
Posts: 44
Joined: 2016-11-09 20:07
Location: Mountain West, USA

[SOLVED] Conky Question in Debian bullseye/sid

#1 Post by supusr »

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.

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: Conky Question in Debian bullseye/sid

#2 Post by Head_on_a_Stick »

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
deadbang

User avatar
supusr
Posts: 44
Joined: 2016-11-09 20:07
Location: Mountain West, USA

Re: Conky Question in Debian bullseye/sid

#3 Post by supusr »

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.

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: Conky Question in Debian bullseye/sid

#4 Post by Head_on_a_Stick »

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.
deadbang

User avatar
supusr
Posts: 44
Joined: 2016-11-09 20:07
Location: Mountain West, USA

Re: Conky Question in Debian bullseye/sid

#5 Post by supusr »

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?

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: Conky Question in Debian bullseye/sid

#6 Post by Head_on_a_Stick »

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.
deadbang

User avatar
supusr
Posts: 44
Joined: 2016-11-09 20:07
Location: Mountain West, USA

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

#7 Post by supusr »

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.

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

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

#8 Post by Head_on_a_Stick »

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.
deadbang

User avatar
supusr
Posts: 44
Joined: 2016-11-09 20:07
Location: Mountain West, USA

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

#9 Post by supusr »

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.

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

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

#10 Post by Usoop »

Thanks

User avatar
supusr
Posts: 44
Joined: 2016-11-09 20:07
Location: Mountain West, USA

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

#11 Post by supusr »

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?

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

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

#12 Post by Head_on_a_Stick »

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.
deadbang

User avatar
supusr
Posts: 44
Joined: 2016-11-09 20:07
Location: Mountain West, USA

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

#13 Post by supusr »

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.

User avatar
Sector11
Posts: 39
Joined: 2010-05-20 16:03
Location: ↑↑ there some place.

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

#14 Post by Sector11 »

EDIT: A thousand apologies for the necro-bump.

I know it is marked [solved] but

Do it with "execpi 86400" once a day:

Code: Select all

 13 Jul 22 @ 15:23:28 ~
   $ lsb_release -is
Debian
 
 13 Jul 22 @ 15:23:40 ~
   $ lsb_release -cs
bullseye
 
 13 Jul 22 @ 15:23:51 ~
   $ cat /etc/debian_version
11.4
 
 13 Jul 22 @ 15:24:23 ~
   $

Code: Select all

${alignc}${swapbar 0,80}
${alignc}${color5}S Y S   I N F O
#${alignc}${pre_exec lsb_release -is}
${alignc}DEBIAN${color}
${alignc}Ver: ${pre_exec cat /etc/debian_version} ${pre_exec lsb_release -cs}
${alignc}${kernel}
 ${color5}Uptime:${color}${alignr 5}${uptime_short}
${alignc}${swapbar 0,80}
I don't bother with "lsb_release -is" because "DEBIAN" does not change! PERIOD!
but I like the "11.4" that "cat /etc/debian_version" gives me over "lsb_release -rs" (11)

Image
_____________
I'm a conky 1.9'er "apt-mark hold" is a great thing.
Linux may not be the best OS but in IMHO it's way ahead of whatever is in second place!

Post Reply