Skip to content

Commit 4ab9824

Browse files
authored
Updated cs_info module (#11861)
* 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
1 parent b6744f1 commit 4ab9824

File tree

1 file changed

+7
-14
lines changed
  • files/usr/share/cinnamon/cinnamon-settings/modules

1 file changed

+7
-14
lines changed

files/usr/share/cinnamon/cinnamon-settings/modules/cs_info.py

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -113,20 +113,13 @@ def createSystemInfos():
113113
args = shlex.split("awk -F \"=\" '/GRUB_TITLE/ {print $2}' /etc/linuxmint/info")
114114
title = subprocess.check_output(args).decode('utf-8').rstrip("\n")
115115
infos.append((_("Operating System"), title))
116-
elif os.path.exists("/etc/arch-release"):
117-
contents = open("/etc/arch-release", 'r').readline().split()
118-
title = ' '.join(contents[:2]) or "Arch Linux"
119-
infos.append((_("Operating System"), title))
120-
elif os.path.exists("/etc/manjaro-release"):
121-
contents = open("/etc/manjaro-release", 'r').readline().split()
122-
title = ' '.join(contents[:2]) or "Manjaro Linux"
123-
infos.append((_("Operating System"), title))
124-
else:
125-
import distro
126-
s = '%s (%s)' % (' '.join(distro.linux_distribution()), arch)
127-
# Normalize spacing in distribution name
128-
s = re.sub(r'\s{2,}', ' ', s)
129-
infos.append((_("Operating System"), s))
116+
elif os.path.exists("/etc/os-release"):
117+
with open("/etc/os-release", 'r') as os_release_file:
118+
for line in os_release_file:
119+
if line.startswith("PRETTY_NAME="):
120+
title = line.strip()[len("PRETTY_NAME="):].strip('"')
121+
infos.append((_("Operating System"), title))
122+
break # No need to continue reading the file once we have found PRETTY_NAME
130123
if 'CINNAMON_VERSION' in os.environ:
131124
infos.append((_("Cinnamon Version"), os.environ['CINNAMON_VERSION']))
132125
infos.append((_("Linux Kernel"), platform.release()))

0 commit comments

Comments
 (0)