On ubuntu 18.04.3, gsettings set org.gnome.desktop.wm.preferences focus-new-windows 'strict'
does not work if I open a CSV file from a web browser and an instance of LibreOffice is already open. Here is a step-by-step of what happens:
- I open an instance of
LibreOffice Calc Version: 6.0.7.3
(or any instance of LibreOffice [Writer|Calc|Draw|Impress]). - I open an instance of
firefox version 72.0.1 (64-bit)
. - In firefox, I load a web page that displays a link to a remote CSV file.
- I click on the link to download/open the CSV file.
A pop-up displays, prompting me to do either of the following:
Open with LibreOffic Calc (default)
Save File
the CSV file.
I select
Open with
and nothing seems to happen (WHY?). I expected an instance ofLibreOffice Calc
to become the active window over the Firefox web page I was on, but it did not.- I
[Alt]
+[Tab]
to the pre-existing open instance ofLibreOffice Calc
and there is a pop-up dialogue prompting me to indicate what encoding to open the CSV file in. So, it seems a new instance of LibreOffice Calc opened for the CSV, but it is tied to the other, pre-existing instance of LibreOffice and, therefore, it does NOT steal the focus.
However, if do NOT have any instance of LibreOffice open and go through steps 2 through 6, then the strict
does work (GOOD), meaning that an instance of LibreOffice Calc opens and steals focus.
So, why does strict
not work if an instance of LibreOffice is already open and I open another instance from a web browser?
UPDATE: 2020-01-23 I recently learned that the two modes for a window are:
raise
= raises a window to the top of a window stack (moves it to the front of the display)focus (or active)
= The window to which input is directed.
I also changed some gsettings and now it seems that gsettings set org.gnome.desktop.wm.preferences focus-new-windows 'strict'
does not behave according to my statements before this update. Instead, it seems that gsettings set org.gnome.desktop.wm.preferences focus-new-windows 'smart'
is the setting that raises and focuses the new window.
Here are my current gsettings...
$gsettings list-recursively | grep 'raise\|focus' | grep pref
org.gnome.desktop.wm.preferences focus-new-windows 'smart'
org.gnome.desktop.wm.preferences raise-on-click true
org.gnome.desktop.wm.preferences auto-raise true
org.gnome.desktop.wm.preferences focus-mode 'click'
And here are the results of my tests in terminal (opening gedit and also [Ctrl]
+[Alt]
+[T]
) and nautilus (opening a CSV file in the file manager) to know whether the respective new windows are raised and/or focused...
-if org.gnome.desktop.wm.focus-new-windows=smart
*In terminal, if there is NOT a pre-existing window, then the new window does raise (GOOD).
*In terminal, if there is NOT a pre-existing window, then the new window does focus (GOOD).
*In terminal, if there is a pre-existing window, then the new window does raise (GOOD).
*In terminal, if there is a pre-existing window, then the new window does focus (GOOD).
*In nautilus, if there is NOT a pre-existing window, then the new window does raise (GOOD).
*In nautilus, if there is NOT a pre-existing window, then the new window does focus (GOOD).
*In nautilus, if there is a pre-existing window, then the new window does raise (GOOD).
*In nautilus, if there is a pre-existing window, then the new window does NOT focus (BAD). <---- I WANT THIS TO FOCUS.
-if org.gnome.desktop.wm.focus-new-windows=strict
*In terminal, if there is NOT a pre-existing window, then the new window does NOT raise (BAD).
*In terminal, if there is NOT a pre-existing window, then the new window does NOT focus (BAD).
*In terminal, if there is a pre-existing window, then the new window does NOT raise (BAD).
*In terminal, if there is a pre-existing window, then the new window does NOT focus (BAD).
*In nautilus, if there is NOT a pre-existing window, then the new window does raise (GOOD).
*In nautilus, if there is NOT a pre-existing window, then the new window does focus (GOOD).
*In nautilus, if there is a pre-existing window, then the new window does raise (GOOD).
*In nautilus, if there is a pre-existing window, then the new window does NOT focus (BAD).
It seems that the smart
value gives the closest desired behavior, except if there is a pre-existing window (e.g., LibreOffice is already open), then the new window is raised (GOOD) but not focused (BAD). How can I focus the new window?
UPDATE 2020-02-22
One workaround that seems to work a little better is to make the following settings...
focus-mode='sloppy'
focus-new-windows='strict'
...Which will raise the window and, ONLY IF the mouse is already in the new window, then focus the window. The problem is if the window is raised and the mouse is not already in the new window, then the window is not focused.
The ideal situation would be for the new window to raise and focus, regardless of the mouse location.