I made a custom .desktop file, and put it in /usr/share/applications and it can be found when searching in the GNOME search bar and started like that.

It then appears as an icon in the GNOME Dock, but unlike most other applications, it cannot be locked to the Dock once it is running. What is needed for an application to be able to lock it to the Dock when it is running?

Remark 1: in Unity (Ubuntu 16.04), the items "lock to Launcher" and "add to Dash" are available in the right-click menu (unlike in GNOME), but the item disappears from the Dock as soon as it is closed.

Remark 2: with

dconf write /org/gnome/shell/favorite-apps 


gsettings set org.gnome.shell favorite-apps

I can get it there by rewriting the contents of the Dock. (I still ask this because I want it to make easier for colleagues to lock it to the Dock).

For completeness I add below the contents of the file: /usr/share/applications/rdesktop-icaros.desktop

[Desktop Entry]
Name=Rdesktop to Icaros
Exec=rdesktop -d WINAPPS  -g 1280x1024 icaros
  • Is the .desktop file marked executable? – pomsky Feb 5 '18 at 15:54
  • @pomsky No it isn't , thats not needed for .desktop files, have a look in your own /usr/share/applications: the default ones are all -rw-r--r-- permissions. – jringoot Feb 5 '18 at 21:01

I managed to add my application to the dash/favorites by clicking "Activities" (top-left corner of screen), then searching for my application and, when it appears, right-clicking it and choosing "Add to favorites".

It didn't work by clicking the icon while the application is already running though.

I was facing this problem also because I was creating the .desktop file in ~/Desktop, but it has to be placed inside ~/.local/share/applications/.

My .desktop file:

$ cat ~/.local/share/applications/MetaTrader\ 5.desktop 
[Desktop Entry]
Name=MetaTrader 5
GenericName=Stocks Broker
Comment=Run MetaTrader 5 on this machine
Exec=env WINEPREFIX="~/.PlayOnLinux/wineprefix/metatrader" ~/.PlayOnLinux/wine/linux-amd64/4.0.3/bin/wine64 C:\\\\windows\\\\command\\\\start.exe /Unix ~/.PlayOnLinux/wineprefix/metatrader/dosdevices/c:/users/Public/Desktop/MetaTrader\\ 5.lnk
Path=~/.PlayOnLinux/wineprefix/metatrader/dosdevices/c:/Program Files/MetaTrader 5

Off-topic, but may be useful: StartupWMClass can be found by executing xprop WM_CLASS, then clicking the application window. This will group windows of the same class together.

My distro:

$ cat /etc/issue
Ubuntu 20.04 LTS \n \l

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.