Disable "new window becomes an active window"

Hello everyone,

Consider the following situation. One decided to run an application using its desktop shortcut. They selected the shortcut and pressed the Enter key. Right before the actual key pressing, a new window with, for instance, an OK/Cancel prompt from another application has appeared. Since the Enter key was pressed immediately after that, it is equivalent to pressing the OK button, I guess. The problem is that the user only wanted to run the shortcut, they haven't even read the prompt.

To summarize, when a new window appears, Esc/Enter key pressings are "redirected" to that window, and that might not be desired. If my previous example was not clear enough, consider one typed a command in a terminal window, and they are intended to press the Enter key to run the command. Then, a prompt window appears, and "consumes" that Enter key pressing.

How can I disable this? How can I force the current window to remain active when a new window appears? I have looked through the MATE Tweak settings, but unfortunately, haven't found anything appropriate. There is the "Do not auto-maximize new windows" option, but it is not exactly the same, and even if auto-maximized windows become active, that is not helpful, since I have this feature disabled.

1 Like

Hi :slight_smile:

I'm thinking about something that will not really keep focus on a window or loose it, but something that will open the popup window background.

You can achieve that with a software named devilspie.

Some exemple of usage

Do not hesitate to share the .ds conf files here for other users searching the same thing :slight_smile:

EDIT : You can probably use this setting :
wintype
Set the window type of the current window (returns boolean). Accepted values are: normal, dialog, menu, toolbar, splashscreen, utility, dock, desktop

and the ds config file to be looking like :

(if 
  (contains (wintype) "dialog")
  ( below)
)
3 Likes

I'll give you an example that's even less complicated and more likely than yours is: something like Update Manager popping up and stealing focus (the technical term for what you're describing) while you're typing in terminal, or Writer, etc, and stealing the Enter keypress from that, and doing something destructive. Fun times.

It's a terrible, broken, system, and a problem that was solved years ago (start the new window WITHOUT stealing focus, and indicate it on the taskbar). I'm sure SOME Linux DE handles it competently, but AFAIK GNOME never has.

So, olek's devilspie hack (which I like - nicely done!) is probably as good as you're going to get. Unfortunately it won't fix the Update Manager case, for example, but it will at least squash SOME of the cases.

2 Likes

Thank you for your answer. I tried

(below)

Unfortunately, it does not work. When I launch devilspie with the -d option, it prints "Setting below" to the console whenever a new window is created, but in fact, new windows are not shown below the existing ones, they appear the same way as before.

Maybe the originally posted syntax is missing something.

like from the simple we can find here

(if (is (window_name) "Maya") (below))

try like this :

(if (is (wintype) "dialog") (below))

I achieved it my side assuming that the problematic software is Zenity :


with a syntax made for Zenity only :
(if (is (window_class) "Zenity") (below))