I have a very annoying issue with the X11 app on OS X when using it to run things remotely over SSH. Every now and then (it's pretty regular, I'd say about each 1-2 minutes), the app I'm in loses focus, and the keyboard doesn't get sent to it anymore. However, X11 is still the foreground app.

Any ideas on what could be causing this and/or how to debug this?

  • What X11 app are you running? If you're using a window manager or desktop manager (ie. GNOME or KDE), do you have 'focus follows mouse' enabled? – EmmEff Mar 1 '13 at 23:58
  • @EmmEff: I am just running a bunch of gnome-terminal windows without any desktop managers. – houbysoft Mar 2 '13 at 0:27
  • @emmeff. This user is on OS X. There is no focus follows mouse feature. I use Terminal and have seen no such issues. Do these things you're doing require the X11 framework on OS X or can you get away with another terminal client? – bispymusic Mar 2 '13 at 2:48
  • @bispymusic: it's much more convenient doing it this way, because I can just ssh in once and then launch multiple terminals on the machine. To use Terminal.app for this I'd have to open multiple ssh connections – houbysoft Mar 2 '13 at 3:07
  • 2
    Possible duplicate of Is there a way to detect what program is stealing focus on my Mac? – kenorb May 28 '17 at 16:00

ssh: wrong culprit

I have this loss of focus on a variable frequency on XQuartz without any ssh command.

On the other hand I found a heavy relationship between this XQuartz loss of focus and the launch of:

Google Software Update (com.google.Keystone.Agent)

Analysis of this bug

2 tools help during this investigation:

  1. watch activations Python script

    2014-07-22 17:06:04.622 Python[95279:1307] activated Google Software Update (com.google.Keystone.Agent)
    2014-07-22 17:06:08.410 Python[95279:1307] activated loginwindow (com.apple.loginwindow)
  2. lastcomm | head -10 immediatly after the event →

    diskmanage -S      root     __         0.00 secs Tue Jul 22 17:06 (0:00:18.03)
    GoogleSoft -S      root     __         0.11 secs Tue Jul 22 17:06 (0:00:30.03)

I found this link: http://xquartz.macosforge.org/trac/ticket/133, which suggests that ARDAgent is the offending app, and that unchecking System Preferences -> Sharing -> Remote Management solves the problem.

I didn't have Remote Management switched on, but I did have File Sharing and Remote Login ticked. Switching off both (finally!) solved the problem of losing focus.

I haven't tested which of the two was causing the trouble.

You must log in to answer this question.

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