telegramdesktop / tdesktop

Telegram Desktop messaging app
https://desktop.telegram.org/
Other
26.35k stars 5.24k forks source link

Autostart not working on Linux Mint #24000

Closed gunchleoc closed 2 years ago

gunchleoc commented 2 years ago

Steps to reproduce

  1. Install the Flatpack version of Telegram Dektop, or get & install the latest version from the Telegram homepage
  2. Search for "telegram" in the main menu, right-click and add to autostart
  3. Open Telegram and set it to autostart in the Advanced Settings
  4. Reboot. Telegram will not autostart
  5. Try any combination of 2 & 3 and reboot. Telegram will not autostart
  6. I tried defining the menu shortcut as /home/<user>/Downloads/Telegram/Telegram -workdir /home/<user>/.local/share/TelegramDesktop/ -- %u -startintray but that didn't help either

Expected behaviour

Telegram will autostart on system start after being told to autostart

Actual behaviour

Telegram will not autostart on system start after being told to autostart - possible regression of https://github.com/telegramdesktop/tdesktop/issues/422

Operating system

Release Linux Mint 20.2 Uma 64-bit, MATE 1.24.0

Version of Telegram Desktop

3.5

Installation source

Static binary from official website

Logs

No response

ilya-fedin commented 2 years ago

flatpak permission-show org.telegram.desktop

gunchleoc commented 2 years ago
Table Object App Permissions Data
background background org.telegram.desktop yes 0x00
ilya-fedin commented 2 years ago

Maybe your xdg-desktop-portal backend (or version) doesn't support autostart?

ilya-fedin commented 2 years ago

Linux Mint 20 is based on Ubuntu 20.04 what means all software installed from the repos is two years old and may not support all the APIs

gunchleoc commented 2 years ago

I have Signal and Skype on autostart, so it should be possible in theory - of course I don't know which APIs they are using.

The problem with Telegram started when I had to move from the outdated package in the official Repo to the Flatpack - so, a recent change in how Telegram autostarts would certainly explain the problem.

Screenshot for packages versions on my system:

xdg-versions

ilya-fedin commented 2 years ago

I have Signal and Skype on autostart, so it should be possible in theory - of course I don't know which APIs they are using.

Are they installed through flatpak? Flatpak is sandboxed, so adding to autostart works in a completely another way.

The problem with Telegram started when I had to move from the outdated package in the official Repo to the Flatpack - so, a recent change in how Telegram autostarts would certainly explain the problem.

Well, there were no change in how Telegram autostarts since autostart was added IIRC

ilya-fedin commented 2 years ago

Screenshot for packages versions on my system:

It seems autostart support was added in portals 1.4.0, so versions seem to be ok... Hmm... Which files present in ~/.config/autostart?

gunchleoc commented 2 years ago

Signal is a Flathub package, Skype is not. I did have to fiddle with Signal a bit to start it minimized with a tray icon, call looks like this:

/usr/bin/flatpak run --branch=stable --arch=x86_64 --command=signal --file-forwarding org.signal.Signal --use-tray-icon --start-in-tray @@u %U @@

And this is the Telegram command:

/home/<user>/Downloads/Telegram/Telegram -workdir /home/<user>/.local/share/TelegramDesktop/ -- %u -startintray

The -startintray bit was added my me in one of my fixing attempts-

I have 2 files for Telegram in ~/.config/autostart.

org.telegram.desktop.desktop:

[Desktop Entry]
Version=1.5
Name=Telegram Desktop
Comment=Official desktop version of Telegram messaging app
Exec=/usr/bin/flatpak run --branch=stable --arch=x86_64 --command=telegram-desktop --file-forwarding org.telegram.desktop -- @@u %u @@
Icon=org.telegram.desktop
Terminal=false
StartupWMClass=TelegramDesktop
Type=Application
Categories=Chat;Network;InstantMessaging;Qt;
MimeType=x-scheme-handler/tg;
Keywords=tg;chat;im;messaging;messenger;sms;tdesktop;
Actions=Quit;
SingleMainWindow=true
X-GNOME-UsesNotifications=true
X-GNOME-SingleWindow=true
X-Flatpak=org.telegram.desktop

[Desktop Action Quit]
Exec=/usr/bin/flatpak run --branch=stable --arch=x86_64 --command=telegram-desktop org.telegram.desktop -quit
Name=Quit Telegram
Icon=application-exit

telegram-desktop.desktop:

[Desktop Entry]
Type=Application
Exec=telegram-desktop -- %u
Hidden=false
X-MATE-Autostart-enabled=true
Name[gd_GB]=Telegram Desktop
Name=Telegram Desktop
Comment[gd_GB]=Official desktop version of Telegram messaging app
Comment=Official desktop version of Telegram messaging app
ilya-fedin commented 2 years ago

It seems when you added Telegram to autostart via Cinnamon menu, you've screwed that all and flatpak didn't update already installed (incorrect) file by Cinnamon. So, you need to remove these files and disable-enable the setting in Telegram settings

gunchleoc commented 2 years ago

Done, but still not working. I'm wondering if the blank space in the localized "Downloads" directory name might be a problem?

Switching it on and off created the following autostart file:

appimagekit_ddea7328d578c0a94855eb4e72f69bb5-Telegram_Desktop.desktop


[Desktop Entry]
Version=1.5
Name=Telegram Desktop
Comment=Official desktop version of Telegram messaging app
TryExec=/home/<user>/Luchdaidhean a-nuas/Telegram/Telegram
Exec=/home/<user>/Luchdaidhean\\ a-nuas/Telegram/Telegram -workdir /home/<user>/.local/share/TelegramDesktop/ -autostart
Icon=telegram
Terminal=false
StartupWMClass=TelegramDesktop
Type=Application
Categories=Chat;Network;InstantMessaging;Qt;
MimeType=x-scheme-handler/tg;
Keywords=tg;chat;im;messaging;messenger;sms;tdesktop;
Actions=Quit;
SingleMainWindow=true
X-GNOME-UsesNotifications=true
X-GNOME-SingleWindow=true

[Desktop Action Quit]
Exec=/home/<user>/Luchdaidhean\\ a-nuas/Telegram/Telegram -workdir /home/<user>/.local/share/TelegramDesktop/ -quit
Name=Quit Telegram
Icon=application-exit
ilya-fedin commented 2 years ago

What is not working? I see the desktop file is correct now

gunchleoc commented 2 years ago

Telegram is not starting after system start. If I right-click on the entry in the start menu, the tick mark is there, so everything looks correct, but it's still not working.

I just double-checked the rights of the executable, it's on -rwxrwxr-x, so that looks OK too.

BTW I'm on MATE, not Cinnamon, in case this makes a difference.

ilya-fedin commented 2 years ago

Are you sure it's not starting? Maybe you've activated the start minimized option and it's starting, just tray icon doesn't work?

zaemiel commented 2 years ago

I have the same problem. Telegram Desktop won't autostart anymore. I'm on Linux Mint 20.1 Cinnamon.

ilya-fedin commented 2 years ago

@zaemiel check what is present in ~/.config/autostart

gunchleoc commented 2 years ago

Maybe you've activated the start minimized option and it's starting, just tray icon doesn't work?

Good guess, but removing the tick from "Launch minimized" didn't fix it.

ilya-fedin commented 2 years ago

:( Maybe it's something Mint-specific? E.g. there was a system update that broke the autostart mechanism. Because I can't reproduce this on NixOS with MATE nor I have enough space on my SSD to create a VM with Mint.

gunchleoc commented 2 years ago

Maybe. I just double-checked with ps aux and there are no processes with "telegram" in heir name.

zaemiel commented 2 years ago

@zaemiel check what is present in ~/.config/autostart

It's the same like gunchleoc has. I have a solution. I've made manually a startup command for System Settings > Startup Applications

image

And used this command: ~/Telegram/Telegram -startintray

It's solved the problem. "Official way" no longer works for me.

mknv commented 2 years ago

It's solved the problem. "Official way" no longer works for me.

Thank you. This works for me.

KrazyIvan- commented 2 years ago

Problem is Version in .config/autostart/ Telegram_Desktop.desktop [Desktop Entry] Version=1.5 Name=Telegram Desktop .... --- Change to Version=1.5 to Version=1.0 --- and it works [Desktop Entry] Version=1.0 Name=Telegram Desktop

ilya-fedin commented 2 years ago

The version couldn't be changed, the file uses features from the version 1.5 of the XDG spec

ilya-fedin commented 2 years ago

Looks like you should request support for version 1.5 in Cinnamon

KrazyIvan- commented 2 years ago

run this: desktop-file-validate .config/autostart/Telegram_Desktop.desktop ( tname of your file) Telegram_Desktop.desktop: error: value "1.5" for key "Version" in group "Desktop Entry" is not a known version

just Mint left behind ;-)

ilya-fedin commented 2 years ago

Yeah, looks like your Mint is too old for this feature now, you should ask Mint developers to add support if you want to use this feature

KrazyIvan- commented 2 years ago

Linux Mint 20.3 Cinnamon/Ubuntu 20.04.3 LTS same latest LTS. better keep Version=1.0 until next LTS release. or skip/remove 'Version=..' line in .desktop file also can work.

ilya-fedin commented 2 years ago

I don't think the progress should be stopped because of LTS

KrazyIvan- commented 2 years ago

Then if users complain just find this thread fix himself. Can close the issue now. Not a bug, Ubuntu/Mint LTS not support/left behind in progress :)

ilya-fedin commented 2 years ago

Yeah, there's no sign that would be supported in 22.04 and waiting another 2 years is not something really wanted here given that tdesktop is bleeding edge by its nature

ilya-fedin commented 2 years ago

Also, if changing the Version key value or removing it helps, this means desktop-file-validate is unrelated here as it would fail with those changes anyway (either because version 1.0 doesn't support the used keys or because the file lacks the version), so it's most likely a bug in Cinnamon that you need to report if you want to see it fixed

KrazyIvan- commented 2 years ago

remove just Version=... working fine. Even valide still say error.

Telegram_Desktop.desktop: error: file contains key "SingleMainWindow" in group "Desktop Entry", but keys extending the format should start with "X-"

Ubuntu/Mint LTS all same. Just remove Version=... and all users will be happy

ilya-fedin commented 2 years ago

all users will be happy

Users of Linux Mint will be happy obviously. Not all users though. In other words, changing that would fix for you, but break for users of other DEs that conform the spec more strictly. So this needs a fix on Cinnamon side.

gunchleoc commented 2 years ago

My system still doesn't like it, so I'll just have to start it manually for now.

Thank you all very much for the time spent trying to help me! I fully understand why you don't want to spend more time programming for this.

ilya-fedin commented 2 years ago

The thing is change needs to be done on Cinnamon side