From 0f6b825298bb7292b1c63e6abea460380c043054 Mon Sep 17 00:00:00 2001 From: roarde Date: Mon, 9 Jan 2017 23:23:54 -0500 Subject: [PATCH] Use first valid category listed in Desktop Entry --- src/xdgmenumaker | 45 +++++++++++++++++++-------------------------- 1 file changed, 19 insertions(+), 26 deletions(-) diff --git a/src/xdgmenumaker b/src/xdgmenumaker index e8bf3a7..3f4daf8 100755 --- a/src/xdgmenumaker +++ b/src/xdgmenumaker @@ -347,32 +347,25 @@ def remove_command_keys(command, desktopfile, icon): def clean_up_categories(categories): # cleaning up categories and keeping only registered freedesktop.org main # categories - if 'AudioVideo' in categories: - category = multimedia - elif 'Audio' in categories: - category = multimedia - elif 'Video' in categories: - category = multimedia - elif 'Development' in categories: - category = development - elif 'Education' in categories: - category = education - elif 'Game' in categories: - category = games - elif 'Graphics' in categories: - category = graphics - elif 'Network' in categories: - category = network - elif 'Office' in categories: - category = office - elif 'System' in categories: - category = system - elif 'Settings' in categories: - category = settings - elif 'Utility' in categories: - category = accessories - else: - category = other + category_menus = { + "AudioVideo": multimedia, + "Audio": multimedia, + "Video": multimedia, + "Development": development, + "Education": education, + "Game": games, + "Graphics": graphics, + "Network": network, + "Office": office, + "System": system, + "Settings": settings, + "Utility": accessories + } + category = other + for candidate in categories: + if category_menus.has_key(candidate): + category = category_menus.get(candidate) + break return category def get_entry_info(desktopfile, ico_paths=True):