From 52834667ab41597cc2d8f9cac6527748361a5d08 Mon Sep 17 00:00:00 2001 From: Clement Lefebvre Date: Fri, 27 Feb 2015 13:34:45 +0100 Subject: [PATCH] Added the ability to rename desktop files --- usr/lib/linuxmint/mintSystem/mint-adjust.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/usr/lib/linuxmint/mintSystem/mint-adjust.py b/usr/lib/linuxmint/mintSystem/mint-adjust.py index ba9d315..ef42a5c 100755 --- a/usr/lib/linuxmint/mintSystem/mint-adjust.py +++ b/usr/lib/linuxmint/mintSystem/mint-adjust.py @@ -146,6 +146,16 @@ def log (string): categories = categories.strip() os.system("sed -i -e 's/Categories=.*/Categories=%s/g' %s" % (categories, desktop_file)) log("%s re-categorized" % desktop_file) + elif line_items[0] == "rename": + if len(line_items) == 3: + action, desktop_file, names_file = line.split() + names_file = names_file.strip() + if os.path.exists(desktop_file) and os.path.exists(names_file): + # remove all existing names, generic names, comments + os.system("sed -i -e '/^[Name|GenericName|Comment]/d' \"%s\"" % desktop_file) + # add provided ones + os.system("cat \"%s\" >> \"%s\"" % (names_file, desktop_file)) + log("%s renamed" % desktop_file) filehandle.close() except Exception, detail: