46

I've been using Gnome Shell with Ubuntu for few days now and have experienced really annoying behaviour with new windows.

Sometimes when I use another window and press e.g. Alt+Ctrl +T to open new terminal window, the new window is not brought to the front. Instead I get a "New terminal window is ready to use" notification.

A similar problem occurs with the with Pidgin being integrated with Gnome Shell (via extension). When I get a new message, a notification pops up, but the window does not show. I need to either Alt+Tab it or click the notification to see the new message.

Is there any way to have new windows being always brought to front, and remove those annoying "Window is ready" notifications?

EDIT: gconftool-2 --search-key focus_new_windows (as requested by severin):

 /schemas/apps/metacity/general/focus_new_windows = Schema (type: `string' list_type: '*invalid*' car_type: '*invalid*' cdr_type: '*invalid*' locale: `C')
 /apps/metacity/general/focus_new_windows = smart
5
  • 6
    There is a good reason why Gnome shows that "Window is ready" notification when a new window is opened without getting focus automatically. It is a important accessibility feature. For the blind and other visually impaired users like me it is important to get notified if a window without focus is opened because otherwise it would be impossible to know if the window really was not opened or not. If a new window does not get focus automatically then user must be notified so that users knows that the window opened. Screen reader like Orca speaks those notifications.
    – miksuh
    Commented Nov 7, 2017 at 14:02
  • In Debian v3.16, Gnome 3 I found this focus_new_windows setting in org.gnome.desktop.wm.preferences Commented Mar 9, 2018 at 9:40
  • if a new window gets focus automatically (especially with a shell) while I am typing stuff, I get pretty angry… also think about potential security consequences Commented Mar 5, 2019 at 15:22
  • 1
    "There is a good reason" ? no. There is no good reason to make a system less usable and less secure. This is a result of a mistake that should be corrected. At least the ability to disable this bug should be put at the hands of the user.
    – QT-1
    Commented Jan 6, 2020 at 10:40
  • There is a similar question on AskUbuntu with more answers: askubuntu.com/q/80969/2355
    – Flimm
    Commented Nov 4, 2023 at 7:20

16 Answers 16

18

GNOME extension: "Steal My Focus"

There is an extension for Gnome 3 called "steal my focus" by sstent.

https://extensions.gnome.org/extension/234/steal-my-focus/

It solves the exact problem you're having.

9
  • doesn't work for me. I noticed that I'm having this problem only on my external monitor. On the laptop display the window comes in front. Commented Jul 18, 2014 at 15:38
  • A great extension!
    – qed
    Commented Sep 29, 2014 at 0:01
  • 1
    Doesn't work on GNOME 3.22.2 (Fedora 25)
    – l0b0
    Commented Feb 6, 2017 at 10:47
  • 3
    extensions.gnome.org/extension/1236/noannoyance is the more up to date option.
    – lkraav
    Commented Nov 25, 2018 at 12:35
  • 1
    @lkraav I converted your comment to an answer, I hope you don't mind.
    – Flimm
    Commented Jul 16, 2020 at 8:20
15

On Ubuntu 20.04 without installing anything you can use these 2 commands in a Terminal as a workaround:

gsettings set org.gnome.desktop.wm.preferences auto-raise 'true'

gsettings set org.gnome.desktop.wm.preferences focus-new-windows 'strict'

No need of extensions or additional Applications.

5
  • 4
    Should be focus-new-windows 'smart' so that windows opened via Terminal can gain focus immediately. With 'strict', Terminal opens windows in the background with a notification.
    – TalkLittle
    Commented Aug 23, 2021 at 7:28
  • 1
    even only auto-raise did the trick (to show immediately the "open file" dialog from my IDE)
    – lnksz
    Commented Jan 17, 2023 at 13:20
  • Did not work for me on RHEL 8 (GNOME 3.32.2). I tried strict and smart.
    – Timmmm
    Commented Oct 19, 2023 at 15:12
  • focus-new-windows should not be set to strict, but smart (the default value) to get the desired behaviour.
    – Flimm
    Commented Oct 20, 2023 at 15:56
  • Doesn't work in Ubuntu 23.10.
    – Daniel C
    Commented Apr 17 at 13:32
11
+100

You can try setting focus_new_windows from smart to strict. You can either use gconf-editor and go to /apps/metacity/general and change the value of focus_new_windows from smart to strict, like here:enter image description here

Or you can use the command line:

gconftool-2 --set /apps/metacity/general/focus_new_windows --type string strict

If that still doesn't help, you can also change auto_raise_delay from 1000 to 0 in aforementioned gconf-editor (see screenshot).

See also here.

4
  • 4
    But the long description given for focus_new_windows key says "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." But we want the opposite . Isnt it ? We want to give focus for newly launched applications. How to do that?
    – mac
    Commented Dec 22, 2011 at 9:39
  • 7
    Running that command-line had no effect for me Commented Aug 8, 2013 at 17:24
  • 4
    Also had no effect for me (I have it set both to strict and the auto_raise_delay to 0). Commented Jul 18, 2014 at 15:19
  • gconf-editor does not exist on Ubuntu 23.10, and neither does gconftool-2
    – Flimm
    Commented Oct 20, 2023 at 15:54
3
  1. Go to System > Preferences > CompizConfig Settings Manager > General Options (under General) > Focus & Raise Behaviour,
  2. Clear Focus Prevention Windows field.

References: Compiz General Options, Compiz Window Matching.

3

GNOME extension: "NoAnnoyance"

Try installing and activating this GNOME extension called NoAnnoyance by sindex:

The GitHub repo seems more up-to-date than some of the answers listed here.

2
  • This is the only option that worked for me. I thought you only needed 3rd party apps to fix idiotic UX decisions on Mac? :-D
    – Timmmm
    Commented Oct 19, 2023 at 15:19
  • As of writing, this extension does not support GNOME versions newer than GNOME 43, so it won't work on Ubuntu 23.10.
    – Flimm
    Commented Oct 28, 2023 at 12:52
2

I dont think there is a setting to do this. I have been using gnome shell for a while now. You can install the "advanced settings extension" for gnome 3 which provides you with a few more settings. However, you cannot get the function you are looking for. I will search the net and come back to you.

2
  • Nope, as far as I'm concerned there is no way to do autofocussing a new window nor is there a way to remove the notifications.
    – Hannes
    Commented Nov 20, 2011 at 12:59
  • there is an extension for gnome which does that exact thing you're saying isn't possible. Have a look at my answer :)
    – Steiger
    Commented Aug 17, 2012 at 12:42
2

This can now be done within Tweak Tool which is included with Gnome Shell. You no longer need to use extensions or dconf-editor.

Under the "Windows" section, slide the switch over for "Automatically Raise Windows".

This setting will make windows popup in focus, and will also get rid of the "application is ready" notification.

enter image description here

EDIT: This option is missing in Ubuntu 17.10 and will hopefully be back in 18.04. As a temporary fix, you can try installing the following gnome extensions;

  • Noannoyance
  • Focus my window
  • Steal my focus

The above extension are available here : https://extensions.gnome.org/

5
  • 3
    This setting is absent on gnome-tweak-tool in Ubuntu 17.10 Commented Feb 28, 2018 at 3:52
  • @ChrisBillington Correct. The reasoning for the removal isn't clear. However, you can get these back by installing the Gnome extensions "NoAnnoyance" and "Focus my window". Hopefully they bring it back in 18.04. I usually only stick with LTS releases... Also as mentioned below, the extension "Steal my focus" may work for you.
    – Delorean
    Commented Mar 1, 2018 at 16:46
  • The setting is there in 19.10 but does not work
    – QT-1
    Commented Dec 17, 2019 at 9:09
  • 1
    The setting is absent in Ubuntu 20.04 LTS.
    – Flimm
    Commented Jul 16, 2020 at 8:11
  • Doesn't exist in Ubuntu 23.10.
    – Daniel C
    Commented Apr 17 at 13:31
2

The long term solution is for this bug to be fixed by the developers.

Here is a bug report that seems to be related:

https://bugs.launchpad.net/ubuntu/+source/gnome-shell/+bug/1825710

Maybe casting more votes will eventually help the solution..

1
  1. use gconf-editor
  2. go to /org/gnome/desktop/wm/preferences/focus-new-windows
  3. set property: "strict"
  4. apply changes

enter image description here

2
  • To install gconf-editor, run sudo apt install gconf-editor
    – Flimm
    Commented Jul 16, 2020 at 8:13
  • In Ubuntu 20.04, the path /org/gnome/desktop/wm/preferences/focus-new-windows does not exist.
    – Flimm
    Commented Jul 16, 2020 at 8:13
1

GNOME extension: Grand Theft Focus

There's another GNOME extension that address this problem. This one works on GNOME 45, which ships with Ubuntu 23.10.

https://extensions.gnome.org/extension/5410/grand-theft-focus/

0

You can modify this type of stuff with devilspie, which has a nice GUI frontend gdevilspie, which is in the repos.

0

Create a custom shortcut under your keyboard settings and use command:
xterm -e < terminalname >
or:
uxterm -e < terminalname >

Also if you get problems with "failed to execute session" you can always go a step further.

< terminalname > -e xterm -e < terminalname >

In my case:
xfce4-terminal -e xterm -e xfce4-terminal

This i kinda funny because in this way you use a native terminal to start the newer one.
And since the older don't have the preference to start in background
it will start the newer on top.

Clean and no need to install extensions.

0

OK, I've had this issue for many months. After going through all answers, I found nothing satisfactory, but some good pointers. And here's the full answer that solved my problem for Ubuntu 18.04: https://linuxconfig.org/how-to-install-gnome-shell-extensions-on-ubuntu-18-04-bionic-beaver-linux.

Step 1

Install Firefox Addon that makes it easy to install GNOME Shell extensions: https://addons.mozilla.org/en-US/firefox/addon/gnome-shell-integration/.

Step 2

Install the host connector that supports the addon:

sudo apt install chrome-gnome-shell

Step 3

Install this GNOME Shell extension: https://extensions.gnome.org/extension/1236/noannoyance/. You can install it from the web page, thanks to the Firefox extension.

0

For Ubuntu 20.04, the following has worked for me.

  1. Install the NoAnnoyance GNOME Shell Extension by entering in a terminal window

    sudo apt install gnome-shell-extension-no-annoyance

  2. Then launch GNOME Tweaks by entering in the terminal

    gnome-tweaks

  3. In Tweaks, make sure to enable Noannoyance under Extensions

1
  • That package does not exist in Ubuntu 23.10's repositories.
    – Flimm
    Commented Oct 20, 2023 at 15:52
0

GNOME extension: "NoAnnoyance v2"

"NoAnnoyance v2" by bjoerndaase is a fork of "NoAnnoyance", it's a separate GNOME extension, and is not merely the second version of "NoAnnoyance", despite the name. It removes the 'Window is ready' notification and puts the window into focus.

https://extensions.gnome.org/extension/2182/noannoyance/

1
  • Sadly, this extension does not currently support GNOME versions greater than 43. So it won't work on Ubuntu 23.10
    – Flimm
    Commented Oct 28, 2023 at 12:53
0

GNOME extension: "Window Is Ready - Notification Remover"

This extension by nunofarruca also removes the notification "Window is ready", and it works on GNOME 45, the version of GNOME that ships with Ubuntu 23.10.

https://extensions.gnome.org/extension/1007/window-is-ready-notification-remover/

You must log in to answer this question.

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