diff options
Diffstat (limited to 'libmdock/matcher.c')
-rw-r--r-- | libmdock/matcher.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/libmdock/matcher.c b/libmdock/matcher.c index 5c1bd8b..df8e8b6 100644 --- a/libmdock/matcher.c +++ b/libmdock/matcher.c @@ -152,13 +152,16 @@ static void add_desktop_info(GDesktopAppInfo *info) const gchar *wmclass = g_desktop_app_info_get_startup_wm_class(info); if (wmclass && wmclass[0]) { - add_desktop_item_by_wmclass(wmclass, info, 128000); + gchar *wmclass_lower = g_ascii_strdown(wmclass, -1); + add_desktop_item_by_wmclass(wmclass_lower, info, 128000); } if (executable && executable[0]) { gchar *basename = g_path_get_basename(executable); - add_desktop_item_by_wmclass(basename, info, -32000); + gchar *basename_lower = g_ascii_strdown(basename, -1); + add_desktop_item_by_wmclass(basename_lower, info, -32000); g_free(basename); + g_free(basename_lower); } g_free(executable); @@ -172,7 +175,7 @@ static void refresh_appinfo() g_hash_table_remove_all(info_by_wmclass); GList *list = g_app_info_get_all(); - for (GList *l = g_list_first(list); l; l = g_list_next(l)) { + for (GList *l = list; l; l = g_list_next(l)) { add_desktop_info(G_DESKTOP_APP_INFO(l->data)); } @@ -208,6 +211,8 @@ static gboolean init_matcher(void) g_free, (GDestroyNotify)desktop_item_list_destroy); refresh_appinfo(); + + init_done = TRUE; } return TRUE; @@ -220,7 +225,6 @@ static GSList * matches_by_executable(const gchar *exec) if (elist) { return g_slist_copy(elist->list); } else { - g_debug("Executable %s not matched", exec); return NULL; } } @@ -239,23 +243,30 @@ static GSList * matches_by_wmclass(const gchar *wmclass) const gchar * match_appid_to_desktopid(AppId *appid) { if (!init_matcher()) return NULL; + if (!app_id_is_local_user(appid)) return NULL; GSList *list = NULL; if (appid->executable) { list = g_slist_concat(list, matches_by_executable(appid->executable)); } - if (appid->wm_class_name) { + if (appid->wm_class_class) { + list = g_slist_concat(list, matches_by_wmclass(appid->wm_class_class)); + } + if (appid->wm_class_name && (g_strcmp0(appid->wm_class_class, appid->wm_class_name) != 0)) { list = g_slist_concat(list, matches_by_wmclass(appid->wm_class_name)); } if (list) { list = g_slist_sort(list, desktop_item_compare); +#if 1 + g_debug("for appid with wmclass %s", appid->wm_class_class); for (GSList *l = list; l; l = l->next) { DesktopItem *item = l->data; g_debug(" match %d %s", item->priority, item->desktop_file); } +#endif DesktopItem *best = list->data; g_slist_free(list); |