Distro "pretty name" in conky

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.
Locked
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.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
ajgreeny
Level 7
Level 7
Posts: 1640
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

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

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.
User avatar
karlchen
Level 23
Level 23
Posts: 18177
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
The people of Alderaan have been bravely fighting back the clone warriors sent out by the unscrupulous Sith Lord Palpatine for 762 days now.
Lifeline
ajgringo619

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
User avatar
karlchen
Level 23
Level 23
Posts: 18177
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
The people of Alderaan have been bravely fighting back the clone warriors sent out by the unscrupulous Sith Lord Palpatine for 762 days now.
Lifeline
User avatar
Gruppo Sportivo
Level 4
Level 4
Posts: 278
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}
User avatar
murray
Level 5
Level 5
Posts: 785
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
User avatar
Koentje
Level 7
Level 7
Posts: 1551
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: Distro "pretty name" in conky

Post by Koentje »

Other way to get this info without lsb_release

Code: Select all

cat /etc/os-release | grep -m 1 'PRETTY_NAME=' | cut -c 13- | sed -e 's/^"//' -e 's/"$//'

Code: Select all

cat /etc/os-release | grep -m 1 'VERSION_CODENAME=' | cut -c 18- | sed -e 's/^"//' -e 's/"$//'
User avatar
smurphos
Level 18
Level 18
Posts: 8501
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: Distro "pretty name" in conky

Post by smurphos »

I use

Code: Select all

${execi 30000 bash -c 'source /etc/os-release; echo "$NAME $VERSION - $(cinnamon --version)"'}
Returns the string Linux Mint 20.3 (Una) - Cinnamon 5.2.7
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
Locked

Return to “Compiz, Conky, Docks & Widgets”