13

I have downloaded Telegram Messenger for PC/Mac/Linux from their website and copied it to /opt/Telegram/Telegram. After that i have created a sym link in /usr/local/bin that points to the installation directroy and added it to my PATH. Now i can easily start Telgram Messenger from console but how do i get it indexed by Dash including the app icon?

Wilf
  • 30,194
  • 17
  • 108
  • 164
  • Haven't used Telegram desktop but you probably need a .desktop file. https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles – xangua Jul 19 '15 at 12:26

2 Answers2

15

The programs that show up in the Dash, desktop menus etc are there due to .desktop files in /usr/share/applications & ~/.local/share/applications. You can easily make a launcher using a file similar to this in either of the above locations (named telegram.desktop or similar):

[Desktop Entry]
Encoding=UTF-8
Name=Telegram
Exec=/opt/Telegram/Telegram -- %u
Icon=/opt/Telegram/telegram128.png
Type=Application
Categories=Network;
MimeType=x-scheme-handler/tg;

Note that the Exec line should contain the command to launch the app (like the one you used in Terminal) - this can be like telegram, /usr/bin/telegram-cli, /opt/Telegram/Telegram etc.

The Icon line points to the icon to use - this can be telegram (if there is are appropriately named icons in ~/.local/share/icons or /usr/share/applications), or point to a icon file directly. (e.g. /opt/Telegram/telegram128.png.). If you need a icon I have uploaded one here.

If the file does not show, try running one of these commands:

update-desktop-database /usr/share/applications
update-desktop-database ~/.local/share/applications

depending on where you placed the file. A restart of the desktop (or logging out and back in again) may be necessary. A similar process can be done for other applications.

The spec for a .desktop file can be found here: http://standards.freedesktop.org/desktop-entry-spec/latest/

yanpas
  • 543
  • 4
  • 16
Wilf
  • 30,194
  • 17
  • 108
  • 164
  • 1
    Thx! Telegram already added a .desktop file in ~/.local/share/applications. But the exec part looked like exec=-- $u. I changed it to exec=/opt/Telegram/Telegram %u and it worked. – Andree Wille Jul 19 '15 at 15:23
  • 1
    not working for me – Nurlan May 12 '17 at 09:24
  • @Nurlan how so? Telegram will need to be installed, and you need to configure the Exec and Icon lines. – Wilf May 12 '17 at 17:04
  • 1
    @Wilf, The file existed in system. After editing it and restarting the OS I could find icon in dash. Thanks! – Nurlan May 13 '17 at 18:28
  • How to call it with QT_IM_MODULE=xim option in .desktop, because I'm getting errors with accents. – Sigur May 17 '17 at 01:11
  • 1
    @Sigur stick if at the beginning after Exec=env (probably...) or use a bash script EDIT: https://askubuntu.com/q/144968/178596 – Wilf May 17 '17 at 13:59
4

Also you can install Telegram using snap (Ubuntu 18.04):

$ sudo snap install telegram-desktop
zombic
  • 181