Ubuntu – Unity launcher and Steam icons

icon-themesiconslauncherunity

When I launch "The Binding of Isaac" with Steam, at first the icon is good.

enter image description here

When the popup "Preparing to launch Isaac" is closed, a second icon appear

enter image description here

Then when the game is launched, the first icon disappear, and I get only the "?" icon.

enter image description here

How could I change the icon of this second program which is launched?

I already fill ~/.local/share/applications/The\ Binding\ of\ Isaac\ Rebirth.desktop with the good icon

[Desktop Entry]
Name=The Binding of Isaac: Rebirth
Comment=Play this game on Steam
Exec=steam steam://rungameid/250900
Icon=steam_icon_250900
Terminal=false
Type=Application
Categories=Game;

I'm on Ubuntu 16.04

Thanks for help 🙂

Best Answer

What to do if a window and an icon are not connected

In some cases, a window and the launcher (-icon in the Unity Launcher) are not connected to each other somehow. In your case, the cause is possibly the first ("popup") window, making the launcher icon "assume" the job is done. This often happens with applications, running under either Steam or Wine.

How to solve

  1. Open your application, wait for the final window to appear.
  2. Open a terminal window, type xprop WM_CLASS + Return. Your pointer changes into a big +.
  3. Click on the window of your application. The terminal will output two strings, looking like: "gnome-terminal-server", "Gnome-terminal". Pick either one (I use the lower case one mostly) and add it to your .desktop file:

    [Desktop Entry]
    Name=The Binding of Isaac: Rebirth
    Comment=Play this game on Steam
    Exec=steam steam://rungameid/250900
    Icon=steam_icon_250900
    Terminal=false
    Type=Application
    Categories=Game;
    StartupWMClass=wmclass
    

    ...where wmclass is the lowercase string you found. Possibly you need to log out and back in, and it should work.

Related Question