Change Icon of Wine Application in Unity Launcher

Workaround on Ubuntu 12.04 LTS and up


Note

This workaround requires a working launcher for your Wine application. Here's a tutorial on how to create one. The workaround also applies to applications installed with PlayOnLinux scripts. More recent versions of PlayOnLinux automatically add the StartupWMClass line to their launcher.

Instructions

Open your .desktop launcher in your favorite text editor and append this line to the file:

StartupWMClass=application.exe

where application.exe is the base name of the executable you want to launch in Wine.

Don't use the the full path, only the base name. And make sure it's unqoted (a general rule you should follow with desktop files).

Result

Application icons and descriptions should be rendered fine now:

enter image description here


Source: https://bugs.launchpad.net/unity-2d/+bug/702452


  1. This is where you will find your icons or place your custom icons in here:

    $ cd ~/.local/share/icons/hicolor/256x256/apps/
    $ ls
    1DF1_PicasaPhotoViewer.0.png
    .
    .
    .
    29F5_WINWORD.0.png
    850A_EXCEL.0.png
    AA79_POWERPNT.0.png
    
  2. Go to the following directory:

    $ cd ~/.local/share/applications/wine/Programs/Microsoft\ Office
    $ ls
    Microsoft Excel 2010.desktop\
    Microsoft Office 2010 Tools\
    Microsoft PowerPoint 2010.desktop\
    Microsoft Word 2010.desktop\
    
  3. Edit .desktop files:

    $ sudo nano Microsoft\ Word\ 2010.desktop
    [Desktop Entry]
    Name=Microsoft Word 2010
    .
    .
    .
    Icon=29F5_WINWORD.0.png (or name of icon as in above folder)
    
  4. You are done!


There are several logged bugs on this issue.

In one of the bugs (post 3), someone has reported a possible workaround. However two further posts below that note that it doesnt always work.


I'm not using Unity, so I really don't know if it will work.

You problem could be beacause of the program launcher. I assume your .desktop file contains Exec=wine '/home/user/.wine/dosdevices/c:/Program...' and so on. Try making a bash binary wich contains something like this:

#!/bin/bash
cd '/home/aldomann/.wine/dosdevices/c:/Archivos de programa/Warcraft II BNE'
wine 'Warcraft II BNE.exe'

Name it for instance warcraft2 and move it to /usr/bin (or any PATH variable, wich you can know by typing echo $PATH on the Terminal)

Then in your .desktop file instead of Exec=wine '...' use Exec=warcraft2. I think Unity will assume this is not a wine program and will use your icon, but it is only conjecture.

Hope it works ;)

By default your Wine apps .desktops are placed on /home/user/.local/share/applications/wine

Instead of modifying an existing .desktop file you can create a new one and place it on /home/user/.local/share/applications. It should be something like this:

[Desktop Entry]
Name=Application
Comment=Comment
Exec=app-binary
Icon=app-icon
Type=Application
Terminal=false
StartupNotify=true
Categories=GTK;Utility

Tip: If you place your icon on /home/user/.icons/ (i.e app-icon.png) you will only have to put Icon=app-icon.