(In Xorg sessions only) apps launched from gnome shell do not get input focus

Bug #1817924 reported by Rachel Greenham
124
This bug affects 26 people
Affects Status Importance Assigned to Milestone
Mutter
Fix Released
Unknown
mutter (Ubuntu)
Fix Released
High
Daniel van Vugt
Disco
Fix Released
High
Daniel van Vugt

Bug Description

Observed on upgrading to disco-proposed today...

When launching an app from the dock or from the applications grid (so i believe it's a gnome-shell thing rather than a dock thing), the app opens, but does not get the input focus. You have to either click in the window, or clicking again on the icon of the running app in the dock works, to give it focus. An extra step my muscle memory isn't prepared for!

It seems like the sort of thing that might be an option rather than a bug, but if so, changing this behaviour back to its previous default is not at all obvious (I haven't found a way). So guessing it is a bug. NB: After launching an app this way, *no* window has focus. It is lost by the app that had it before, but not given to the newly started app.

ProblemType: Bug
DistroRelease: Ubuntu 19.04
Package: gnome-shell 3.31.90-1ubuntu1
ProcVersionSignature: Ubuntu 4.19.0-13.14-generic 4.19.20
Uname: Linux 4.19.0-13-generic x86_64
ApportVersion: 2.20.10-0ubuntu21
Architecture: amd64
CurrentDesktop: ubuntu:GNOME
Date: Wed Feb 27 15:53:07 2019
DisplayManager: gdm3
InstallationDate: Installed on 2018-09-11 (169 days ago)
InstallationMedia: Ubuntu 18.04 LTS "Bionic Beaver" - Alpha amd64 (20180214)
SourcePackage: gnome-shell
UpgradeStatus: Upgraded to disco on 2019-01-13 (44 days ago)

Related branches

Revision history for this message
Rachel Greenham (rachel-strangenoises) wrote :
Revision history for this message
Rachel Greenham (rachel-strangenoises) wrote :

NB: If you launch an app from a terminal, eg: gnome-calculator, it *does* then get the input focus; just not when launched from gnome-shell. That's why I didn't think it was a mutter bug.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Rachel,

I can't find any existing reports of this problem in Launchpad or upstream. So please report the bug to the Gnome developers here:

  https://gitlab.gnome.org/GNOME/gnome-shell/issues

and then tell us the new issue ID.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

But before you report the problem upstream, please try uninstalling your extensions:

b'org.gnome.shell' b'enabled-extensions' b"['<email address hidden>', '<email address hidden>', '<email address hidden>', '<email address hidden>', 'suspend-button@laserb', '<email address hidden>', '<email address hidden>', '<email address hidden>']"

and then verify the problem still happens.

Changed in gnome-shell (Ubuntu):
status: New → Incomplete
Revision history for this message
Rachel Greenham (rachel-strangenoises) wrote :

FYI problem remains with all those extensions removed.

BTW one does tend to notice it most with apps you type into. I first noticed with terminal, where I'm used to click, then start typing, and it's suddenly become click, click-again, then start typing. With an app you'd tend first to click into anyway, you're more likely to not notice it as the first click in an unfocused window is passed in.

(Along the way, minor invisible-to-user bug in that the setting org.gnome.shell.enabled-extensions retains entries for extensions that have been removed. Noticed first because I already didn't have dash-to-dock installed, but did until recently - when without -proposed enabled, the ubuntu dock extension stopped working (works again with -proposed enabled, i think the latest non-proposed version of ubuntu-dock secretly depends on the proposed gnome shell). Confirmed as all those listed extensions remained in that setting after removing all of them. I've just reset it to default value, empty array.)

Revision history for this message
Sebastien Bacher (seb128) wrote :

Not confirming here, with gedit added to the launcher, click on gedit, wait for the editor to open and typing does correctly input in the text widget

Revision history for this message
Rachel Greenham (rachel-strangenoises) wrote :

confirmed, gedit seems to be immune for some reason. pretty much anything else i tried is not; calculator, terminal, libreoffice, nautilus...

Revision history for this message
Rachel Greenham (rachel-strangenoises) wrote :

sublime text, slack also immune, firefox, thunderbird are not... so ok it's not universal but *lots* of apps are affected, and the pattern doesn't seem to be gnome/not-gnome.

Revision history for this message
Sebastien Bacher (seb128) wrote :

Weird, command line do get the focus here, the right thing to do would probably to report upstream in any case. Do you wait for the dialog to be displayed before starting to type or do you hit the keyboard while it's loading?

Revision history for this message
Rachel Greenham (rachel-strangenoises) wrote : Re: [Bug 1817924] Re: apps launched from gnome shell do not get input focus

it's not generally slow enough for the latter to be an issue. :-) Even
if I just go nice and slow. Click... window opens... it doesn't have
focus... It continues to not have focus until I do something that would
give it focus in the normal fashion, like clicking on it, clicking on
its dock icon now it's running, alt-tabbing to it...

Is this not happening for you in launching gnome-terminal? It's same for
me whether from dock, from app grid, from app grid's search field.
*Sometimes* it's been slow enough that I think I've seen the window have
focus for a tiny moment (the close-window icon in the titlebar is orange
for a moment) then it gets taken away. Usually it's too fast to see that
happen. BTW I've also tried it with *all* extensions removed, including
ubuntu-dock and appindicators and desktop-icons, by removing their
packages. No difference.

Revision history for this message
Rachel Greenham (rachel-strangenoises) wrote : Re: apps launched from gnome shell do not get input focus

Bug only affects X11 sessions.

I had a random urge to try out Wayland again. This issue does not arise in Wayland. Apps that were affected under X11 are taking input focus quite happily when launched from shell in Wayland.

Revision history for this message
bwat47 (bwat47) wrote :

I can re-create this 100% of the time launching gnome terminal in ubuntu 19.04 (with all updates installed as of this comment).

hit super key

search for 'terminal'

hit enter

gnome terminal opens, but un-focused.

This does not happen in ubuntu 18.10

Revision history for this message
bwat47 (bwat47) wrote :

Also, this is a fresh ubuntu 19.04 install from the daily ISO as of a few days ago. There have been 0 modifications to settings or installed software

Revision history for this message
Rachel Greenham (rachel-strangenoises) wrote :

i didn't freshly install to see it but i did create a new user, to be sure I had utterly default settings and yes, it's there right from the get-go with certain apps including terminal. but only in x11 (which of course *is* still the default in ubuntu). I switched to wayland and this problem went away. The remaining issues in wayland have proved insufficient to push me back to x11, so I've been able to stop caring about this. :-)

I guess people just aren't testing for x11 thoroughly any more.

Revision history for this message
bwat47 (bwat47) wrote :

I can also confirm, as rachel saw:

- This also happens with all gnome extensions disabled. I tested with the 'vanilla' gnome session.
- This does not happen under wayland
- Certain apps (e.g. Gedit), aren't effected.

Further to that, I also found that this only seems to happen in the first workspace. If I open some application in the first workspace, switch to a second workspace, and open gnome-terminal there, it does get focus.

I entered an upstream bug report: https://gitlab.gnome.org/GNOME/gnome-shell/issues/1043

tags: added: rls-dd-incoming
Changed in gnome-shell:
status: Unknown → New
Changed in gnome-shell:
status: New → Fix Released
bwat47 (bwat47)
Changed in gnome-shell:
status: Fix Released → Unknown
Changed in gnome-shell:
status: Unknown → New
Changed in gnome-shell (Ubuntu):
importance: Undecided → High
status: Incomplete → Confirmed
Will Cooke (willcooke)
tags: added: rls-dd-tracking
removed: rls-dd-incoming
Changed in gnome-shell (Ubuntu):
assignee: nobody → Daniel van Vugt (vanvugt)
Changed in gnome-shell:
status: New → Fix Released
Changed in gnome-shell:
status: Fix Released → Unknown
Changed in gnome-shell (Ubuntu):
status: Confirmed → Triaged
Changed in gnome-shell:
status: Unknown → New
bwat47 (bwat47)
Changed in gnome-shell:
status: New → Unknown
Changed in gnome-shell:
status: Unknown → New
affects: gnome-shell → mutter
Changed in mutter (Ubuntu):
status: New → Triaged
importance: Undecided → High
Changed in mutter (Ubuntu Disco):
assignee: nobody → Daniel van Vugt (vanvugt)
summary: - apps launched from gnome shell do not get input focus
+ (In Xorg sessions only) apps launched from gnome shell do not get input
+ focus
Changed in mutter (Ubuntu Disco):
status: Triaged → In Progress
no longer affects: gnome-shell (Ubuntu)
no longer affects: gnome-shell (Ubuntu Disco)
Revision history for this message
Daniel van Vugt (vanvugt) wrote :
tags: added: fixed-in-3.32.1 fixed-upstream
Changed in mutter:
status: New → Fix Released
Changed in mutter (Ubuntu Disco):
status: In Progress → Triaged
Revision history for this message
corrado venturini (corradoventu) wrote :

I launch terminal right clicking on desktop and selecting 'open in terminal' terminal get focus.
launch terminal from the dock terminal does NOT get focus.
orrado@corrado-p5-dd-0403:~$ inxi -S
System:
  Host: corrado-p5-dd-0403 Kernel: 5.0.0-8-generic x86_64 bits: 64
  Desktop: Gnome 3.32.0 Distro: Ubuntu 19.04 (Disco Dingo)
corrado@corrado-p5-dd-0403:~$

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Fix committed via Debian:

mutter (3.32.0+git20190410-1) experimental; urgency=medium

Changed in mutter (Ubuntu Disco):
status: Triaged → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package mutter - 3.32.0+git20190410-1ubuntu1

---------------
mutter (3.32.0+git20190410-1ubuntu1) disco; urgency=medium

  * Merge with debian git snapshot (LP: #1820542), remaining changes:
    + debian/control:
      - Update VCS flags to point to launchpad
      - Update maintainer to ubuntu
    + debian/gbp.conf: update branch to point to ubuntu/master
    + debian/patches/x11-Add-support-for-fractional-scaling-using-Randr.patch:
      - X11: Add support for fractional scaling using Randr
  * d/p/x11-Add-support-for-fractional-scaling-using-Randr.patch:
    - Refreshed.

 -- Marco Trevisan (Treviño) <email address hidden> Wed, 10 Apr 2019 20:12:29 -0500

Changed in mutter (Ubuntu Disco):
status: Fix Committed → Fix Released
Revision history for this message
Silvio Bierman (sbierman) wrote :

This bug also occurs in Wayland on a fresh Disco install. Opening Nautilus, Chromium, GEdit etc. does not properly set the focus to the newly opened windows.

I have the mutter version that should contain the fix:

root@mizuno:~# apt show mutter
Package: mutter
Version: 3.32.0+git20190410-1ubuntu1

so the fix does not seem to work on Wayland.

Revision history for this message
Silvio Bierman (sbierman) wrote :

I can now confirm it works in an X session though. So that part is fixed (although I never observed the bug there since I don't normally use X sessions).

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Wayland uses a different code path, so if you have any problems there then please open a new bug by running:

   ubuntu-bug gnome-shell

or

   ubuntu-bug mutter

Revision history for this message
Silvio Bierman (sbierman) wrote :

Since the bug seemed to have appeared in both environments at the same time I was not expecting two separate bugs. I have opened a new one against Gnome session: bug 1826176.

Revision history for this message
Yu Yang Lin Hou (laifs) wrote :

I encounter this bug in 23.04. On Files, right-click > Open in Terminal. First time, Terminal is in focus. Second time, Terminal is not in focus. I often open multiple terminal windows via Files, so this step is very noticeable for me. I've had this since 22.04, 22.10 and now 23.04. I'm running X11, Gnome 44.3.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

This bug has been closed for a few years so please open a new one by running:

  ubuntu-bug mutter

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.