Jan Grulich

Telegram desktop client for flatpak #2

Some time ago I posted a blog post about how I packed telegram desktop client for flatpak. I’ve been updating it since then in some reasonable intervals as I don’t have time to update it more often and mostly because the telegram client’s build system breaks my build quite oftenly. Recently I discovered that someone managed to patch telegram to use system Qt libraries instead of building own patched Qt and building linking it statically. After some time I managed to adjust those patches and make them work with my build which allows me to use Qt from KDE runtimes. Here are new instructions how to get this work:

Add KDE runtimes repository and install runtimes
$ flatpak remote-add kde --from https://distribute.kde.org/kderuntime.flatpakrepo
$ flatpak install kde org.kde.Platform

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

Or install it from bundle
$ wget https://jgrulich.fedorapeople.org/telegram/telegram.flatpak
$ flatpak install --bundle telegram.flatpak

The reason I did the hard work to build it with Qt from KDE runtimes is that now you can use telegram with portals support if you run it with “-platform flatpak” parameter. Unfortunately this only makes openURI portal to work as telegram has some internal hacks or whatever to use gtk filedialog so for that reason I still allow to access user’s home directory. There is also a bug if you use telegram under KDE where it tries to use QSystemTrayIcon instead of libappindicator and unfortunately telegram’s system tray icon (the one using QSystemTrayIcon) works only with Qt 5.6.2 and in KDE runtimes we have Qt 5.7.1. The system tray icon is visible, but its context menu doesn’t work so if you want to have fully working system tray icon you have to use “–env=XDG_CURRENT_DESKTOP=gnome” flatpak parameter to force it to use libappindicator.

And that’s it. Sorry you had telegram broken for couple of days while I was fighting with it, but hopefully it will work perfectly now.

23 thoughts on “Telegram desktop client for flatpak #2

    1. Sure, but I would need better description about your problem. Do you get any error when you run it using “flatpak run … “?

      1. Sure, I was wondering if you prefer it e.g. somewhere github.

        Now, I have kinda uncommon setup so it’s probably something rare.

        I have binary nvidia drivers (hence libGL errors – I get that from other flatpaks as well but they work),
        And I don’t have pulseaudio. Looks like telegram fails to use alsa.

        Binary non-flatpak version works on the same machine, so it might be some flatpak restriction?

        $ flatpak run org.telegram.TelegramDesktopDevel
        libGL error: No matching fbConfigs or visuals found
        libGL error: failed to load driver: swrast

        ** (telegram-desktop:2): WARNING **: Error retrieving accessibility bus address: org.freedesktop.DBus.Error.ServiceUnknown: The name org.a11y.Bus was not provided by any .service files
        AL lib: (WW) alc_initconfig: Failed to initialize backend “pulse”
        ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection refused

        AL lib: (EE) ALCcaptureAlsa_open: Could not open capture device ‘default’: Connection refused
        : CommandLine Error: Option ‘bb-vectorize-ignore-target-info’ registered more than once!
        LLVM ERROR: inconsistency in registered CommandLine options

        1. I’ve been told that you are missing nvidia driver extension or there is an issue with it and kde runtime. Also you don’t have pulseaudio and there is now libalsa with direct HW access.

  1. Hi… thanks. Telegram desktop client for flatpak is working nicely, but I have some issues with it:
    1. When I launch Telegram, always a new instance is created, that means I can launch Telegram twice and have two of them at the same time!
    2. When I click on URLs in Telegram, they are not opening in the browser (nothing happens).
    3. How can I change the name of the launcher in applications menu? I want to change “(Nightly) Telegram Desktop” to “Telegram Desktop (Nightly Build)”

    1. I should correct case 3! Where is the path of Telegram .desktop file? I am using Debian but I couldn’t find it anywhere.

      1. OK, I found it in “/var/lib/flatpak/exports/share/applications/”.

    2. 1) I think this should be fixed now, please update telegram
      2) Should work now when you open telegram through desktop file
      3) Nightly suffix is now gone

      1. 1) Yes, it is fixed.
        2) .desktop file cannot launch Telegram, I tested its “Exec” command in Terminal:
        “/usr/bin/flatpak run –branch=master –arch=x86_64 –command=telegram-desktop org.telegram.desktop — -platform flatpak”
        but it didn’t work, this is the error-message:
        “ASSERT failure in QList::at: “index out of range”, file ../../../../include/QtCore/../../src/corelib/tools/qlist.h, line 540″
        but if I remove “-platform flatpak” argument, it will launch Telegram (of course when I click on URLs in Telegram, they are not opening in the browser (nothing happens)):
        “/usr/bin/flatpak run –branch=master –arch=x86_64 –command=telegram-desktop org.telegram.desktop –”

          1. I updated Telegram with the following command:
            “$ flatpak update”
            but still .desktop file does not work (with “-platform flatpak” argument):
            “ASSERT failure in QList::at: “index out of range”, file ../../../../include/QtCore/../../src/corelib/tools/qlist.h, line 540″

          2. Sorry, my fault, there is apparently something still missing. I will look into that as soon as possible. Meanwhile use –env=XDG_CURRENT_DESKTOP=KDE flatpak paramater as a workaround. Unfortunately there is side effect of using telegram under KDE, that is not using libappindicator and thus not working context menu in systemtray icon.

    3. I am using Debian Testing + GNOME, this command didn’t work (“–env=XDG_CURRENT_DESKTOP=KDE” argument):
      “$ /usr/bin/flatpak run –branch=master –arch=x86_64 –command=telegram-desktop org.telegram.desktop –env=XDG_CURRENT_DESKTOP=KDE — -platform flatpak”
      and still the problem is “-platform flatpak” argument and prints the same error message:
      “ASSERT failure in QList::at: “index out of range”, file ../../../../include/QtCore/../../src/corelib/tools/qlist.h, line 540″
      I had installed Telegram via the following command:
      “$ flatpak install –from https://jgrulich.fedorapeople.org/telegram/telegram.flatpakref

      1. Try it now please, I workarounded this problem by forcing KDE platform theme instead of gnome one which is not working at this moment, this won’t have any sideeffect as telegram has lots of its own custom stuff anyway.

        1. Same for me.. still not working with the parameter -platform flatpak

          Gtk-Message: Failed to load module “pk-gtk-module”
          Gtk-Message: Failed to load module “canberra-gtk-module”
          Gtk-Message: Failed to load module “pk-gtk-module”
          Gtk-Message: Failed to load module “canberra-gtk-module”
          ASSERT failure in QList::at: “index out of range”, file ../../../../include/QtCore/../../src/corelib/tools/qlist.h, line 540

          I am using Fedora 25 Workstation

  2. I have the same problem as M. Sadeq H. E.
    if i remove the -platform flatpak argument it works fine.

    Best regards,

    1. It is only available in the Russian Fedora Repo..
      Anyway.. i’d like to have it in a sandboxed flatpak environment

  3. Now, without the platform parameter in the desktop starter it is working again. thank you for removing it! And keep on your good work!

Leave a Reply

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

Scroll To Top