Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No way to prevent focus stealing #646

Open
lvandeve opened this issue Nov 8, 2022 · 5 comments
Open

No way to prevent focus stealing #646

lvandeve opened this issue Nov 8, 2022 · 5 comments

Comments

@lvandeve
Copy link

lvandeve commented Nov 8, 2022

 * muffin version: 5.4.7
 * Distribution: debian
 * Graphics hardware *and* driver used: nvidia, nvidia drivers
 * 64 bit

Issue

When using multiple desktops and an application wants attention, cinnamon/muffin will steal focus and may then also change your workspace to the workspace in which this application was.

There's no setting to disable this. Cinnamon used to have the setting "Prevent windows which require attention from stealing focus", but this setting was removed in: linuxmint/cinnamon@811a285

There doesn't seem to be any setting that replaces this removed setting, and the current behavior looks like it steals focus and switches workspace

Steps to reproduce

Use multiple workspaces in cinnamon. Have firefox with google calendar in one workspace, and have an event in it that triggers a notification in 1 minute.

Go to another workspace, and do something else like typing text in some text editor. Wait one minute. After 1 minute automatically the desktop shifts to the one with firefox to show the calendar notification.

Please note that firefox/calendar is just used as an example here, this applies to any window that requires attention and the ability to turn it off for all.

Expected behaviour

There is a setting to turn off the focus stealing, so the current window you're using does not lose focus, and your workspace stays on the current one and does not shift to a different workspace in which a window wants attention.

Other information

@mtwebster
Copy link
Member

Make sure you've enabled notifications for that site - click this:
image

If it says notifications are 'blocked', go into your firefox settings, to notification settings and set that site to 'allow':
image

@lvandeve
Copy link
Author

lvandeve commented Nov 8, 2022

Are you sure you mean "allow"? The goal is to prevent focus stealing, that's the opposite of allowing notifications, right?

To be clear, I'm requesting about getting the setting "Prevent windows which require attention from stealing focus", which was removed from cinnamon, back. Firefox was just an example here.

Changing settings in firefox won't bring back the ability in cinnamon to prevent windows from stealing focus. The active workspace is physically switching, with a shifting animation, to a different one that I'm currently working on. That's cinnamon or muffin doing this, Firefox settings won't change this right? and Firefox settings won't prevent other applications from causing this.

@mtwebster
Copy link
Member

That setting has been gone for a couple of versions now.

Setting the page to 'allow' lets it use native desktop notifications instead of just activating the window like it currently does.

You can remove 'firefox' from cinnamon's 'demands-attention-passthru-wm-classes' using the program 'dconf-editor':
image

This will stop the behavior you're seeing, but will expose another issue specific to firefox and a couple of other programs - sometimes newly launched firefox windows will not get immediate focus. I recommend just allowing desktop notifications for it.

It's not as simple as 'muffin is doing this'. Firefox is telling the display server (x server) that it wants to activate and get focus, the server tells muffin to activate and focus it. There is a standard with rules that programs and window managers are supposed to adhere to - but it's impossible to strictly enforce them, as programs can lie. For example, chromium's focus-grab isn't avoidable - no matter what I do that popup will make the window steal focus. All I can do there is enable notifications for that site.

@lvandeve
Copy link
Author

lvandeve commented Nov 9, 2022

Thanks for showing the demands-attention-passthru-wm-classes setting, I'll try it out and hope it'll work! I removed firefox from it, it still appears in the foreground when launching a new instance, not sure if that's a sign the setting may not be working...

About allowing notifications stopping window focus stealing: do you mean both firefox and chromium will, if you disallow notifications, not ignore the notification but instead use an even more intrusive (=automatically switching your workspace) way to show the notification?

About adhering to strict standard rules: is it at least possible to have user settings that allow the user to choose how to respond to the x server focus events, including e.g. a setting such as "don't switch workspace" or so? Thanks!

@mtwebster
Copy link
Member

Thanks for showing the demands-attention-passthru-wm-classes setting, I'll try it out and hope it'll work! I removed firefox from it, it still appears in the foreground when launching a new instance, not sure if that's a sign the setting may not be working...

I think it's usually when opening an additional window, but it's not an every time thing. Also, the 'grouped window list' applet should now notify you when that alarm goes off by flashing a temporary button in the list, but this isn't implemented (I realized this investigating this issue yesterday). The old window list does this correctly:
image

About allowing notifications stopping window focus stealing: do you mean both firefox and chromium will, if you disallow notifications, not ignore the notification but instead use an even more intrusive (=automatically switching your workspace) way to show the notification?

I'm pretty sure it's google calendar actually creating the notification (the popup message looks identical in both browsers), but yes it seems like the default behavior is grab focus for the browser window.

About adhering to strict standard rules: is it at least possible to have user settings that allow the user to choose how to respond to the x server focus events, including e.g. a setting such as "don't switch workspace" or so? Thanks!

The only option is to either bring you to the window, or to bring the window to you - "Bring windows that require attention to the current workspace" in Window preferences.

That's the whole problem here - we (in this case Cinnamon) can't tell if it's a legitimate user-initiated action or not - you could be working in a different workspace and click a hyperlink in a program or document, and you would typically want to automatically focus the browser. In any other situation it should simply tell Cinnamon 'hey when you've got a moment...' - the window list applet would flash a red button and if you click it, then it would switch workspaces and focus the window (this works for most other applications).

dry reading:
https://specifications.freedesktop.org/wm-spec/wm-spec-1.3.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants