telegramdesktop / tdesktop

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

Run Telegram Desktop in background without displaying a tray icon #16062

Closed dancojocaru2000 closed 1 year ago

dancojocaru2000 commented 3 years ago

At the moment, on all Linux desktop environments that are phasing out tray icons, Telegram Desktop lacks the ability to run in the background.

Where the tray is not available, Telegram Desktop should still have an option to run in the background instead of entirely shutting down when the window is closed.

Having a tray icon is undesired, and extensions for adding tray icons are slowly growing unsupported / phased out. Therefore, suggesting installing such an extension is not a solution, nor a desirable workaround.

Furthermore, this is not "minimize on close". The app window should be closed (not visible in Alt+Tab, for example), but the application should still be running, and notifications should still be delivered. Essentially, while the window is closed in this mode, Telegram Desktop would act like a daemon. Keeping the window open when pressing the close button is also undesired behaviour.

Finally, this option should be available on other desktop environments or platforms too (for example Windows). Namely, the option to not show a tray icon but still keep the application running.

soloturn commented 3 years ago

@soloturn it is known that gnomers are latent macosers so I don't know what you wanted to say

i want to say: you are right. minimize without a tray does not exist, in fact that is the very definition of "minimize". click "minimize" on gnome should be called "hide" and not send anything to the applicaiton. so - won't fix is fine :)

dancojocaru2000 commented 3 years ago

i want to say: you are right. minimize without a tray does not exist, in fact that is the very definition of "minimize". click "minimize" on gnome should be called "hide" and not send anything to the applicaiton. so - won't fix is fine :)

I am not sure what this has to do with, for example, keeping Telegram running on Windowsw or KDE after disabling the tray in settings.

mipro98 commented 3 years ago

As I have check now, Discord have implemented a way to keep running minimized in this scenario.

So that is not something impossible, just that isn't implemented yet.

Slack and Telegram does not support this yet.

AFAIK Slack does support it. It stays open in the background when the "close" button is pressed on gnome-shell.

I remember KeepassXC having the same behavior for a long time: if there has been no tray, there was no way to run the app in the background. However, they fixed it some time ago which made my personal workflow much easier because the window isn't always in the way. Personally I would welcome an option in tdesktop to enable a background service without having to use a system tray because I would always get notified for new messages without having to have the window open.

etircopyh commented 3 years ago

As I have check now, Discord have implemented a way to keep running minimized in this scenario.

AFAIK Slack does support it. It stays open in the background when the "close" button is pressed on gnome-shell.

Nothing implemented there. Did you read this? (both Slack and Discord are using Electron)

Electron doesn't have API to check whether tray icon is supported, so Discord just thinks that the icon is here.

I remember KeepassXC having the same behavior for a long time: if there has been no tray, there was no way to run the app in the background.

The absence of tray is the problem. I traced 4 issues before KeepassXC developer implemented such behavior, I don't know why would he reconsider, maybe he got annoyed. Anyway it's still an exception and most of reasonable devs seem reluctant to "fix" this "issue".

ilya-fedin commented 3 years ago

Maybe I should go ahead and implement the API for Electron, looks like they waiting someone for a long time. Then both Slack and Discord will start to exit when tray is not present most likely, so there will be a way less examples of such behavior.

dancojocaru2000 commented 3 years ago

Since KeePassXC was mentioned, here are good reasons for not having a tray: https://github.com/keepassxreboot/keepassxc/issues/5547#issuecomment-722591381

Maybe I should go ahead and implement the API for Electron [...] Then both Slack and Discord will start to exit when tray is not present most likely, so there will be a way less examples of such behavior.

From best to worst case scenario:

The absence of tray is the problem.

Expecting a tray and enabling an otherwise unrelated feature only when the tray is present is the problem. In a way, this is like disabling the text input field if no physical keyboard is connected, even if an on screen keyboard can be used to type.

etircopyh commented 3 years ago

here are good reasons for not having a tray

I see no such thing. Are being "lightweight" is a reason? Or is it saving "precious screen space", lol give me a break. I am using WM (sway) myself and it's pretty "lightweight" in its essence. What "precious screen space" are we talking about? I guess author of this post also went "lightweight" on display and using 480p.

Discord and Slack add an option to choose the behavior

Why would they? That behavior has only been a case because of missing API.

In a way, this is like disabling the text input field if no physical keyboard is connected, even if an on screen keyboard can be used to type.

Don't do an example thing anymore...

dancojocaru2000 commented 3 years ago

I see no such thing. Are being "lightweight" is a reason? Or is it saving "precious screen space", lol give me a break. I am using WM (sway) myself and it's pretty "lightweight" in its essence. What "precious screen space" are we talking about? I guess author of this post also went "lightweight" on display and using 480p.

Glad your setup works for you. Others have other setups.

Why would they? That behavior has only been a case because of missing API.

Do you have a guarantee of that? If that were the case then someone would have added the API by now. The API missing for so long is a sign that nobody really needed it.

Don't do an example thing anymore...

Why not? Assuming your reaction is a disapproving one, why is my example with the keyboard wrong?

ilya-fedin commented 3 years ago

The API missing for so long is a sign that nobody really needed it.

It's just other platforms always have tray

dancojocaru2000 commented 3 years ago

It's just other platforms always have tray

Then remove the check for a tray existing and the issue is solved :D

ilya-fedin commented 3 years ago

Then remove the check for a tray existing and the issue is solved :D

that wasn't funny, that was just fuckin' gnome

dancojocaru2000 commented 3 years ago

I sent the previous reply as a joke but giving it a little extra though, there's actually nothing wrong with doing that.

On Windows, Telegram Desktop has a "Show a tray icon" setting.
When that setting is on, the tray icon is shown and Telegram runs in the background when the window is closed.
When the setting is off, the tray icon is not shown, and Telegram shuts down when the window is closed.

If the check for a tray existing is removed, then that causes no problems and almost fixes this issue.

On platforms with a tray (which, as was said, "other platforms always have a tray"), nothing changes.

On platforms without a tray, that "Show a tray icon" setting functions as a "Run in the background" setting.
When the setting is on, Telegram runs in the background (because it assumes a tray icon is shown).
When the setting is off, Telegram shuts down instead of running in the background.

Then, the problem would move to specific environments to hide the tray icon (Windows for example has a setting for that).

ilya-fedin commented 3 years ago

This will lead to a lot of complains that it is impossible to exit from tdesktop, again

dancojocaru2000 commented 3 years ago

But as I said, it will be possible to exit if the "Show a tray icon" setting is off. Telegram will then exit when the window is closed!

That check for a tray icon existing could then be moved to rename that option to "Run Telegram in the background" and all is good!

That check could also be used to make running in the background off by default if the platform doesn't have a tray, keeping the existing behavior entirely, making the option opt-in and changing nothing for current users who don't want it.

etircopyh commented 3 years ago

Glad your setup works for you. Others have other setups.

Yeah, everyone have their own setups... with tray. You're complaining about some edge case because you feel like it. As I already said and you replied with non-sense analogy about phones there's a lot of people using PC that would consider app running in background without any indication a virus, lol even me would. I mean it's computer, why the hell app would do that other than to steal my porn collection. And option won't change anything as people not always can understand what they're doing, not always remember what they did.

ilya-fedin commented 3 years ago

But as I said, it will be possible to exit if the "Show a tray icon" setting is off.

There were complains when there was the bug with the check, so it's known it isn't enough to stop complains

dancojocaru2000 commented 3 years ago

There were complains when there's been the bug with the check, so it's known it isn't enough to stop complains

Edited the message after sending it. In particular, how the current behaviour could be the default on platforms without a tray, changing nothing for current users, therefore avoiding those complaints.

I assume those complaints were there because the default behavior was running in the background without any obvious way to turn it off (since it was named "Show a tray icon").

etircopyh commented 3 years ago

making the option opt-in

Opt-in bugs, that's new.

ilya-fedin commented 3 years ago

I assume those complaints were there because the default behavior was running in the background without any obvious way to turn it off (since it was named "Show a tray icon").

Yeah, and you propose to make it again

dancojocaru2000 commented 3 years ago

Opt-in bugs, that's new.

Opt-in features, considered bugs by people who don't want them.

Yeah, and you propose to make it again

If you would read my reply, you would see that this is the third time that I propose that the default behavior on platforms without a tray should be kept as the current one, and that the setting to toggle the behavior could be renamed to properly show what it does in order for it not to be confusing. Maybe bold will help.

ilya-fedin commented 3 years ago

and that the setting to toggle the behavior could be renamed to properly show what it does

Oh. It's up to @john-preston.

john-preston commented 3 years ago

For Linux platforms without tray support I think the "Show tray icon" option indeed could be replaced with "Keep running in the background", disabled by default.

dancojocaru2000 commented 3 years ago

Hooray!

After all, at the moment "Show tray icon" serves the same purpose. When it's on, Telegram runs in the background, and when it's off it doesn't.

I don't understand why @ilya-fedin disliked this, since replacing it with "Keep running in the background" will just make the feature work on all environments. However, I will stop commenting on this to not do useless drama.

I really hope this will happen and I can't wait for it.

After this will happen, 90% of this issue will be solved. The other 10% is hiding the icon on environments with tray support, but I think it's reasonable for the environment to provide support for this in the same way that Windows does, so I won't expect that from Telegram.

Windows Settings allowing to choose which tray icons to show

john-preston commented 3 years ago

@dancojocaru2000 It is a bit more complex, than changing the text, because the defaults differ with and without tray icon and should be changed independently. But yes, it could be done.

dancojocaru2000 commented 3 years ago

I do imagine it's more difficult because of having the defaults differ based on the tray existing on the system or not. I did try learning QT and I didn't manage to go too far, so I don't take work that others in open source projects do for granted and I apologize that I can't help with implementing this. That being said, I would be very grateful if this will be added.

mipro98 commented 3 years ago

Well, renaming the option to "run in the background" sounds like a very good idea to me since basically that's the purpose the option has, it's not about some icon showing in a tray bar but about keeping the program alive in the background. The icon is just an indicator for that behavior. And since one can already see in the notification center when receiving a new message I personally see no requirement of having an additional redundant indicator notifying me about new messages. But it's a personal thing and if someone would like to have both he should be able to, but as @dancojocaru2000 said, it makes no sense tying background running functionality to an icon.

soloturn commented 3 years ago

i created a ticket in gnome-shell so gnome does not call "minimize" in future when a window should be hidden, resp be in the background: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4088

i created a ticket for electron, to better document that there are desktop environments without tray, and an application should not rely on it: https://github.com/electron/electron/issues/28713 .

p-mitana commented 3 years ago

I'll raise this topic again: I'm currently playing around with the 'trayless' GNOME – actually Ubuntu with turned off Ubuntu specific GNOME shell extensions.

Currently when there is no tray, I can't even see the tray icon related option, thus cannot make Telegram work in background.

Actually I would like to have this option, so that there even without tray I can receive notification even while the window is closed and not visible in Activities overview.

Have any decisions been made on this? My suggestion is a checkbox "keep running after window is closed" disabled by deafult (so that until you manually turn it on, application won't stay after you think you closed it). I also suggest that this checkbox is visible only on trayless environments (mutually exclusive with "show icon in tray" checkbox).

Then all of us can select what we wish, and people having trays won't even spot any difference.

ilya-fedin commented 3 years ago

Have any decisions been made on this?

There's no interest in implementing this from me nor looks like from @john-preston. We (@john-preston and me) think any mature desktop environment must have tray support. If GNOME dropped that support, well, it's their problem. You can either change DE to a normal one, install an extension or suffer.

If you think that non-GNOME applications will follow GNOME's HIG then you're wrong.

p-mitana commented 3 years ago

If GNOME dropped that support, well, it's their problem. You can either change DE to a normal one, install an extension or suffer.

Well… GNOME is actually a highly popular DE, so it's just telling people using it "well that's your problem". Although I appreciate the developers' work – I guess partially or fully done for free in their free time – I do not see such message as a friendly approach towards people.

For now I'll simply have to keep Ubuntu's indicator shell extension on, however I would like not to need it just to make Telegram operate in background.

If there is no tray icon, how does the app detect if it needs to minimize or quit? How does the user quit the app?

Good question. How about a quit button in the bottom right corner of a sidebar (next to the version number)?

janopae commented 3 years ago

If every DE that has no system tray icons is considered broken - how come Telegram supports running in the background on iOS and Android?

Aokromes commented 3 years ago

If every DE that has no system tray icons is considered broken - how come Telegram supports running in the background on iOS and Android?

totally diferent applications.

ilya-fedin commented 3 years ago

If every DE that has no system tray icons is considered broken - how come Telegram supports running in the background on iOS and Android?

tdesktop doesn't support iOS/Android...

hmlendea commented 3 years ago

It's not just about GNOME's HIG, it's also about the users' wishes. I couldn't care less about what GNOME's HIG says or what frustrations devs have with it, because I'm just an end user. But I do care about not having a Telegram icon on my bar all the time when I already know the app is running (or at least should be). It takes up space and it's redundant. I like my screen as clean as possible. And it doesn't even matter if it's GNOME Shell, running trayless in the background should be a possibility on any DE.

In my opinion tray icons are just as bad as persistent notifications on Android that are used just to keep an app running in the background.

As @mipro98 said the purpose is to keep the app in the background, the tray icon is a visual indication of that. If users don't need that indicator, it would be nice for the app to allow them to still use that functionality without it, if they so wish, rather than remove that whole feature just because of as small a detail as an icon.

ilya-fedin commented 3 years ago

It's not just about GNOME's HIG, it's also about the users' wishes.

I don't think running without any sign of presence is a good idea and users aren't always right (that's why there are designers and UX engineers). Personally I still have no plan to implement this (as I don't think this feature is a good idea), but I implemented #1161 via #16946. I hope it will fit at least some of people here.

dancojocaru2000 commented 3 years ago

users aren't always right

Perhaps, but

(that's why there are designers and UX engineers)

...designs and guidelines change and adapt over time. Designers and UX engineers do exist for a reason, but as time goes on, methods change as well.

Just because Windows 95's HIG said "tray is love, tray is life", it doesn't mean that's the definitive way to have a user interface.

In the same way Telegram for Android, Telegram for iOS or Unigram show no indication that they're running yet they still send me notifications, I'd like to have the same experience on Linux.

After all, services/daemons are a thing, and they don't show when they're running.

While the user is not always right, there's a difference between "I want this button to be upside down" and then realizing "now the text is upside down and I can't read it; this is not what I wanted", and "this behavior already exists on several other operating systems and several other applications on the current operating system, I would like this application to have the same behavior too".

Personally I still have no plan to implement this (as I don't think this feature is a good idea)

Fair enough.

I'm curious: if someone implements it and makes a PR, will it be accepted?

but I implemented #1161 via #16946. I hope it will fit at least some of people here.

Decent?

At least with that I can't accidentally shut down Telegram completely by reflex and then wonder why I'm missing all the messages.

The disadvantage would be that the window wouldn't be closed, but minimized, so it would still show up in Alt+Tab, workspace manager, and so on.

ilya-fedin commented 3 years ago

I'm curious: if someone implements it and makes a PR, will it be accepted?

Well, if @john-preston haven't changed his opinion after close to taskbar option then yes. He could think two options is too much, though.

stale[bot] commented 2 years ago

Hey there!

This issue was inactive for a long time and will be automatically closed in 30 days if there isn't any further activity. We therefore assume that the user has lost interest or resolved the problem on their own.

Don't worry though; if this is an error, let us know with a comment and we'll be happy to reopen the issue.

Thanks!

dancojocaru2000 commented 2 years ago

Well, interest isn't lost. It's one of those problems that's annoying, but not annoying enough to look into other software.

I'd still much appreciate having this annoyance fixed though.

github-actions[bot] commented 2 years ago

Hey there!

This issue was inactive for a long time and will be automatically closed in 30 days if there isn't any further activity. We therefore assume that the user has lost interest or resolved the problem on their own.

Don't worry though; if this is an error, let us know with a comment and we'll be happy to reopen the issue.

Thanks!

ts14ic commented 1 year ago

tl;dr:

a lot of the discussion here delved into "tray bad", so here's my "tray good".

long version:

Finally, setting the "GNOME [and perhaps Apple] decisions bad" aside, the application running in the background is totally unrelated functionally to having a tray icon. Therefore, pointlessly binding the two together is 100% a Telegram Desktop problem, not a GNOME problem.

After all, at the moment "Show tray icon" serves the same purpose. When it's on, Telegram runs in the background, and when it's off it doesn't.

Well, renaming the option to "run in the background" sounds like a very good idea to me since basically that's the purpose the option has, it's not about some icon showing in a tray bar but about keeping the program alive in the background.

Maybe the tray icon is equal to background for you. Perhaps because you don't have a tray and don't understand what other possibilities it offers. In almost all apps that support tray for me, the tray was never about "background".

Some other notes:

Maybe you don't care about any of that, because you don't have a tray, but you still want a background running app. Which is a valid wish, orthogonal to whether the tray is enabled or not. But a lot of the discussion here delved into "tray bad", so here's my "tray good". And I fully concur with it's a Gnome problem, because Gnome has removed support for all of that and offers zero alternatives.

ilya-fedin commented 1 year ago
  • And I don't care about the Unity's "lib-indicator", because it merges all apps into one indicator, which is too generic to be of any use.

Are you sure? Unity's tray is no different from the others, i.e. you see all the icons right away

ts14ic commented 1 year ago
  • And I don't care about the Unity's "lib-indicator", because it merges all apps into one indicator, which is too generic to be of any use.

Are you sure? Unity's tray is no different from the others, i.e. you see all the icons right away

I mean that thingy where instead of app specific icons, it shows one generic message icon, and you have to open that one first, to see the state of other apps. I thought they called it "lib-indicator", as opposed to tray. And I remember there were some UX philosophy behind, about merging similar tray icons into one. But I don't remember where I last saw it. I remember xUbuntu has it by default instead of the tray, and I keep removing it and adding the proper tray plugin instead.

ilya-fedin commented 1 year ago

@Aokromes I believe this issue is sitting here for too long, it's clear no one is going to contribute on it, so let's close it with wontfix and move on.

If anyone still wants to contribute on it, I see no problem here, just no need to take space in an already big list of issues with an issue no one has a plan to implement.

dancojocaru2000 commented 1 year ago

@ilya-fedin If somebody does contribute, will the PR even be accepted?

ilya-fedin commented 1 year ago

I don't know, ask @john-preston

ilya-fedin commented 1 year ago

I mean that thingy where instead of app specific icons, it shows one generic message icon, and you have to open that one first, to see the state of other apps. I thought they called it "lib-indicator", as opposed to tray. And I remember there were some UX philosophy behind, about merging similar tray icons into one.

I think you're messing up, libindicator-based tray is the same as others, the only difference is it supports only a menu on click (i.e. no click-to-focus behavior).

ts14ic commented 1 year ago

I mean that thingy where instead of app specific icons, it shows one generic message icon, and you have to open that one first, to see the state of other apps. I thought they called it "lib-indicator", as opposed to tray. And I remember there were some UX philosophy behind, about merging similar tray icons into one.

I think you're messing up, libindicator-based tray is the same as others, the only difference is it supports only a menu on click (i.e. no click-to-focus behavior).

Yep, that's also one of the reasons I kept replacing it with a normal tray. What I described is this very old thing, https://ubuntu-mate.community/t/what-functionality-is-provided-by-indicator-messages-in-um-18-04-out-the-box/17627 and it had "indicator" in its name, so maybe that's why I got the naming confused. It's called "application indicator" looks like. I do remember that indicators such as that were replaced at the same time, as the movement to remove tray. And here's the philosophy about it (specifically the part where they suggest to remove the tray): https://wiki.ubuntu.com/DesktopExperienceTeam/ApplicationIndicators#Proposed_changes

libappindicator is a new library introduced to help with application side changes; it does register icons and menus and internally uses dbusmenu to publish context menus over dbus. While its a new library for the Gnome desktop, it is based on a protocol (the "signaling protocol" part above) that was designed in the KDE project to renovate the systray protocol. libappindicator adopts and extends this protocol, and connects it with dbusmenu to provide the full set of service that an application will require to migrate its code

ilya-fedin commented 1 year ago

indicator-messages just sniffs session bus for org.freedesktop.Notifications messages :D

ts14ic commented 1 year ago

Well, again, I was never too interested about how it's implemented. Point being, this is where the movement to remove tray started in Linuxes. Unity and Gnome (don't know who started it first). They also mention the libappindicator library as the one dedicated to help with this. No idea if libappindicator and just lib-indicator are the same thing.

That article also links to the design guidelines: https://wiki.ubuntu.com/CustomStatusMenuDesignGuidelines The gist of which is - don't put icons in tray, reuse the generic unity indicator, because it looks stylish and symbolic icons are for the weak.