From 9833b202f928e87c7bf50e7f096c2044821736f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1=80?= <153805936+Cheviiot@users.noreply.github.com> Date: Sat, 25 Jul 2026 16:44:53 +1000 Subject: [PATCH] fix(telegram-desktop): use Telegram's own external-updater opt-out instead MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The DESKTOPINTEGRATION wrapper/environment.d combo only ever stopped the shadow .desktop/.service self-install. It never addressed a second, worse symptom: QGuiApplication::setDesktopFileName() in Platform::start() sets the Wayland app_id to a per-install-path hashed "org.telegram.desktop._" id whenever Core::UpdaterDisabled() is false — completely independent of DESKTOPINTEGRATION — so the running window's app_id never matched our shipped org.telegram.desktop.desktop and its icon/taskbar entry broke even after the duplicate launcher file was silenced. Telegram ships a documented opt-out for exactly this: Launcher:: ComputeExternalUpdater() (core/launcher.cpp) scans / externalupdater.d/ for a file containing a line equal to its own full executable path, and calls SetUpdaterDisabledAtStartup() if found. That one flag flips both Core::UpdaterDisabled() checks at once — InstallLauncher() skips the shadow-file self-install AND desktopFileName() uses the plain "org.telegram.desktop" id that matches our .desktop file, fixing the window icon too. Drop the wrapper script and environment.d drop-in; back to a plain /usr/bin symlink plus one externalupdater.d marker file. --- telegram-desktop/Staplerfile | 39 ++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/telegram-desktop/Staplerfile b/telegram-desktop/Staplerfile index ff7dcaf..4d61e4f 100644 --- a/telegram-desktop/Staplerfile +++ b/telegram-desktop/Staplerfile @@ -1,6 +1,6 @@ name='telegram-desktop' version='7.0.5' -release=5 +release=6 summary='Official Telegram messaging client' summary_ru='Официальный клиент мессенджера Telegram' group='Networking/Instant messaging' @@ -64,30 +64,30 @@ package() { install -dm755 "${pkgdir}/opt/telegram-desktop" install -Dm755 "Telegram/Telegram" "${pkgdir}/opt/telegram-desktop/Telegram" - install -Dm755 /dev/stdin "${pkgdir}/usr/bin/telegram-desktop" <<'EOF' -#!/bin/sh -# Telegram self-installs a shadow ~/.local/share/applications/*.desktop (and -# a D-Bus service file) on every launch unless this env var is set; see -# InstallLauncher() in Telegram/SourceFiles/platform/linux/specific_linux.cpp. -export DESKTOPINTEGRATION=1 -exec /opt/telegram-desktop/Telegram "$@" + install -dm755 "${pkgdir}/usr/bin" + ln -sfn /opt/telegram-desktop/Telegram "${pkgdir}/usr/bin/telegram-desktop" + + # Telegram's own Launcher::ComputeExternalUpdater() (SourceFiles/core/ + # launcher.cpp) looks for a file under /externalupdater.d/ that + # contains a line matching its own full executable path; if found, it + # calls SetUpdaterDisabledAtStartup(), which is the *documented* way for + # distro/repo packagers to tell Telegram "I manage updates, not you". + # This one flag fixes two things at once: it makes InstallLauncher() skip + # self-writing a shadow ~/.local/share/applications/*.desktop and D-Bus + # .service file on every launch, and it makes QGuiApplication's + # desktopFileName() (the Wayland app_id used to match the running window + # to an icon) use the plain "org.telegram.desktop" id instead of a + # per-install-path hashed one — which is what was breaking the + # taskbar/window icon even after the shadow-file duplicate was silenced. + install -Dm644 /dev/stdin \ + "${pkgdir}/opt/telegram-desktop/externalupdater.d/nivora" <<'EOF' +/opt/telegram-desktop/Telegram EOF install-desktop org.telegram.desktop.desktop install -Dm644 telegram-desktop.png \ "${pkgdir}/usr/share/icons/hicolor/256x256/apps/org.telegram.desktop.png" - # Belt-and-braces on top of the /usr/bin wrapper: the wrapper only helps - # when something actually launches via that path. A stale desktop-shell - # app cache (or any other launcher) can still exec the raw binary - # directly, so also export DESKTOPINTEGRATION for the whole graphical - # session via environment.d — this covers every launch path regardless - # of how the binary was invoked. - install -Dm644 /dev/stdin \ - "${pkgdir}/etc/environment.d/50-telegram-desktop-nivora.conf" <<'EOF' -DESKTOPINTEGRATION=1 -EOF - install-license LICENSE "telegram-desktop/LICENSE.nivora" } @@ -96,7 +96,6 @@ files() { files-find-desktop files-find-license files-find \ - "/etc/environment.d/50-telegram-desktop-nivora.conf" \ "/opt/telegram-desktop/**/*" \ "/usr/share/icons/hicolor/256x256/apps/org.telegram.desktop.png" }