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
[SOLVED] Conky Question in Debian bullseye/sid
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.
- 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
This will cut out the name:
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
Code: Select all
awk -F'"' '/PRETTY/{gsub(/GNU\/Linux /, "");print $2}' /etc/os-release
EDIT: https://stackoverflow.com/questions/583 ... onky-files
deadbang
Re: Conky Question in Debian bullseye/sid
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?
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.
- 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
Well you can use
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.
Code: Select all
${exec awk -F'"' '/PRETTY/{gsub(/GNU\/Linux /, "");print $2}' /etc/os-release}
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
Re: Conky Question in Debian bullseye/sid
I don't know if you saw my last edit:Head_on_a_Stick wrote:Well you can useBut that would be run every time conky updates itself, which is silly because the value never changes.Code: Select all
${exec awk -F'"' '/PRETTY/{gsub(/GNU\/Linux /, "");print $2}' /etc/os-release}
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.
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?
- 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
A single awk command is better than three commands and two pipes (IMO) and it cuts out GNU/Linux for you as well.supusr wrote:This works, ${exec lsb_release -ds | tr -d '"' | tr -d '\n'}
deadbang
[SOLVED] Re: Conky Question in Debian bullseye/sid
Yes, you are right. So, I'll use: Distro: ${alignr}${exec awk -F'"' '/PRETTY/{gsub(/GNU\/Linux /, "");print $2}' /etc/os-release}Head_on_a_Stick wrote:A single awk command is better than three commands and two pipes (IMO) and it cuts out GNU/Linux for you as well.supusr wrote:This works, ${exec lsb_release -ds | tr -d '"' | tr -d '\n'}
Thanks very much.
- 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
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
Re: [SOLVED] Conky Question in Debian bullseye/sid
OK, Thanks.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.
Re: [SOLVED] Conky Question in Debian bullseye/sid
If I use execi 86400, wouldn't it only execute the process every 24 hours, resolving the concern about excessive RAM usage?supusr wrote:OK, Thanks.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.
- 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
It's not really a concern, as such — a single awk command for every refresh would only use a few KiB and CPU cycles.supusr wrote:the concern about excessive RAM usage
deadbang
Re: [SOLVED] Conky Question in Debian bullseye/sid
Thank-you.Head_on_a_Stick wrote:It's not really a concern, as such — a single awk command for every refresh would only use a few KiB and CPU cycles.supusr wrote:the concern about excessive RAM usage
Re: [SOLVED] Conky Question in Debian bullseye/sid
EDIT: A thousand apologies for the necro-bump.
I know it is marked [solved] but
Do it with "execpi 86400" once a day:
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)
_____________
I'm a conky 1.9'er "apt-mark hold" is a great thing.
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}
but I like the "11.4" that "cat /etc/debian_version" gives me over "lsb_release -rs" (11)
_____________
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!