Ubuntu – Raise a window in 20.04 by clicking without clicking any of the buttons inside it (disable “click-through”)

20.04focusgnome-shellmouse

I would like to configure Ubuntu 20.04 (with Gnome shell) so that if I click a window which does not have focus, that click raises the window and does nothing else; in particular, that click to raise the window does not actually have an effect on the window (so I can click where a button is without activating that button). In the old days on the Mac this, clicks triggering actions in background windows, was called "click-through"; it's the default in GNOME Shell and I'd like to disable it.

The reason for this is that it is very hard to click on a window to raise it without also clicking on a button inside it!

A Nautilus window mostly covered by other windows

Almost all the visible areas of that Nautilus window are "active" areas in some way; clicking in that window to focus and raise it will also change the folder that it is currently displaying.

Some clarifications:

  1. This is not about the window focus mode (focus-follows-mouse or sloppy focus). Windows are focused by clicking on them; I do not want focus-follows-mouse, and it is not what this question is about.
  2. This is about raising a window and giving it the focus by clicking on the window. I can switch to that window in other ways (alt-tab, for example, or by choosing it from the Dock) but I want to be able to click on a window to focus it and raise it, exactly as I currently can, but I don't want to have to be careful to only click on an "inactive" area of that window to focus it.
  3. Yes, this problem is exacerbated by how there are not very many "inactive" areas in a window now that the title bar contains buttons. That's not what this question is about, and I am quite happy with the window containing many buttons, as long as I'm not forced to click one of them just in order to give the window focus.

I am informed by Mattias Wernér that Super+Click does exactly this (raises a window without the click being received by the window itself), which is great, and so it is possible that this question should be rephrased as "how do I make click on unfocused windows do what Super+click does?".

Best Answer

I think, short of a code change, you can't. I'm basing that on the following.

Judging by https://github.com/GNOME/gnome-tweaks/blob/35e3a5bebebb94a631e5ccbb7c29b2e482595a9a/gtweak/tweaks/tweak_group_windows.py#L20-L21 the setting is org.gnome.desktop.wm.preference, and the key is focus-mode. That lead to https://github.com/GNOME/gsettings-desktop-schemas/blob/2bb055b3c1b87e6db80d891bd788f1d4b9a62af3/schemas/org.gnome.desktop.wm.preferences.gschema.xml.in#L41-L50, which indicates there are only three possible values

“click” means windows must be clicked in order to focus them,

“sloppy” means windows are focused when the mouse enters the window, and

“mouse” means windows are focused when the mouse enters the window and unfocused when the mouse leaves the window.