1

I've created a .desktop file looking like this:

[Desktop Entry]
Type=Application
Name=sts
Comment=Spring Tool Suite
Icon=/home/pago/Programi/sts-bundle/sts-3.9.1.RELEASE/icon.xpm
Exec=/home/pago/Programi/sts-bundle/sts-3.9.1.RELEASE/STS
Terminal=false
Categories=Development;IDE;Java;Eclipse
StartupWMClass=STS

The desktop file has the correct icon, but when it launches it's just a red x sign in a grey frame. I also tried putting the .desktop icon in ~/.local/share/applications/sts.desktop and in /usr/share/applications/sts.desktop and I've copied the icon to /usr/share/pixmaps/sts.xpm

Even if I search in activities for STS and pin it to dash, it has a normal icon, but when launched it defaults to the wrong one.

Byte Commander
  • 107,489
  • 1
    What is the output when you open STS, then open a terminal and type xprop WM_CLASS and click with the mouse cursor (which should have changed into a crosshair now) on the STS window? (related: https://askubuntu.com/questions/558098/icon-missing-when-application-is-launched) – Byte Commander Dec 17 '17 at 22:40
  • I tried that too, forgot to mention it. Weirdly I can't select it with xprop. – Blaž Bagić Dec 22 '17 at 15:15

5 Answers5

1

For Ubuntu 18.04 LTS with Gnome Desktop and Wayland make sure to use the proper value for StartupWMClass in your sts.desktop - file (tested with STS 3.9.9).

  1. Log out
  2. Switch to an Xorg-Session
  3. Start STS
  4. Open a terminal and enter xprop WM_CLASS
  5. Place the crosshair over your STS-Window and click
  6. Enter the displayed value (e.g. WM_CLASS(STRING) = "Spring Tool Suite 3 ", "Spring Tool Suite 3 " ) as StartupWMClass in your sts.desktop file (e.g. StartupWMClass=Spring Tool Suite 3)

  7. Log out and switch back to wayland session

0

Add this file in $HOME/.local/share/applications.

See this.

sts.desktop

[Desktop Entry]
Type=Application
Name=sts
Comment=Spring Tool Suite
Icon=/home/josdem/STS/sts-3.7.3.RELEASE/icon.xpm
Exec=/home/josdem/STS/sts-3.7.3.RELEASE/STS
Terminal=false
Categories=Development;IDE;Java;
StartupWMClass=STS
karel
  • 114,770
fabianopinto
  • 101
  • 1
0

For Ubuntu 18.04LTS using the Gnome DE

Put your desktop file in /home/username/.local/application then it'll show up in applications menu (super a.k.a "The Windows key" on the keyboard to access)

Fom there you can right click and chose Add to favorites.

Fabby
  • 34,259
ancm
  • 111
0

For Ubuntu 20.04 I did below and worked.
I did it for SpringToolSuite4.

Run the below command in terminal:

sudo gedit /usr/share/applications/STS.desktop

Above should open gedit. Paste below in the file and save:

#!/usr/bin/env xdg-open
[Desktop Entry]
Name=Spring Tool Suite 4
Type=Application
Terminal=false
Comment=Spring Tool Suite 4
Exec=/Path_To_STS/SpringToolSuite4
Icon=/Path_To_STS/icon.xpm
Categories=Development;IDE;Java;

Immediately after that, I see the icon in my Applications section:

enter image description here

David
  • 3,367
0

For 2022 STS the executable has changed. Working for me:

In terminal :

sudo gedit /usr/share/applications/sts.desktop

Can also save it in your home directory without sudo priviledges :

 gedit ~/.local/share/applications/sts.desktop

The file contents:

[Desktop Entry]
Type=Application
Name=STS
Comment=Spring Tool Suite
Icon=/d/apps/ide/sts/sts-4.14.0.RELEASE/icon.xpm
Exec=/d/apps/ide/sts/sts-4.14.0.RELEASE/SpringToolSuite4
Terminal=false
Categories=Development;IDE;Java;
StartupWMClass=Spring Tool Suite

In spring STS About :

Spring Tool Suite 4

Version: 4.14.0.RELEASE

Build Id: 202203131612

OS: Linux, v.5.13.0-37-generic, x86_64 / gtk 3.24.30

Java vendor: Eclipse Adoptium

Java runtime version: 17.0.2+8

Java version: 17.0.2

tgkprog
  • 555
  • 1
  • 11
  • 28