Jan Grulich

Telegram desktop client for flatpak

Since everyone is talking about flatpak or snappy these days I wanted to try it myself and package some application. I decided to start with telegram desktop client which was suggested to me as an application which would be nice to have packaged for flatpak. Once I saw the build instructions for the first time I thought it’s going to be an impossible task and it almost ended with that result, but I didn’t want to give up. It took me three working days to go through all dependencies and to make it build as the telegram qmake file is written with all paths hardcoded and you need to build it exactly in a way the author intended. I could of course package the binary provided by the author itself, but my intention was to provide a way to test the latest git version. Given that, I think I managed to try almost everything flatpak-builder allows you to do and I have to say I quite enjoyed doing that, because if you want to package an application for flatpak you just need to write a manifest (json file) and declare runtime and sdk you want to use, thankfully upstream already provides most common runtimes you need. Then you just need to define dependencies one by one, where for each of them you can specify whether it should be cloned from git, or if it should be downloaded as an archive or you can even use special type of source called “shell” where you can specify shell commands you want to run. Then flatpak-builder will automatically run configure (or another command you specify, like qmake) , make and make install on every source you define with build parameters you define. This everything is pretty automatized and re-running the build will skip stuff you have already built successfully before or you downloaded before. For most applications writing this manifest is relatively easy and in case you don’t need any specific library which is not provided by any available runtime you can do that pretty fast, even if you do it for the first time, just get some inspiration in another manifest for a similar application and that’s all you need.

To try the telegram desktop client I made the repo created by flatpak-builder available.
You just need to get Gnome runtime first:
$ wget https://sdk.gnome.org/keys/gnome-sdk.gpg
$ flatpak remote-add --gpg-import=gnome-sdk.gpg gnome https://sdk.gnome.org/repo/
$ flatpak install gnome org.gnome.Platform 3.20

And then you can install and run the telegram desktop client:
$ wget https://jgrulich.fedorapeople.org/telegram/keys/telegram.asc
$ flatpak remote-add --gpg-import=telegram.asc telegram-desktop https://jgrulich.fedorapeople.org/telegram/repo/
$ flatpak install telegram-desktop org.telegram.TelegramDesktopDevel
$ flatpak run org.telegram.TelegramDesktopDevel

You can of course build it yourself as well or if you want just check the manifest you can find it here:
https://github.com/alexlarsson/nightly-build-apps

10 thoughts on “Telegram desktop client for flatpak

  1. Thanks you for your hard work.

    However, why did you use the Gnome 3.20 runtime? Telegram is a QT application, with a Qt 5.3.2 or 5.6.0 dependency. So, the KDE runtime seems a better target : https://community.kde.org/Flatpak
    Is it because the KDE runtime is too unstable? Because the Telegram app need a specific QT version missing from the KDE runtime ?

  2. It’s because it requires libappindicator and libappindicator requires gtk+. I would use KDE runtime, but the telegram client has it’s own patch for Qt so I’m building my own version of Qt with telegram patches.

  3. just for curiosity, do you know if is it possible to compile telegram without libappindicator/gtk?

  4. I’m running Telegram on Fedora 26 using the instructions from this blog post. Problem: Telegram does not know how to use GNOME’s native notifications; it seems to be unable to detect libnotify support re this issue: https://github.com/telegramdesktop/tdesktop/issues/91 despite having the GNOME flatpak runtime installed (which provided libnotify). Is there anyway to fix this?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll To Top