Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fix for pixelated alt-tab entries #1333

Merged
merged 6 commits into from

3 participants

@mtwebster
Collaborator

Window tracker: Strip extension from window class when using it for app 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.

Need to add a desktop entry for cinnamon menu editor and the panel launchers .py file (I think we can set it to no display so it's not visible in the menu applet, but still in the app system)

With this patch and manually renaming desktop files on my system, it solved the pixelation problem.

Looking at the rest of my desktop files in /usr/share/applications, it looks like the rule is all lower-case, most likely for this reason, as every app that was working fine with regards to the icon pixelation retrieved its desktop entry via the WM_CLASS name path.

@mtwebster mtwebster 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.
8374cb9
@mtwebster
Collaborator

Yes

mtwebster added some commits
@mtwebster mtwebster Add cinnamon-menu-editor.desktop 1eb9836
@mtwebster mtwebster Collect settings apps even if they're NoDisplay - we already filter
this stuff out in our menus and such, we should track them from a
window/system point of view though.
93e4776
@mtwebster mtwebster Add a secondary hash table search that checks without regard to
case if the initial (fast) lookup doesn't yield any results.

The benefit of this is we won't have to rename all our .desktop
files for mint programs.

The downside is that unexpected things might happen if for some
reason you have duplicate .desktop files that differ only in
character cases (not likely).
512d2a3
@mtwebster
Collaborator

Last commit eliminates the need to rename all our desktop files. The app system will try a normal, fast hash table lookup for the desktop file. If it fails to find it, it will initiate a somewhat slower, but case insensitive, find routine, that will hopefully give us the desktop file we're really looking for.

mtwebster added some commits
@clefebvre clefebvre merged commit 61f3bc1 into linuxmint:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 7, 2012
  1. @mtwebster

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

    mtwebster authored
    …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.
  2. @mtwebster
  3. @mtwebster

    Collect settings apps even if they're NoDisplay - we already filter

    mtwebster authored
    this stuff out in our menus and such, we should track them from a
    window/system point of view though.
  4. @mtwebster

    Add a secondary hash table search that checks without regard to

    mtwebster authored
    case if the initial (fast) lookup doesn't yield any results.
    
    The benefit of this is we won't have to rename all our .desktop
    files for mint programs.
    
    The downside is that unexpected things might happen if for some
    reason you have duplicate .desktop files that differ only in
    character cases (not likely).
Commits on Nov 8, 2012
  1. @mtwebster

    Change the name of the panel launcher editor to be more in line with

    mtwebster authored
    other Cinnamon utilities.  Give it a .desktop file so it gets the nice
    rendering.
  2. @mtwebster
This page is out of date. Refresh to see the latest.
View
10 files/usr/share/applications/cinnamon-add-panel-launcher.desktop
@@ -0,0 +1,10 @@
+[Desktop Entry]
+Name=Panel Launcher Editor
+Comment=Add or edit panel launcher applet entries
+Exec=/usr/share/cinnamon/applets/panel-launchers@cinnamon.org/cinnamon-add-panel-launcher.py
+Icon=gnome-panel-launcher
+Terminal=false
+NoDisplay=true
+Type=Application
+Categories=GNOME;GTK;Settings;DesktopSettings;
+StartupNotify=false
View
10 files/usr/share/applications/cinnamon-menu-editor.desktop
@@ -0,0 +1,10 @@
+[Desktop Entry]
+Name=Cinnamon Menu Editor
+Comment=Edit the entries of the Cinnamon menu applet
+Exec=cinnamon-menu-editor
+Icon=alacarte
+Terminal=false
+Type=Application
+NoDisplay=true
+Categories=GNOME;GTK;Settings;DesktopSettings;
+StartupNotify=false
View
4 files/usr/share/cinnamon/applets/panel-launchers@cinnamon.org/applet.js
@@ -370,14 +370,14 @@ MyApplet.prototype = {
showAddLauncherDialog: function(timestamp, launcher){
if (launcher) {
- let cl = APPLET_DIR.get_child('add-panel-launcher.py').get_path() + ' ';
+ let cl = APPLET_DIR.get_child('cinnamon-add-panel-launcher.py').get_path() + ' ';
cl += '"' + launcher.getId() + '" ';
cl += '"' + launcher.getAppname() + '" ';
cl += '"' + launcher.getCommand() + '" ';
cl += '"' + launcher.getIcon() + '"';
Util.spawnCommandLine(cl);
} else {
- Util.spawnCommandLine(APPLET_DIR.get_child('add-panel-launcher.py').get_path());
+ Util.spawnCommandLine(APPLET_DIR.get_child('cinnamon-add-panel-launcher.py').get_path());
}
},
View
2  ...l-launchers@cinnamon.org/add-panel-launcher.glade → ...rs@cinnamon.org/cinnamon-add-panel-launcher.glade
@@ -7,7 +7,7 @@
<property name="title" translatable="yes">Add panel launcher...</property>
<property name="resizable">False</property>
<property name="window_position">center</property>
- <property name="icon_name">list-add</property>
+ <property name="icon_name">gnome-panel-launcher</property>
<property name="type_hint">dialog</property>
<signal name="close" handler="onDeleteWindow" swapped="no"/>
<child internal-child="vbox">
View
2  ...anel-launchers@cinnamon.org/add-panel-launcher.py → ...chers@cinnamon.org/cinnamon-add-panel-launcher.py
@@ -119,7 +119,7 @@ def onIconChanged(self, *args):
custom_launchers_path = userhome + "/.cinnamon/panel-launchers"
applet_dir = os.path.dirname(inspect.getfile(inspect.currentframe()))
-builder.add_from_file(applet_dir + "/add-panel-launcher.glade")
+builder.add_from_file(applet_dir + "/cinnamon-add-panel-launcher.glade")
window = builder.get_object("add-panel-launcher-dialog")
builder.connect_signals(Handler())
View
36 src/cinnamon-app-system.c
@@ -109,7 +109,7 @@ cinnamon_app_system_init (CinnamonAppSystem *self)
priv->apps_tree = gmenu_tree_new ("cinnamon-applications.menu", GMENU_TREE_FLAGS_INCLUDE_NODISPLAY);
g_signal_connect (priv->apps_tree, "changed", G_CALLBACK (on_apps_tree_changed_cb), self);
- priv->settings_tree = gmenu_tree_new ("cinnamon-settings.menu", 0);
+ priv->settings_tree = gmenu_tree_new ("cinnamon-settings.menu", GMENU_TREE_FLAGS_INCLUDE_NODISPLAY);
g_signal_connect (priv->settings_tree, "changed", G_CALLBACK (on_settings_tree_changed_cb), self);
on_apps_tree_changed_cb (priv->apps_tree, self);
@@ -490,6 +490,20 @@ cinnamon_app_system_get_default ()
return instance;
}
+gboolean
+case_insensitive_search (const char *key,
+ const char *value,
+ gpointer user_data)
+{
+ char *given_id = (char *) user_data;
+
+ if (g_ascii_strcasecmp(key, given_id) == 0) {
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+}
+
/**
* cinnamon_app_system_lookup_app:
*
@@ -501,7 +515,13 @@ CinnamonApp *
cinnamon_app_system_lookup_app (CinnamonAppSystem *self,
const char *id)
{
- return g_hash_table_lookup (self->priv->id_to_app, id);
+ CinnamonApp *result;
+
+ result = g_hash_table_lookup (self->priv->id_to_app, id);
+ if (result == NULL) {
+ result = g_hash_table_find (self->priv->id_to_app, (GHRFunc) case_insensitive_search, id);
+ }
+ return result;
}
/**
@@ -515,7 +535,13 @@ CinnamonApp *
cinnamon_app_system_lookup_settings_app (CinnamonAppSystem *self,
const char *id)
{
- return g_hash_table_lookup (self->priv->setting_id_to_app, id);
+ CinnamonApp *result;
+
+ result = g_hash_table_lookup (self->priv->setting_id_to_app, id);
+ if (result == NULL) {
+ result = g_hash_table_find (self->priv->setting_id_to_app, (GHRFunc) case_insensitive_search, id);
+ }
+ return result;
}
/**
@@ -614,6 +640,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);
View
16 src/cinnamon-window-tracker.c
@@ -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;
Something went wrong with that request. Please try again.