4

I am running a terminal (call it the main terminal), I start a script to run some updates in the background on my system, when I do this I open a few other windows (terminals) to run tail -F some-file.log to have some visuals on what is going on. In the mean time I want to carry on doing my thing in the main terminal.

The problem is that each time my background task spawns a new terminal (gnome-terminal) it switches focus to that and interrupts my typing.

Is there some gnome-terminal option (or other method) to open a terminal but not switch focus to it?

2
  • You can use gonme feature Always on top on terminal by pressing Alt + space + t. And same shortcut for to remove Always on top, I think that's solution for you problem.
    – Dev
    Nov 21, 2019 at 9:45
  • @IamDev sorry I was not clear on that - the new terminals are being openeding via ascript so I want to do this with comman line not key presses Nov 21, 2019 at 12:12

1 Answer 1

7

Using This web page and my own research mainly based on the second solution provided on this page the key that you want to change is org.gnome.desktop.wm.preferences focus-new-windows which quoting from the gsettings description of that key:

This option provides additional control over how newly created windows get focus. It has two possible values; “smart” applies the user’s normal focus mode, and “strict” results in windows started from a terminal not being given focus.

As indicated in the description the default or normal window behaviour is "smart" but the setting to achieve what you want should be the "strict" setting. This change can be achieved by running the command gsettings set org.gnome.desktop.wm.preferences focus-new-windows 'strict'

3
  • oh that's great! - really works. It does have the side effect of ALL terminals from now on open in the back ground, but I can always script it back to the default when my script completes : ) Nov 21, 2019 at 12:13
  • small command.. lot valuable.. Great work!!!
    – PRATAP
    Nov 21, 2019 at 17:20
  • Thanks! This is exactly what I was looking for. "smart" mode was starting to drive me crazy.
    – DavidW
    Mar 4, 2021 at 8:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .