Don't steal focus

Answered

Most every morning I sit down, start up my computer and start up all the programs I will be working with that day. I usually proceed to read my email first. Unfortunately, Intellij, like so many products, thinks it is the most important program ever and it must have my attention. So it steals focus and puts itself right in my face. However, I tend to have between 2-4 projects open in different windows. So it does this not only once but for each project.

IMO there is never a case for focus stealing. One could make a case for security software which may have a legitimate need to demand direct action. I also think such a case has never occurred in my life. I suppose any kind of alarm program could make the case. I still wouldn't agree, but I can see that some people would. However IntelliJ has no case whatsoever to steal focus. Focus should be on what I am focussed on. Just because I started the IDE does not mean I intend to work with it right now. Untill someone implements a telepathic focus algorithm programs should just start up in the background and let me continue with whatever I am doing.

97 comments
Comment actions Permalink

I've also here because of the email. But is it really coming from onmicrosoft? It looks like it passes both DMARC and SPF checks. Maybe a "fix" in YouTrack that went wrong? Should we create a issue for this issue being reported to non-related users? Or isn't that the issue?

 

Delivered-To: xxx@gmail.com
Received: by 10.12.142.143 with SMTP id x15csp1298371qvb;
        Mon, 23 Jan 2017 10:03:34 -0800 (PST)
X-Received: by 10.223.166.137 with SMTP id t9mr24584660wrc.15.1485194614300;
        Mon, 23 Jan 2017 10:03:34 -0800 (PST)
Return-Path: <no_reply@jetbrains.com>
Received: from mail1.intellij.net (mail1.intellij.net. [46.137.178.215])
        by mx.google.com with ESMTPS id i201si15187825wmf.9.2017.01.23.10.03.34
        for <xxx@gmail.com>
        (version=TLS1 cipher=AES128-SHA bits=128/128);
        Mon, 23 Jan 2017 10:03:34 -0800 (PST)
Received-SPF: pass (google.com: domain of no_reply@jetbrains.com designates 46.137.178.215 as permitted sender) client-ip=46.137.178.215;
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of no_reply@jetbrains.com designates 46.137.178.215 as permitted sender) smtp.mailfrom=no_reply@jetbrains.com;
       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=jetbrains.com
Received: (qmail 1577 invoked by uid 89); 23 Jan 2017 18:03:33 -0000
Received: from unknown (HELO 300fc4f14ba3) (no?reply@jetbrains.com@52.51.24.31)
  by ip-10-79-47-171.eu-west-1.compute.internal with ESMTPA; 23 Jan 2017 18:03:33 -0000
Date: Mon, 23 Jan 2017 21:03:33 +0300 (MSK)
From: Serge Travin <no_reply@jetbrains.com>
To: Jonas xxx <xxxx@gmail.com>
Message-ID: <25-550457@mail.intellij.net>
Subject: [YouTrack, Voted] Issue IDEA-106716: Don't steal focus
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="----=_Part_209856_361228240.1485194566508"
X-Charisma: 1=>2;5=0 
0
Comment actions Permalink

no idea how i got here but i agree, idea shouldn't steal the focus

0
Comment actions Permalink

It's noteworthy that this email came came to me from my jetbrains account.

I have my own domain, and I have it set to catch all emails coming in. When I signed up here I did as I do everywhere and signed up as the company/url I'm at. So here, I gave it jetbrains@<mydomain>, and that's the email addy that I received the message at today.

So, if this is the work of a hacker, then they're using jetbrains' internal DB. But I suspect this mass emailing was probably just the result of some errant code on their  (jetbrains) end.

0
Comment actions Permalink

Yeah, would like to know why I was notified of this issue...

0
Comment actions Permalink

Email does seem legitimate. It has been sent from JetBrains infrastructure. I think, it is some internal error; not a big deal, to be honest.

Delivered-To: sanitized@gmail.com
Received: by 10.107.144.137 with SMTP id s131csp1515522iod;
        Mon, 23 Jan 2017 10:13:28 -0800 (PST)
X-Received: by 10.223.154.114 with SMTP id z105mr24886591wrb.89.1485195208513;
        Mon, 23 Jan 2017 10:13:28 -0800 (PST)
Return-Path: <no_reply@jetbrains.com>
Received: from mail1.intellij.net (mail1.intellij.net. [46.137.178.215])
        by mx.google.com with ESMTPS id e72si15147086wma.116.2017.01.23.10.13.28
        for <sanitized@gmail.com>
        (version=TLS1 cipher=AES128-SHA bits=128/128);
        Mon, 23 Jan 2017 10:13:28 -0800 (PST)
Received-SPF: pass (google.com: domain of no_reply@jetbrains.com designates 46.137.178.215 as permitted sender) client-ip=46.137.178.215;
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of no_reply@jetbrains.com designates 46.137.178.215 as permitted sender) smtp.mailfrom=no_reply@jetbrains.com;
       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=jetbrains.com
Received: (qmail 19587 invoked by uid 89); 23 Jan 2017 18:13:27 -0000
Received: from unknown (HELO 300fc4f14ba3) (no?reply@jetbrains.com@52.51.24.31)
  by ip-10-79-47-171.eu-west-1.compute.internal with ESMTPA; 23 Jan 2017 18:13:27 -0000
Date: Mon, 23 Jan 2017 21:13:27 +0300 (MSK)
From: Serge Travin <no_reply@jetbrains.com>
To: Philipp <sanitized@gmail.com>
Message-ID: <25-550457@mail.intellij.net>
Subject: [YouTrack, Voted] Issue IDEA-106716: Don't steal focus
MIME-Version: 1.0
Content-Type: multipart/mixed;
0
Comment actions Permalink

I've found a nice workaround:
1. Start all apps you use at once
2. Go get a coffee
3. Come back to a fully initialized workplace.
:)

0
Comment actions Permalink

I also received a notification that I should not have. My email is hosted by Office 365 using a custom domain, so I may be able to get more detailed logs if you need them. I'm certain this is just a mistake, but in case it helps, here's the details (email redacted, you guys should have that in your system). Please contact me if there's something I need to know (a data breach, for example).

Received: from BN1PR05MB422.namprd05.prod.outlook.com (10.141.58.142) by
DM2PR05MB432.namprd05.prod.outlook.com (10.141.104.11) with Microsoft SMTP
Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id
15.1.874.6 via Mailbox Transport; Mon, 23 Jan 2017 17:47:36 +0000
Received: from SN1PR0501CA0042.namprd05.prod.outlook.com (10.163.126.180) by
BN1PR05MB422.namprd05.prod.outlook.com (10.141.58.142) with Microsoft SMTP
Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id
15.1.860.6; Mon, 23 Jan 2017 17:47:34 +0000
Received: from BN1BFFO11FD043.protection.gbl (2a01:111:f400:7c10::1:162) by
SN1PR0501CA0042.outlook.office365.com (2a01:111:e400:52fe::52) with Microsoft
SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.874.6 via Frontend
Transport; Mon, 23 Jan 2017 17:47:34 +0000
Authentication-Results: spf=pass (sender IP is 46.137.178.215)
smtp.mailfrom=jetbrains.com;s**********.***; dkim=none (message not signed)
header.d=none;s**********.***; dmarc=pass action=none
header.from=jetbrains.com;s**********.***; dkim=none (message not signed)
header.d=none;
Received-SPF: Pass (protection.outlook.com: domain of jetbrains.com designates
46.137.178.215 as permitted sender) receiver=protection.outlook.com;
client-ip=46.137.178.215; helo=mail1.intellij.net;
Received: from mail1.intellij.net (46.137.178.215) by
BN1BFFO11FD043.mail.protection.outlook.com (10.58.144.106) with Microsoft
SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id
15.1.803.8 via Frontend Transport; Mon, 23 Jan 2017 17:47:33 +0000
Received: (qmail 28978 invoked by uid 89); 23 Jan 2017 17:47:32 -0000
Received: from unknown (HELO 300fc4f14ba3) (no?reply@jetbrains.com@52.51.24.31)
by ip-10-79-47-171.eu-west-1.compute.internal with ESMTPA; 23 Jan 2017 17:47:32 -0000
Date: Mon, 23 Jan 2017 20:47:32 +0300
From: Serge Travin <no_reply@jetbrains.com>
To: David Schwartz <d***@s**********.***>
Message-ID: <25-550457@mail.intellij.net>

 

0
Comment actions Permalink

This is hilarious.  I am now getting an update every time someone votes on this issue.  I got 60+ emails today.  Haha.  What a great ticket for this bug.  

0
Comment actions Permalink

yes, it's annoying ...

0
Comment actions Permalink

For the meantime, maybe some (X11) workaround:

idea.sh "/path/to/project" nosplash & for i in {1,2}; do xdotool search --sync --onlyvisible --desktop 0 --class jetbrains-idea windowminimize; done

this attempts to minimize the `jetbrains-idea` class window twice: the project chooser and the actual editor.

0
Comment actions Permalink

Petr, the issue here isn't necessarily the splash screen. (Though it would be a step in the right direction.)

For Mac users, if you have a few projects open in IntelliJ or Clion, it will switch active screens for every single project. So basically, while booting into Mac, I will see my screen fly left and right for maybe 1-2 minutes while all the workspaces open up again. During this focus stealing, I can't really use my MacBook.

I know its possible to avoid doing this, as other applications don't steal focus when they restore their state after a new login.

0
Comment actions Permalink

Thanks Serge. Seems to be exactly what I meant. I'm glad some progress is being made with the experimental registry values in the last few weeks.

I'll keep watching IDEA-107264.

0
Comment actions Permalink

This has broken again after upgrading to 2018.3. Created an issue for that (https://youtrack.jetbrains.com/issue/WEB-36327).

0
Comment actions Permalink

On the same line about focus. I am not sure if it's just me or happens to someone else. I am running Idea on Mac OSX, I have open Files and a Terminal on Idea on a regular basis. Every time I click on the Terminal space to type command coming from any other application, for example web browser of finder itself. Idea focus on the open file instead of the clicked space "The Terminal", so of course I click and type immediately, finding that I have mistakenly wrote shell commands and enter commands on the open file. this is really annoying.

 

Best,

 

-Martin

0
Comment actions Permalink

Hello Martin,

Seems we have related issue on YouTrack: https://youtrack.jetbrains.com/issue/IDEA-172412

0
Comment actions Permalink

Jetbrains products take so long to load, and each time a new screen pops up, it steals focus! This makes me wait several minutes on my multitasking OS waiting for a single task to start. If I ctrl-tab away while Android Studio is loading and start to type into a terminal or something, JetBrains takes focus back while I'm typing and random actions happen in the IDE / startup screen.

There is _never_ a reason to steal focus. Ever. Please stop.

0
Comment actions Permalink

I've observed Intellij stealing focus MULTIPLE times when starting up. I'm running it on Ubuntu within VirtualBox within Windows.

I'll open Intellij first, then Firefox. I usually open all my websites (Gmail, Jira, Jenkins, etc) while Intellij loads. However, Intellij steals focus probably 3 or 4 times while it starts. So, it's best to just wait until it's done before I do anything else. SUPER annoying.

Axl Coding I'd like to make a reply to this statement: "If application doesn't try to gain focus as soon as it starts, it wouldn't be visible! So it will require a second user interaction to make it ready."

First of all, even if the program doesn't have focus, it will still be visible. It just might be hidden behind some other window if the user is multi-tasking, and this is what we want! Secondly, yes it should require a second interaction before it gets focus. As a user, you will click somewhere on the window when you're ready to start using it. Either to open a file, or select a cursor in a file to start editing, etc. Plus, there's no excuse to steal focus multiple times.

0
Comment actions Permalink

Hi James,

Nowadays we're working on https://youtrack.jetbrains.com/issue/IDEA-202805 and https://youtrack.jetbrains.com/issue/IDEA-209004. The fixes will be available in the following major updates (2020.2 or 2020.3).

0
Comment actions Permalink

Bradley,

We have similar issues under investigation: https://youtrack.jetbrains.com/issue/IDEA-248018, https://youtrack.jetbrains.com/issue/IDEA-247338. We'll try to fix them as soon as possible.

 

0
Comment actions Permalink

I was talking about mentione two tickets only. General focus stealing issue is a complex task and needs some core changes.

0
Comment actions Permalink

Hi Cristiadu,

It reminds of https://youtrack.jetbrains.com/issue/IDEA-221129 which has been fixed in 2020.2.1. Which IDE version do you use?

0
Comment actions Permalink

By the way, I also created http://youtrack.jetbrains.com/issue/IDEA-106794, which will be an improvement in focus loosing when opening IDEA

-1
Comment actions Permalink

Jasper, in the end I totally agree with you in which respects to what I'd love to see when I sit to develop. I just wanted to recall that seems a very hard decission to a develpment team to implement something that goes against absurd but "standarized" rules... I hope I'm wrong and they will consider your petition... hmmm... also hope they implement it configurable, maybe in the end I won't like it, never know ;)

About splash screen, well, just add that they are intended to accomplish a classical developing rule which says that the program can't last too much without making any visual signal of responsiveness to the user, so the splash has the mission to say "loading". Again, more trash to the power user. By the way, disabling splash is already supported, see answer to IDEA-106794.

I'll vote your issue. I also will create the ones I think are the friendliest way of splitting and solving the main usability problem, and suggest linking all together: respect OS flags to start minimized (focus steal ono start won't be a problem anymore) and stop stealing focus on project reopening.

Jasper, very nice to talk to you. best regards.

-1
Comment actions Permalink

Original topic problem was solved?

I cant reproduce it.

-1
Comment actions Permalink

I wouldn't necessarily characterize the application's behaviour as "stealing focus", but it is brighter than a thousand suns (and therefore it's futile to argue the opposite) that the focus behaves this way during the simultaneous startup of many applications. Have you ever been refocused to another app while typing the password and realized it only after pressing Enter?

Almost nobody would be surprised by the fact that by firing up some application the user expects that after it is started the focus belongs to none other than the very app that was just started. I share the pain of those who regularly fire up many applications at the same time (most likely when they start the work in the morning) and who, while doing so, struggle to perform any sort of meaningful action. During the startup sequence the focus jumps like mad from one app to the other at the most unexpected moments and the keystrokes together with the mouse clicks are being often mistakenly received by the application the user didn't intend to communicate with. The minority they are, when taking into account all of the computer users in the world, isn't precisely a minority when we focus (no pun intended) on some specific group of people like software developers.

I hypothesise that IntelliJ IDEA is in the most unfortunate position in this war for focus, because unlike most other apps (that I use), IntelliJ opens many windows and therefore it is very human to blame the most windowy application, while ignoring all the others that have exactly the same problem. (I could also maybe thought of Gimp, which might also open many windows, but since I'm not a graphic designer, startup of Gimp doesn't concern me so much).

The fix of course could be applied as a feature flag, because otherwise I imagine all those who expect the application to gain the focus when started would be worried when it would suddenly stop to be so. Permanently (ie. without the possibility to turn it on and off) setting the lack-of-focus-after-startup-situation would probably be even worse behaviour than the current one. It is hard to say whether the fix might be applied on the application level or on the OS level (eg. by providing a way to construct a command or a shortcut to the application that would instruct the X window system to somehow not give focus to application unless clicked by the user (BTW IMHO starting the application minimized is not a solution)).

J Marcus1943, maybe on OS X the problem is not so visible, I don't know, never used it. I encounter this annoyance while working on Linux. Every day.

Konstantin Komelin, I agree that the long startup time contributes to this issue, but I fail to see how this can be a major component of a robust fix. I don't think that faster loading would fix the issue, because if you have a large project, IMHO it might be very difficult (or impossible) to load it so fast that the focus problem would disappear. Also I don't think that the splash screen plays such an important role in the problem. Removing it might help a little, but with or without it, there are still windows of the various projects popping here and there and this is the period of the startup process when the jumping focus happens.

I would like to see the issue resolved as it takes a little bit of joy away from working with IntelliJ (probably not so much as to make me stop using the product, on the other hand you hardly ever know what will be the last straw). Life is full of sadness, but the artisans of JetBrains are the most probable crowd in the world to get it fixed. If they do, I would never be able to thank them sufficiently. Never.

However, should they come to conclusion that the jumping focus is of the low priority for them right now, I find the Jacek Gajek's coffee workaround to be the most beneficial and stressfree:
1. Start all apps you use at once
2. Go get a coffee
3. Come back to a fully initialized workplace.
https://intellij-support.jetbrains.com/hc/en-us/community/posts/206874755/comments/115000062344

-1
Comment actions Permalink

I think that keeping this beautyful thread alive is worth not fixing the Focus Theft.

-1
Comment actions Permalink

Hi. We have a feature request to allow turning splash screen off, please upvote:

https://youtrack.jetbrains.com/issue/IDEA-72664

-1
Comment actions Permalink

Fixed the stealing focus problem, but now when it starts it's no where to be found, e.g. hidden until I tab through the running applications and can select it. Which is even more aggravating than the steal focus at startup problem.

-1
Comment actions Permalink

Finally changed this, thanks JetBrains for listening to your users! :-)

-1

Please sign in to leave a comment.