7

I installed Telegram Messenger from source, but now there are Telegram and Telegram Desktop in the Unity Launcher. Has someone any clue how to remove one of these?

Jacob Vlijm
  • 83,767
Jaanus
  • 71
  • What do you mean by Launchpad? This? https://launchpad.net/ if so, what does it have to do with what you installed? If not, can you clarify? – dadexix86 Jul 06 '16 at 08:25
  • Most likely, you started the first time from cli and locked it to the launcher, right? – Jacob Vlijm Jul 06 '16 at 08:27

3 Answers3

5

For some reason, Telegram makes two .desktop files when installed; one in /usr/share/applications and one in ~/.local/share/applications

I now just rename the local one so that it isn't read:

mv ~/.local/share/applications/telegramdesktop.desktop ~/.local/share/applications/telegram

This immediately kills the second icon.

You may have to repeat when Telegram updates itself, as it will regenerate the file

Zanna
  • 70,465
  • 3
    I wouldn't suggest him to remove the global one, if it exists, nor to edit it! First copy locally before editing! – Jacob Vlijm Jul 06 '16 at 08:29
2

Right click the unwanted one and choose unlock from launcher. This approach will remove it from the launcher but should be risk free and doesn't require editing anything.

Elder Geek
  • 36,023
  • 25
  • 98
  • 183
0

It seems that whenever you launch the Telegram Desktop app, it will automatically generate the file org.telegram.desktop._<some_id>.desktop under the ~/.local/share/applications folder. Note that the one in /usr/share/applications will have the root privilege to generate that file.

There's a Linux feature called "immutable bit" provided by the chattr command, which can be used to make a file unable to be deleted, even by root. So here are the steps to stop the auto-creation of that duplicated launcher:

  1. Open the file org.telegram.desktop._<some_id>.desktop which is under ~/.local/share/applications, delete all its contents.
  2. Set the immutable bit on that file:
sudo chattr +i ~/.local/share/applications/org.telegram.desktop._<some_id>.desktop
  1. Start the Telegram Desktop app, now it will not be able to create or rewrite the duplicated launcher.
Andy Ma
  • 101