Skip to content

Commit

Permalink
Updated cs_info module (#11861)
Browse files Browse the repository at this point in the history
* Updated cs_info module

Now in the system information the os name is taken from os-release, which is more correct and universal

* Fixed the translations
  • Loading branch information
Boria138 authored Sep 15, 2023
1 parent b6744f1 commit 4ab9824
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions files/usr/share/cinnamon/cinnamon-settings/modules/cs_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,20 +113,13 @@ def createSystemInfos():
args = shlex.split("awk -F \"=\" '/GRUB_TITLE/ {print $2}' /etc/linuxmint/info")
title = subprocess.check_output(args).decode('utf-8').rstrip("\n")
infos.append((_("Operating System"), title))
elif os.path.exists("/etc/arch-release"):
contents = open("/etc/arch-release", 'r').readline().split()
title = ' '.join(contents[:2]) or "Arch Linux"
infos.append((_("Operating System"), title))
elif os.path.exists("/etc/manjaro-release"):
contents = open("/etc/manjaro-release", 'r').readline().split()
title = ' '.join(contents[:2]) or "Manjaro Linux"
infos.append((_("Operating System"), title))
else:
import distro
s = '%s (%s)' % (' '.join(distro.linux_distribution()), arch)
# Normalize spacing in distribution name
s = re.sub(r'\s{2,}', ' ', s)
infos.append((_("Operating System"), s))
elif os.path.exists("/etc/os-release"):
with open("/etc/os-release", 'r') as os_release_file:
for line in os_release_file:
if line.startswith("PRETTY_NAME="):
title = line.strip()[len("PRETTY_NAME="):].strip('"')
infos.append((_("Operating System"), title))
break # No need to continue reading the file once we have found PRETTY_NAME
if 'CINNAMON_VERSION' in os.environ:
infos.append((_("Cinnamon Version"), os.environ['CINNAMON_VERSION']))
infos.append((_("Linux Kernel"), platform.release()))
Expand Down

0 comments on commit 4ab9824

Please sign in to comment.