Permalink
Browse files

Window tracker: Strip extension from window class when using it for a…

…pp lookup.

The WM_CLASS is set to the app full name (i.e. cinnamon-settings.py) and then
it uses that to try to find the app during certain operations.  It appends .desktop
to that string, and searches for the desktop entry, and, of course, does not find it.

app-system: check settings hash table for app as well as the normal table, when doing
a search.

All of this goes towards addressing the problem with cinnamon and mint applications
showing up as pixelated in the alt-tab view.
  • Loading branch information...
1 parent a8bd712 commit 8374cb9a3661cb3dc71dfd66b3916f5a5adddf5d @mtwebster committed Nov 7, 2012
Showing with 18 additions and 2 deletions.
  1. +4 −0 src/cinnamon-app-system.c
  2. +14 −2 src/cinnamon-window-tracker.c
@@ -614,6 +614,10 @@ cinnamon_app_system_lookup_heuristic_basename (CinnamonAppSystem *system,
if (result != NULL)
return result;
+ result = cinnamon_app_system_lookup_settings_app (system, name);
+ if (result != NULL)
+ return result;
+
for (prefix = system->priv->known_vendor_prefixes; prefix; prefix = g_slist_next (prefix))
{
char *tmpid = g_strconcat ((char*)prefix->data, name, NULL);
@@ -143,7 +143,6 @@ get_appid_from_window (MetaWindow *window)
wmclass = meta_window_get_wm_class (window);
if (!wmclass)
return NULL;
-
appid_guess = g_ascii_strdown (wmclass, -1);
/* This handles "Fedora Eclipse", probably others.
@@ -204,6 +203,19 @@ cinnamon_window_tracker_is_window_interesting (MetaWindow *window)
return TRUE;
}
+gchar *
+strip_extension (gchar *wm_class)
+{
+ char *result;
+ if (g_str_has_suffix (wm_class, ".py") ||
+ g_str_has_suffix (wm_class, ".sh")) {
+ result = g_strndup (wm_class, strlen (wm_class) - 3);
+ } else {
+ result = g_strdup (wm_class);
+ }
+ return result;
+}
+
/**
* get_app_from_window_wmclass:
*
@@ -222,7 +234,7 @@ get_app_from_window_wmclass (MetaWindow *window)
char *with_desktop;
appsys = cinnamon_app_system_get_default ();
- wmclass = get_appid_from_window (window);
+ wmclass = strip_extension(get_appid_from_window (window));
if (!wmclass)
return NULL;

0 comments on commit 8374cb9

Please sign in to comment.