Distro "pretty name" in conky

Add functionality to your desktop
Forum rules
Before you post please read how to get help
Post Reply
Rocket
Level 1
Level 1
Posts: 9
Joined: Thu Apr 08, 2021 9:50 am
Location: Colorado

Distro "pretty name" in conky

Post by Rocket »

I'm using Mint 20.1 Xfce, and my conky line is:
Distro: ${alignr} ${distribution}
This displays "Ubuntu"
I would like to have conky display Linux Mint 20.1.
Any help would be appreciated.
ajgreeny
Level 5
Level 5
Posts: 931
Joined: Mon Nov 19, 2007 3:27 pm

Re: Distro "pretty name" in conky

Post by ajgreeny »

What hostname does the system have, ie, when you open a terminal it will normally show the prompt username@hostname, the hostname being whatever you called the system at installation.

You can easily use the hostname in conky with the line you have edited to show

Code: Select all

Distro: ${alignr}$nodename
If you need to edit the hostname to show what you want you will need to edit the two files /etc/hosts and /etc/hostname to show whatever you want, then reboot to get the change to show. Conky will pick up the change immediately if you've already edited the .conkyrc file to nodename instead of distribution.

You could also, of course, just use a text entry in place of the conky variable with the line

Code: Select all

Distro: ${alignr}Linux Mint 20.1
Rocket
Level 1
Level 1
Posts: 9
Joined: Thu Apr 08, 2021 9:50 am
Location: Colorado

Re: Distro "pretty name" in conky

Post by Rocket »

Well my hostname is something else on my network, and I already have a conky line for that. I know there is a way to accurately display the distro name, (which is not Ubuntu). I'll wait to see if anyone else knows. Thanks.
ajgringo619
Level 8
Level 8
Posts: 2341
Joined: Thu Mar 01, 2018 8:36 pm
Location: San Diego, California, USA

Re: Distro "pretty name" in conky

Post by ajgringo619 »

The command lsb_release will give you what you want. For example, to get the distribution codename, you would use this:

Code: Select all

lsb_release -cs
which returns "ulyssa" on LM 20.x.

I'm not exactly sure of the conky syntax to display the output of a terminal command (been awhile since I've used it).
Mint 20.1 XFCE
Ryzen 7 2700X 3.7 GHz, GTX 1070/GTX 1050 Ti
BOINC Projects (Team Linux Mint): MilkyWay@Home | World Community Grid
Image
Rocket
Level 1
Level 1
Posts: 9
Joined: Thu Apr 08, 2021 9:50 am
Location: Colorado

Solved: Distro "pretty name" in conky

Post by Rocket »

Thank-you. Your lsb_release post gave me the clues I needed. I installed lsb from synaptic, then used the following conkhy line:
Distro: ${alignr} ${exec lsb_release -d | cut -c 14-28}
Works great!
ajgringo619
Level 8
Level 8
Posts: 2341
Joined: Thu Mar 01, 2018 8:36 pm
Location: San Diego, California, USA

Re: Distro "pretty name" in conky

Post by ajgringo619 »

If you use the -s (or --short) switch, you won't have to use any string cutting. This works on all (4) outputs from lsb_release.
Mint 20.1 XFCE
Ryzen 7 2700X 3.7 GHz, GTX 1070/GTX 1050 Ti
BOINC Projects (Team Linux Mint): MilkyWay@Home | World Community Grid
Image
User avatar
karlchen
Level 21
Level 21
Posts: 14241
Joined: Sat Dec 31, 2011 7:21 am
Location: Germany

Re: Distro "pretty name" in conky

Post by karlchen »

Support for "lsb_release -ds":

Code: Select all

$ lsb_release -ds
Linux Mint 18.1 Serena
However

Code: Select all

$ lsb_release -d | cut -c 14-28
Linux Mint 18.1
strips the nickname. - But in the end it is a matter of taste, which output to prefer: with or without the nickname.
Image
Linux Mint 19.3 64-bit Cinnamon, Total Commander 9.51 64-bit
The Prophet's Song
ajgringo619
Level 8
Level 8
Posts: 2341
Joined: Thu Mar 01, 2018 8:36 pm
Location: San Diego, California, USA

Re: Distro "pretty name" in conky

Post by ajgringo619 »

karlchen wrote:
Thu Apr 08, 2021 6:16 pm
The version with LM 20.x separates everything, so your command will only show Linux Mint 20.1
Mint 20.1 XFCE
Ryzen 7 2700X 3.7 GHz, GTX 1070/GTX 1050 Ti
BOINC Projects (Team Linux Mint): MilkyWay@Home | World Community Grid
Image
User avatar
karlchen
Level 21
Level 21
Posts: 14241
Joined: Sat Dec 31, 2011 7:21 am
Location: Germany

Re: Distro "pretty name" in conky

Post by karlchen »

OK, in this case I would definitely prefer the shorter commandline, in particular, because it will never require changing the hard-coded numbers in any "cut" command. :)
Image
Linux Mint 19.3 64-bit Cinnamon, Total Commander 9.51 64-bit
The Prophet's Song
User avatar
Gruppo Sportivo
Level 4
Level 4
Posts: 220
Joined: Sun May 28, 2017 4:14 am
Location: 🇳🇱

Re: Distro "pretty name" in conky

Post by Gruppo Sportivo »

Use these 2 lines in conky to show version and version name separately

Code: Select all

Version name: $alignr${execi 3600 lsb_release -c -s}

Code: Select all

Version: $alignr${execi 3600 lsb_release -d -s}
Image | 88.0.1
GitHub | OSMC
User avatar
murray
Level 5
Level 5
Posts: 769
Joined: Tue Nov 27, 2018 4:22 pm
Location: Auckland, New Zealand

Re: Distro "pretty name" in conky

Post by murray »

I was just about to suggest that you use execi rather than exec but @Gruppo beat me to it.

Since this info isn't likely to change very often, it's a bit wasteful to continually execute it every time Conky refreshes.
Running Mint 19.3 Cinnamon on an Intel NUC8i5BEH with 16GB RAM and 500GB SSD
Post Reply