I am running Ubuntu 18.04 with two monitors.
I use the Atom IDE with the atom-python-run package to run the command
python3 {filename}
at the push of a button. This opens a new terminal window. However the window does not have focus and is buried under all other windows, forcing me to alt-tab to it.
How do I force the newly opened terminal to have focus?
I tried using dconf-editor
to set the focus-new-windows setting in org.gnome.desktop.wm.preferences to strict, but it did not solve the issue.
In general, you need to install an extension to eliminate the behavior in gnome-shell, where gnome displays a "Window is ready" notification rather than giving the new window focus. The extension "Noannoyance" appears to be the best maintained, but alternatively "Steal My Focus" or "Focus my window" probably still work fine.
Updating the Atom package
autocomplete-clang
instantly fixed the problem. I have no words.NoAnnoyance or Steal my focus do not work perfectly - when I open another Libre Office window, it does not get focused. I wrote a script which solves this. With this script running, the focusing works as I imagine.
Prerequisite:
wmctrl
Startup script:
sh -c "sleep 1; focus &"
File
/usr/local/bin/focus
:The exclusion of those window names from focusing fixes unwanted behavior when these windows were incorrectly given focus after closing a window instead of returning focus to the previously focused window.