Re: stealing focus ... back, with a shortcut key?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



René J.V. Bertin posted on Fri, 15 Sep 2017 10:06:05 +0200 as excerpted:

> Hi,
> 
> All of ye people who use a focus-follows-mouse mode probably know the
> situation where for instance you click on a link in an email, the
> webbrowser comes to the foreground and takes focus. With KWin, you can
> mouve the mouse cursor all you want, as long as it remains in the
> original (email) window you won't get your focus back.
> 
> Sometimes that's exactly what your want, preferably without having to
> touch the mouse. Older WMs (often?)  had a "give focus to window under
> mouse" command which could be assigned a shortcut. I can't find one in
> KWin, so the best I can do in the example scenario is to use the global
> shortcut to push the window that stole my focus to the background.
> That's usually not what I want but at least my original window gets its
> focus again.
> 
> Any thoughts how to implement an easy and robust "focus under mouse now"
> shortcut feature, short of hacking it into the code?

AFAIK, kwin works a bit differently than that, allowing you to configure 
various focus related features both globally and per-window, and giving 
you per-window shortcut configurability, but not a generic "focus under 
mouse now" shortcut trigger.

Globally, there's the focus settings in kde system settings under 
workspace, window management, window behavior, focus tab, which can also 
be reached from (any) window menu, more actions, window manager settings, 
focus icon.  This lets you set focus follows mouse or focus strictly 
under mouse on a global level, along with the global focus stealing 
prevention level.

Additionally on a global level, there's the window actions settings, 
where you can configure the mouse button actions to various combinations 
of activate, raise, and pass click.  This is found in the same place as 
focus (above), but on the actions tab/icon instead.

Then, in addition to the global behavior, should it be found not to work 
as you'd like for individual windows, there's the kwin window rules, 
which let you configure behavior for individual windows or groups of 
windows, using window matching rules.  These settings are found in a 
similar location to the above, in kde system settings under window 
management, window rules, or from the window menu, more actions, window 
manager settings, window rules.

Among the window rule choices you have a shortcut option (arrangement and 
access tab of the edit window rules dialog), and various focus related 
rules, including accept focus (or not), focus stealing prevention, which 
adjusts the ability of the matching window itself to get focus, and focus 
protection, which adjusts the ability of other windows to steal focus 
from the matched window (the first works on how strongly the window 
itself wants to /get/ focus from other windows, the second works on how 
strongly it tries to /keep/ focus when other windows would otherwise take 
it).

Thus you have one of several ways to try to solve your problem.

If it's happening frequently, with many windows from different apps, you 
probably want to tweak your global focus follows mouse settings a bit.

If OTOH you're happy with the global settings and it's only specific 
windows you have problems with, you can create or adjust the window rules 
for one or more of them, either by adjusting the window that keeps losing 
focus to be a bit more assertive in retaining it (adjust focus protection 
on the window that keeps losing it), or by adjusting the window that 
keeps stealing focus to be a bit less assertive in demanding it (adjust 
focus stealing prevention on the window that keeps stealing it), or both.

Meanwhile, you do have the option of setting a window shortcut as well, 
also under window rules, but this will be a shortcut for that specific 
window or set of windows, depending on how strict your matching rules 
are, not a general shortcut to focus the window under the mouse once 
again.

Tho you do still have the option of setting a mouse action to refocus the 
window under the mouse again, with or without raising it, and with or 
without passing on the click, but that's still a mouse action, and you 
wanted a keyboard action, which I don't believe is directly configurable 
without patching the code yourself, because kwin focuses (pun originally 
accidental, but I like it! =;^) on preventing the problem, either 
globally or with specific window rules, instead of creating a keyboard 
shortcut for you to force focus back.

-- 
Duncan - List replies preferred.   No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master."  Richard Stallman




[Index of Archives]     [Trinity (TDE) Desktop Users]     [Fedora KDE]     [Fedora Desktop]     [Linux Kernel]     [Gimp]     [GIMP for Windows]     [Gnome]     [Yosemite Hiking]
  Powered by Linux