mimbrero / whatsapp-desktop-linux

Unofficial WhatsApp Linux client built with Electron.
https://flathub.org/apps/details/io.github.mimbrero.WhatsAppDesktop
MIT License
82 stars 21 forks source link

Run in the background #22

Closed hmlendea closed 1 year ago

hmlendea commented 2 years ago

The application completely closes when I close its window.

Can it be made so that it continues to run in the background, like other chat apps do? This way I can continue receiving notifications when someone sends something.

So basically, just hide the window when closing it, but leave the application process running, just as if I were to press Ctrl+W

mimbrero commented 2 years ago

That's why I added an app indicator. There's an option to hide the window in the tray menu as, like you said, the CTRL+W shortcut :)

I decided the window close button to quit the app because some DEs like GNOME don't provide app indicators, thus the app shouldn't keep running in the background because there would be no way to close it.

If your DE supports tray icons or you have a GNOME extension for that, click the hide to tray menu item :)

hmlendea commented 2 years ago

I am indeed using GNOME.

While I understand why you did it this way, it is behaving differently from all other chat apps I have (Telegram, Signal, Discord, MS Teams and Slack), as well as other WhatsApp clients.

Can there be something like an argument for situations such as these? So when passing a certain CLI argument, the close button would behave exactly like a CTRL+W shortcut. In that case, it's fine not to be able to close the app (without manually killing the process) because it a conscious decision made by the user (and also not one that can be done by mistake, since it's a CLI argument).

hmlendea commented 2 years ago

Alternatively, a menu bar can be added so that there is a UI available to handle this and other settings (zoom, --start-hidden, etc), and to quit the application entirely. Though, if you choose this path, please make that menu bar hideable (like many apps do), since it would look very out of place on some DEs (e.g. on GNOME).

mimbrero commented 2 years ago

I'd like to add something like the second suggestion, but the actual web app also has settings, so having another UI or menu bar just for the desktop app settings would be weird (and even more with just 4 or 5 options), like it happens with other "WhatsApp for linux" applications.

Can there be something like an argument for situations such as these? So when passing a certain CLI argument, the close button would behave exactly like a CTRL+W shortcut. In that case, it's fine not to be able to close the app (without manually killing the process) because it a conscious decision made by the user (and also not one that can be done by mistake, since it's a CLI argument).

I think that this is the viable solution, although it's ugly, like the --start-hidden arg, but we can't do anything else. What do you think? :)

hmlendea commented 2 years ago

Well, personally I think anything's better than nothing :P especially since the argument won't get in anyone's way and is completely invisible. And if something better comes up later, it can replace it then. But at least we'll have the feature available in the meantime.

hmlendea commented 2 years ago

I decided the window close button to quit the app because some DEs like GNOME don't provide app indicators, thus the app shouldn't keep running in the background because there would be no way to close it.

I just got another idea. The close button can leave the process running, and if a shortcut can be added for killing it (e.g. CTRL+Q, like some text editors / IDEs have).

In my opinion it makes sense for the close button's default behaviour to only close the window but not the entire app (since it's a chat app), and have the full exit as a voluntary/bespoke action. The only problem with my suggestion is that the user will need to know about that keyboard shortcut beforehand (thou that's already also the case for CTRL+W too)

fieraoh commented 2 years ago

Why not just add an option within the settigns to specify whether the app should quit to tray or not, like in Telegram or Discord though app indicators are an ubuntu thing, many gnome users install the desktop app indicators extension, I am dependent on it personally,

if you think it does not make sense to add it to the app settings, you could alternatively add a popup window when the close button is pressed with "Do you want the app to keep running in the background" and a "Don't show again" check box.

AldoMX commented 2 years ago

How about adding an option to the tray menu?

hmlendea commented 2 years ago

How about adding an option to the tray menu?

* Minimize to tray

* [ ]  Close minimizes to tray

* Quit WhatsApp

The problem is that some environments don't have a tray at all, and the users won't be able to access that option. E.g. on GNOME you'd have to find and install an extension for tray icons, enable that option, then uninstall that extension. It would be very janky.

AldoMX commented 2 years ago

I don't see the problem:

In GNOME you don't have tray icon so you can't enable the option: close = closes the app

In other DEs or GNOME with Extensions you have the tray icon so you can enable the option: close = minimize to tray

jilv220 commented 2 years ago

I also would appreciate if the default behavior is "close to minimize to system tray", and the context menu provides the option "quit the app".

mimbrero commented 2 years ago

I don't see the problem:

In GNOME you don't have tray icon so you can't enable the option: close = closes the app

In other DEs or GNOME with Extensions you have the tray icon so you can enable the option: close = minimize to tray

Yeah, if the default behavior is that the close button closes the app, you can turn it off if you have access to the tray menu. Then I could also add the start hidden setting there.

rcastill commented 2 years ago

As @hmlendea pointed out :

I just got another idea. The close button can leave the process running, and if a shortcut can be added for killing it (e.g. CTRL+Q, like some text editors / IDEs have).

Other apps keep running in the background on window close, even gnome native apps e.g. Geary. They kill the background task with CTRL+Q

mimbrero commented 1 year ago

Just implemented :)