Unity does not honour window icons where there is no .desktop file.

Bug #1007383 reported by Peter Würtz
20
This bug affects 4 people
Affects Status Importance Assigned to Milestone
BAMF
Fix Released
Medium
Marco Trevisan (Treviño)
Unity
Invalid
Medium
Unassigned
wxWidgets
Unknown
Unknown
bamf (Ubuntu)
Fix Released
Undecided
Unassigned
unity (Ubuntu)
Invalid
Medium
Unassigned
wxwidgets2.8 (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Hi,

Unity ignores the application icons of programs that were not launched using .desktop files. Instead, every application just gets a gray icon with a question mark.

This minimal python program opens a window and defines an icon for the application. In the gnome or kde window managers and task lists the application appears with the correct icon.

from PyQt4 import QtGui
fname = "/usr/share/icons/gnome/32x32/apps/accessories-calculator.png"
app = QtGui.QApplication([])
app.setWindowIcon(QtGui.QIcon(fname))
dialog = QtGui.QDialog()
dialog.setWindowTitle("Application with Icon")
dialog.show()
app.exec_()

ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: unity 5.12-0ubuntu1
ProcVersionSignature: Ubuntu 3.2.0-24.38-generic-pae 3.2.16
Uname: Linux 3.2.0-24-generic-pae i686
ApportVersion: 2.0.1-0ubuntu8
Architecture: i386
CompizPlugins: [core,bailer,detection,composite,opengl,decor,gnomecompat,move,place,compiztoolbox,imgpng,vpswitch,mousepoll,regex,grid,session,unitymtgrabhandles,snap,resize,zoom,animation,wall,workarounds,expo,fade,scale,unityshell]
Date: Fri Jun 1 11:24:33 2012
InstallationMedia: Ubuntu 11.10 "Oneiric Ocelot" - Beta i386 (20110909)
SourcePackage: unity
UpgradeStatus: Upgraded to precise on 2012-05-18 (14 days ago)

Related branches

Revision history for this message
Peter Würtz (pwuertz) wrote :
description: updated
Revision history for this message
Aditya V (kroq-gar78) wrote :

This is a duplicate bug, but don't remember of what. I'll mark it as a duplicate once I find the number.

Revision history for this message
Omer Akram (om26er) wrote :

bug 786570 could be related.

Revision history for this message
Peter Würtz (pwuertz) wrote :

This other bug describes the behavior for icons specified in desktop files. This bug is about having application icons without desktop files, which is an established standard among the other display managers.

summary: - Unity does not honor application icons
+ Unity does not honour window icons where there is no .desktop file.
Revision history for this message
Bilal Akhtar (bilalakhtar) wrote :

Even I guess this is a duplicate, but can't find the original report. Unity should accept WM icon changes in addition to desktop files.

Changed in unity:
importance: Undecided → Medium
Changed in unity (Ubuntu):
importance: Undecided → Medium
Changed in bamf:
importance: Undecided → Medium
status: New → Confirmed
Changed in unity:
status: New → Confirmed
Changed in unity (Ubuntu):
status: New → Confirmed
Revision history for this message
Gerard (gbrunick) wrote :

In my case, the PyQt4 code listed above does show an icon in Unity, but the following wxPython code does not:

import wx
app = wx.App()
frame = wx.Frame(None)
icon_file = "/usr/share/icons/gnome/32x32/apps/accessories-calculator.png"
icon = wx.Icon(icon_file, wx.BITMAP_TYPE_PNG)
frame.SetIcon(icon)
frame.SetTitle("Application with Icon")
frame.Show()
app.MainLoop()

The previous wxPython code does show an icon in both cinnamon and gnome shell. This suggest that this may be a Unity issue and rather than a wxPython issue, but I don't really know what wxPython and PyQt4 are doing differently behind the scenes.

I am also running:
  Ubuntu 12.04
  Unity: 5.12-0ubuntu1

Revision history for this message
Peter Würtz (pwuertz) wrote :

Indeed.. at least for Qt4 the bug disappeared.

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Peter, the problem you've highlighted with pyQt was related to that toolkit, but also to the fact that you're running the window from a python shell... At that point BAMF identifies that window as a window created by the "python" process (with no argument), so this means that it's python itself. This works well instead, when moving the code you pointed into an external python script.

Gerard, regarding WX widgets this seems to me a problem of the toolkit (see http://trac.wxwidgets.org/ticket/12778), since it doesn't set the proper WM_CLASS for the windows that are loaded using python-wx.

One workaround that can apply to both situations is to ignore some "known loaders" names unless a window icon is set...

Changed in wxwidgets2.8 (Ubuntu):
status: New → Confirmed
Changed in bamf:
status: Confirmed → In Progress
assignee: nobody → Marco Trevisan (Treviño) (3v1n0)
milestone: none → 0.5.0
Changed in unity (Ubuntu):
status: Confirmed → Invalid
Changed in unity:
status: Confirmed → Invalid
Revision history for this message
Peter Würtz (pwuertz) wrote :

I am pretty sure that it wasn't working even with the code in a script, since I almost never use the python shell for such things. But it's indeed working now (apart from the code in my initial post refering to an icon that doesn't exist anymore).
Thanks!

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

I guess it was caused by a WM_CLASS issue in python-qt as well, the problem remains in wx however... The branch I'm working on will fix also that case.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

Fix committed into lp:bamf at revision 559, scheduled for release in bamf, milestone 0.5.0

Changed in bamf:
status: In Progress → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package bamf - 0.5.0+13.10.20130628-0ubuntu1

---------------
bamf (0.5.0+13.10.20130628-0ubuntu1) saucy; urgency=low

  [ Marco Trevisan (Treviño) ]
  * BamfDaemon, LibBamf: Make the BamfView's name a property, deprecated
    method+signal.
  * BamfDaemon, LibBamf: add icon property to store the BamfView icon
    and notify about its changes. New tests added.
  * BamfMatcher: ignore registered .desktop files that are in an
    autostart-folder. (LP: #1193502)
  * BamfApplication: try to use a window icon if the computed icon
    belongs to a "generic" app Added a bunch of new BamfApplication
    tests for icon. (LP: #768931, #1007383)
  * BamfFactory: remove the local_views list, we don't need that anymore
    Having them tracked on allocated_views list is enough, and fixes an
    issue as explained on bug #1193559. (LP: #1193449, #1193559)

  [ Ubuntu daily release ]
  * Automatic snapshot from revision 560
 -- Ubuntu daily release <email address hidden> Fri, 28 Jun 2013 02:02:32 +0000

Changed in bamf (Ubuntu):
status: New → Fix Released
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Fix Released in Bamf BAMF 0.5.0.

Changed in bamf:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.