Bug 336285

Summary: Bad usability of applets/panel configuration/widget explorer/activity switcher with "Focus follows mouse"
Product: [Plasma] plasmashell Reporter: Elias Probst <mail>
Component: generalAssignee: Sebastian Kügler <sebas>
Status: CONFIRMED ---    
Severity: normal CC: bharadwaj.raju777, bhush94, cspiegel, frapell, gandalflechner, gisk+kdebugs, kde, kde, kde, linus.kardell, mgraesslin, nate, notmart
Priority: NOR Keywords: usability
Version: master   
Target Milestone: 1.0   
Platform: Gentoo Packages   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=336134
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Elias Probst 2014-06-15 22:42:40 UTC
When using a focus policy which is not click-based (kcmshell5 kwinoptions → Focus → "Focus follows mouse" or higher) all extra panels such as a panel's configuration, the widget explorer or activity switcher are hardly usable.

e.g.:
# Widget Explorer
→ click on the "hamburger menu" in the lower right corner of the screen to open a panel's configuration
→ click "Add Widgets" in the panel configuration
→ move the mouse cursor to the left screen edge, but don't move it in a straight line, this will make the panel configuration lose its focus and it will disappear. Move it instead exactly along the panel, then move the mouse cursor upwards across the widget explorer

# Activity Switcher
→ Right click on desktop
→ Activities
→ Move the mouse to the activity switcher, but make sure not to hover across any other window (in case there's a vertically maximized window on the left side of the screen, it's completely impossible to reach the activity switcher as the window between the place where the desktop context menu was opened and where the activity switcher is shown will get the focus for a moment when moving across it, causing the activity switcher to disappear).

There are a lot of other scenarios which make these 3 panels (panel configuration, widget explorer, activity switcher) barely usable or completely unusable once the window focus policy is set to "Focus follows mouse" or something higher.

These panels should be sticky - similar to the way plasma popups can now be made sticky to no retract on focus loss - but should retract on a click somewhere else, not on a simple focus change.
Comment 1 Marco Martin 2014-06-16 12:45:36 UTC
should we watch the focus follows mouse setting  and make it close only with x button in that case?
Comment 2 Elias Probst 2014-06-16 15:37:07 UTC
(In reply to comment #1)
> should we watch the focus follows mouse setting  and make it close only with
> x button in that case?

Sounds good. This would improve the current situation greatly.

Being able to dismiss the panels through an explicit out-of-focus click somewhere else would be nice too, but I think that's probably a little harder to implement.
Comment 3 David Edmundson 2014-06-20 13:47:34 UTC
Marco's plan sounds good. Confirming.
Comment 4 Martin Flöser 2014-06-24 09:09:15 UTC
please provide output of qdbus org.kde.KWin /KWin supportInformation
Comment 5 Elias Probst 2014-06-24 10:48:54 UTC
I know what you're looking for :)

delayFocusInterval: 0

Still with the default of "300ms" this means one has to move the mouse in less than 1/3rd of a second from the right to the left edge - this will still confuse people unaware of the delay option why their panels sometimes simply disappear.
Comment 6 Martin Flöser 2014-06-24 11:49:06 UTC
> Still with the default of "300ms" this means one has to move the mouse in
> less than 1/3rd of a second from the right to the left edge - this will
> still confuse people unaware of the delay option why their panels sometimes
> simply disappear.

only if they move the mouse out of the window. As soon as they move in again everything is fine.

The big question here is whether we need to add specific code for the case of focus follows mouse given that:
a) the user changed to FFM deliberately (after all click-to-focus is default)
b) there is at the same KCM the option to set a delay
c) Focus (Strictly) Under Mouse cannot be worked around from Plasma at all
Comment 7 David Edmundson 2014-10-24 07:57:11 UTC
*** Bug 340280 has been marked as a duplicate of this bug. ***
Comment 8 David Edmundson 2015-11-29 14:54:29 UTC
*** Bug 356039 has been marked as a duplicate of this bug. ***
Comment 9 David Edmundson 2015-11-29 14:56:19 UTC
We shouldn't be having options that simly don't work.

Either I want to expose what we need from kwin so we can work round it.
Or I want the option removed.
Comment 10 Martin Flöser 2015-11-30 06:56:57 UTC
> Either I want to expose what we need from kwin so we can work round it.
> Or I want the option removed.

Obviously that won't help anything. This makes you work around the issue for KWin if KWin removed the option. But what if other window managers are used? So far Plasma doesn't enforce KWin, so you shouldn't assume that KWin is being used.

So the only relevant question is: how can Plasma detect that focus changed due to focus follows mouse. And that's actually relatively simple after thinking about it: Plasma needs to control the closing of the window. Let Plasma grab the mouse and explicitly close on click out side window. That way all the focus strategies of KWin get ignored.
Comment 11 David Edmundson 2015-11-30 07:05:40 UTC
>So far Plasma doesn't enforce KWin, so you shouldn't assume that KWin is being used.

I don't know about that. All the blur,  and panel autohide, and such are kwin specific. You just wrote an email about how we shouldn't be doing window positioning but using kwin specific API.

But mouse grabbing plan sounds like it's worth a shot. Thanks
Comment 12 Martin Flöser 2015-11-30 07:17:19 UTC
(In reply to David Edmundson from comment #11)
> >So far Plasma doesn't enforce KWin, so you shouldn't assume that KWin is being used.
> 
> I don't know about that. All the blur,  and panel autohide, and such are
> kwin specific. You just wrote an email about how we shouldn't be doing
> window positioning but using kwin specific API.

That's different: all those features like blur and panel autohide are optional. You lose some functionality if KWin is not used. Some for the moving of window: it will work with other WMs, just the animation is missing.

Now if you consider this bug to be fine with other WMs: then yes it's a solution. What I wanted to point out is that it's not a solution if you actually want to fix the bug, instead of working around it.

> 
> But mouse grabbing plan sounds like it's worth a shot. Thanks

Of course won't work on Wayland ;-) There we'll need a different solution which can be KWin specific (we have a new Focus preservation protection which could be used for it).
Comment 13 Jeremy Potter 2020-05-23 21:39:00 UTC
Any news on this? I use the activities system frequently and I've enabled "focus follows mouse" and this bug bothers me to no end.
Comment 14 Nate Graham 2021-03-11 18:37:38 UTC
*** Bug 363897 has been marked as a duplicate of this bug. ***
Comment 15 Nate Graham 2021-03-11 18:37:47 UTC
*** Bug 431585 has been marked as a duplicate of this bug. ***
Comment 16 Nate Graham 2021-03-11 18:38:10 UTC
*** Bug 422477 has been marked as a duplicate of this bug. ***
Comment 17 Nate Graham 2021-08-07 17:32:50 UTC
*** Bug 387231 has been marked as a duplicate of this bug. ***
Comment 18 Linus Kardell 2023-01-21 22:20:14 UTC
I feel like under Wayland, instead of the panels closing themselves on focus loss, they could indicate their desired behavior with a window class or hint, like xdg_popup or something similar, leaving it to the compositor to position them correctly and to dismiss them when when the user clicks elsewhere. The compositor would be aware of "Focus follows mouse", and could tell the difference between clicking and merely hovering over another window. Plasma would not need to care about focus at all. Of course, that may require some extension for it, if xdg_popup isn't enough.

Though I notice on Wayland, application context menus have this same issue, they close when hovering a different window, which they don't do on X11. How do context menus handle this on X11, and why can't Plasma panels do the same?