I have recently upgraded to Ubuntu 18.04 from 16.04. Now an application of my own, which has a .desktop file in ~/.local/share/applications, is not populating the Dock with its icon — instead a generic "something is prohibited" barred icon appears — and is showing up as 'Unknown' when hovering over the icon. (In 16.04, this same application populated the Dock with its custom icon when running and showed its correct name when hovering over its Dock icon.) Also, 'Unknown' shows up in the menu next to Activities in the top menu bar. On the other hand, the custom icon appears in Nautilus, correctly associated with the .desktop file.

All this can be seen in the linked screenshot: the application is called Lexitron, its own window is frontmost, its .desktop file (with its custom icon) is shown in Nautilus, and you can see the generic 'barred' icon in the Dock with 'Unknown' showing as the application's name both there and in the top menu bar next to Activities. (My custom icon also correctly appears in the Show Applications display, but I was not able to take a screenshot of that.)

Screenshot with no custom icon in Dock, but present in Nautilus

Following is the copied and pasted contents of the lexitron.desktop file itself:

[Desktop Entry]
Exec=/home/jason/dev/src/python3/lexicon/lexitron.py --interface graphic

I can put my custom icon in the Dock by pinning it there (by right-clicking on my application's icon in the Show Applications display and selecting Add to Favourites), and hovering over that icon shows the application's correct name. But that does not solve the issue either: clicking on the pinned custom icon still brings up the barred icon with its 'Unknown' tag, and it is that icon which is shown as running with a red dot next to it. (And 'Unknown' still appears as the application in the top menu bar.) All this is shown in the following linked screenshot:

Screenshot with non-functional custom icon in dock, duplicated by generic icon

Please note that:

  • I have tried using a JPG file instead of a PNG file, with no change in behaviour
  • There are no spaces or hidden characters at the end of the Icon specification in the .desktop file (and, in any case, the icon is used by Nautilus and the Show Applications display)
  • I have tried specifying a StartupWMClass in the .desktop file as suggested in the last two postings below, but when I entered 'xprop WM_CLASS' in a terminal and clicked in my application's window, the response was 'WM_CLASS: not found'. I tried using 'StartupWMClass=Lexitron' (ie, the application's own name) but without effect. The application is a Python3/PyQt5 program.
  • I have launched the application by double-clicking on the .desktop-file icon, both in its original location and after moving it to the desktop and elsewhere. The first time I do this in each location brings up an 'Untrusted launcher application' dialog and I choose 'Trust and Launch'. This makes no difference to the behaviour described above: there is still a generic icon in the dock and the application is still called 'Unknown' in the dock and the top menu.

I have researched this problem in the following posts from Ask Ubuntu (most of them rather old, and amongst others which did not seem relevant):

However, doing everything suggested in them has not resolved the problem. Also, none of them, as far as I can tell, addresses the 'Unknown' application name issue which I have raised.


I have come to the provisional conclusion that it is nothing about my .desktop file that is causing the problem. I have tried everything suggested by @Sayen in the comments below, and I have also run desktop-file-validate on my .desktop file, which finds no problems with it.

I have even, far more drastically, temporarily usurped an existing, fully functional, .desktop file, in this case, that for Shotwell, at /usr/share/applications/shotwell.desktop. After creating a backup, I changed the Exec line (only) in shotwell.desktop to point to my application. Using that edited .desktop file, either by double-clicking on it directly or by clicking on the Shotwell icon in the display produced by the Show Applications icon, my application runs normally but the launcher shows the generic barred icon with the 'Unknown' name, as described and shown above.

So it seems to me that there is something about my Python3/PyQt5 application itself which does not agree with the mechanism behind the launcher. I will investigate further and update this post if I have anything to report.

2 Answers 2


I was facing the similar issue and i fixed it by making own .desktop file. You can follow these commands and make yours. For example i made it for postman application

sudo apt-get install --no-install-recommends gnome-panel

gnome-desktop-item-edit ~/Desktop/ --create-new

cp Postman.desktop ~/.local/share/applications
  • Thanks for taking the trouble to answer, but unfortunately following the steps you recommended made no difference to the issue I described: the result is still that my application works fine, and shows an icon in the launcher which can be used to Quit, etc, but that icon is a generic barred icon with the application's name given as Unknown, even though the desktop file icon itself (on the the desktop, in ~/.local/share/applications, and in the display resulting from clicking the Show Applications button) is my custom icon, with my application's name beside it. Jun 26, 2020 at 5:04
  • Can you share the screenshot of what exactly is appearing to you. May be I'll research more and would like to help you.
    – Sayen
    Jun 26, 2020 at 5:16
  • Hi, Sayen, I could post another screenshot but it would show exactly the same as the screenshot linked above under "Screenshot with no custom icon in Dock, but present in Nautilus". Jun 27, 2020 at 8:04
  • I would recommend you to dete the existing .desktop file and try again with the commands shared above by me.
    – Sayen
    Jun 27, 2020 at 11:25
  • Deleting all copies of the existing .desktop file and starting again makes no difference. @Sayen, can you confirm that (a) your operating environment is Ubuntu 18.04, and (b) when you launch your Postman application, you see your own Postman icon in the launcher. After all, this was working for me in 16.04, and even now, the application works fine, it just doesn't display its own icon in the launcher. Jul 2, 2020 at 7:09

I solved my problem, at least for my own setup as described above. The solution has nothing to do with .desktop files and the like. I was able to add my application's actual name (instead of 'Unknown') to the menu bar and the dock (when hovering over the icon in the latter) simply by giving it as the first item in the list passed as the only argument to QApplication: in effect, simulating what in a C or C++ CLI-based program would be argv[0], i.e. the name by which the program was invoked. I was able to have my icon shown by making an explicit call to the application's (note: not the main window's) setWindowIcon method. So my now successful setup sequence is:

# QApplication must be called before any GUI elements are built
application = QApplication([ENV.DISPLAY_NAME])
# set application icon (works for Ubuntu and Mac)
# The following assignment is necessary to create a ref to MainWindow,
# otherwise MainWindow immediately gets garbage-collected!
mainWindow = MainWindow(ID.NAME, options)
# In Python3, we don't need exec_ since exec is not a reserved word

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .