linuxmint / cinnamon-desktop

The cinnamon-desktop library (and common settings schemas for the cinnamon desktop)
GNU General Public License v2.0
187 stars 63 forks source link

Applications steal focus from one another #158

Closed php4fan closed 4 years ago

php4fan commented 4 years ago

I use Telegram Desktop https://desktop.telegram.org/

When in Cinnamon, if I have Telegram Desktop open and unfocused, every time I receive a message that triggers a notification, Telegram immediately steals focus from whatever other application had it.

Can you imagine: you are typing in a text editor, you are finishing a sentence, and suddenly Telegram pops up with a conversation because somebody has texted you (or to a group you are part of). Because it happens so quickly, before you have time to realize, you finish typing your setence and hit Enter, with the result that you send some random text to somebody.

This does not happen in Gnome, so it's not Telegram Desktop's fault. I guess it has to do with some kind of "event" with which the application notifies the system that something happened (not sure whether it's related to the fact it triggers a notification), and apparently Cinnamon wrongly takes that as "I need to give this application focus, stealing it from whoever has it".

Gnome (which notoriously sucks) used to be guilty of quite a lot of annoying focus stealing itself (I think they addressed some of it in Ubuntu 20.04 actually), but even Gnome didn't go so ridiculously far. The focus stealing there would usually happen when you lanched an application, then moved focus to another, and when the first was finished loading it would steal your focus (fundamentally wrong, annoying and avoidable, but kind of understandable).

But this is a whole other level. An application that just steals focus out of the blue, not as a consequence (not even delayed) of your action but completely on its own.

My workaround is to close the Telegram window rather than leaving it open and unfocused. It has an indicator in the system whateveritscalled bar, so I see the notifications. But it's not a good solution, as I have to remember to close it every time I want to move to something else.

This is especially ironic as, while I was writing this, Filezilla, unfocused, was uploading some files, and it opened a popup to prompt me whether or not to overwrite something, and that did not steal focus. That's correct (as long as it does something to somehow gets my attention, which I'm not sure it did), but the contraddiction between the two usecases is ironic, because a prompt for input that requires my answer to continue is more important than receiving a message from somebody (the consequences of focus stealing would be equally grave in both cases, because you never know what I might accidentally click or enter text into when you switch application before my nose).

mtwebster commented 4 years ago

Have you messed with these window settings at all?

image

php4fan commented 4 years ago

Have you messed with these window settings at all?

I have them just like in your screenshot.

The only one I touched is "Attach dialog windows to the parent window" which I turned off because it's demential (it either didn't exist or wasn't turned on in 16.04). That was before I installed Cinnamon.

Are these settings shared between Gnome and Cinnamon (meaning if I change them, and then log out and log in back with Gnome, will I find the settings the way I left them?) or does each have its own set of settings stored separately?

I'd expect the behavior of Telegram Desktop when it receive a message to not change regardless of "Prevent windows which require attention from stealing focus", because a messaging application getting a new message does not (i.e. shouldn't) require attention.

php4fan commented 4 years ago

Sorry, it turns out this is actually an issue in Telegram, and it was a coincidence that it appeared in a Telegram update at the same time I switched from Gnome to Cinnamon.

They introduced a new feature that purposefully steals focus when receiving a new message, and they thought it was a good idea to turn it on by default 🤦