Ubuntu QA:
BlogBrainstormPackage status
Log in
Ubuntu QA
The Ubuntu community has contributed 21986 ideas, 135057 comments, 2615221 votes
Idea sandbox Idea sandbox
Popular ideas Popular ideas
Ideas in development Ideas in development
Implemented ideas Implemented ideas
Idea #400: Prevent applications from stealing focus

bug This idea was marked as implemented the 19 February 12. Available starting Ubuntu 11.04 Natty Narwhal.
Written by smenjas the 29 Feb 08 at 01:34. Category: Usability. Related project: Nothing/Others. Status: Implemented
Rationale
I'm constantly frustrated by applications stealing my focus. There should be some way for me to ensure that when I begin typing somewhere, an overzealous application will never pop up in front of what I'm working on.


1950
votes
implemented
Selected solution (#1): Wait in background
Written by smenjas the 29 Feb 08 at 01:34.
If an application needs my attention, it's task bar button should simply pulse so I can turn my attention to it when I'm ready. Pidgin does this; why not everything else?
67
votes
implemented
Selected solution (#2): Unobtrusive notification
Written by smenjas the 5 Feb 09 at 09:59.
On Mac OS X, Growl provides a system-wide way to notify the user that something has happened without getting in the way. I'd very much like to see Ubuntu adopt something like that.
-32
votes
implemented
Selected solution (#3): Pressing Ctrl + launching app makes new window appear below currently active one
Written by runesvend the 29 Mar 09 at 17:40.
I'm imagining that pressing and holding a button (Control, Alt, or some other key of choice) while clicking on a program launcher icon in the panel, would make the window of the newly launched program appear _behind_ the currently active window. That way, I can quickly and easily press Alt+Tab to get to the newly opened application window when I wish to.
46
votes
implemented
Selected solution (#4): Polite Program Launch
Written by MathUHenry the 9 Jul 09 at 18:09.
When a program is launched, it is granted the "active window" status. I would like programs to not be able to grant themselves the "active window" status. When another program is selected, the loading program is moved to the background and should be forced to stay there (until the user selects it). When I press ctrl alt d, I want it to minimize until I select it.

In short, don't let programs bring themselves to the front (even update manager). If a program MUST notify me of something, then I think the new notification system is the coolest/most-convenient-ever way to do it.
-5
votes
implemented
Selected solution (#5): user controled windows
Written by pererik87 the 6 Jan 10 at 09:44.
The "preload window" should set the order position and workspace, then the program should not be able to steal focus or change workspace any more after started. If a program does not have a preload screen and uses long time to start it should be given a container or something.

In other words: programs should be locked to the order and workspace they get when someone start them unless user changer the order.

Gimp is an example of a program that takes long time to start and then steals your focus, even if you change workspace and select unlimited of other windows.
11
votes
implemented
Selected solution (#6): Pop Under, Warning periods
Written by orblivion the 16 Sep 09 at 22:22.
1) More things should pop under. This could of course be annoying if you're trying to run a program and have to switch windows every time.

2) Warning periods. If things pop over, I need to have a warning. Maybe in Compiz, windows could fade in for a certain period of time (.5 to 1 seconds, user configured) without yet having focus. In Metacity, they could disable input controls for the same period. This interrupts what I'm doing, but at least I notice before I inadvertently do anything.

For notifications or dialogs, I think #1 would be just fine. I'll get to the window when I have a chance. #2 would be good for programs I deliberately open, or dialogs that really need my attention.
26
votes
implemented
Selected solution (#7): Highlight on Gnome Panel
Written by owenduffy the 3 Oct 09 at 14:44.
Why not prevent windows from stealing focus, but have their icons on the Gnome panel (or awn, or whatever) blink or otherwise make themselves conspicuous? That way the user is aware that another window requires attention, but doesn't have to deal with it immediately, either to respond to it or close/minimise it.
26
votes
implemented
Selected solution (#8): don't steal focus while typing
Written by xubaj the 10 Nov 09 at 12:38.
while typing, no window should be allowed to steal focus until the keyboard is unused for about 2 secs. instead they should pop-under.
0
votes
implemented
Selected solution (#9): highlight pop-up windows in background (extention to #3)
Written by xubaj the 10 Nov 09 at 12:44.
if windows want to pop-up and steal focus, they should be displayed highlighted in background (or very glassy in foreground), so you know that a window wants to get focus. but the windows stay in background until you stop typing. when you stop typing they all appear in there original order.
109
votes
implemented
Selected solution (#10): Improved Focus-Stealing Prevention
Written by lapgoat the 13 Oct 10 at 12:09.
The window manager should watch mouse movement and keyboard usage. If there has been a keystroke in the last second or the mouse pointer has moved more than a few pixels in the last half second, assume that the user may continue typing or click. Place the new popup at the lowest Z-level to minimize risk of accidentally clicking and retain keyboard focus on the current window.

If an application is in need of input but has been denied it, flash the task switcher or add an icon to the notification area to get the user's attention. If the application urgently needs attention, send a notification to via the selected preferred method (libnotify or such).

If there hasn't been any input in the above timeframes, the new window can be granted the ability to pop up at the top Z-level, but it should be denied keyboard focus until the user interacts with it.

If the user has requested an application window to open, the expected behavior is that the new window will come to the top and be given focus. Some heuristics should be developed to maximize the probability that this expected behavior occurs, otherwise the window manager becomes difficult to use.
-40
votes
implemented
Selected solution (#11): simple time based
Written by der_hede the 15 Oct 10 at 12:14.
There are many reasons why focus stealing is annoying. One is you have to find your old window if you do not want to use the new window directly.

The other is the group of simple popup windows asking you short questions or inform you about something.

While the first one is no problem, you still can switch to your desired window, the second one is very bad if you are writing a letter or something else.

Imagine the popup "Are you shure you want to do something [no][yes]" pops up while you are writing something and the default value you are accepting with [space] (an often pressed key in writings) is not the one you intentionally wanted to press...

For the later one there's a KISS solution: No one can react to any new windows in a certain time period. Lets say 1-2 Seconds. So there's simply no chance there is any usable input to such windows inside a 1-2 Seconds time frame from the creation of the window.

So one solution would be to simply ignore all new input to new windows for 1-2 Seconds.

This could be as simple as a default option for "Popup" Style Windows in GTK/Qt/etc.
23
votes
implemented
Selected solution (#12): Don't allow to steal focus
Written by Lachu the 16 Oct 10 at 13:54.
Instead of allowing to steal focus, only suggest user to switch onto new window or window asking for focus. Solution is already implemented in KDE SC - the task item will higlights, but we needs some think more visible.

I suggest to show transparent preview of window asking for focus in top-right corner of screen. Desktop environment will display this preview only, when keyboard/mouse are inactive for long period of time. Also, it will be displayed for few second after asking for focus.
10
votes
implemented
Selected solution (#13): Show on top, but don't give it focus
Written by Aielyn the 19 Oct 10 at 06:46.
It seems the problem is that you want to not lose the *focus* on the current window, but you also want to be able to quickly see and react to new windows that pop up.

Why not essentially push new windows to the top of the stack as far as display is concern, but keep the focus on the original window? Then, perhaps a time-based element could allow the system to automatically switch to the new window if no input is occurring within the set time. Another alternative would be to have it pushed to the top of the display stack, but after a set number of seconds, it would minimise (showing the minimise effect) and put a highlight on the tab for the new window.

This would be an option, of course, and the time-based element would be an option as well.
-1
votes
implemented
Selected solution (#14): z-level- and focus-policy module
Written by shadowentity the 28 Sep 11 at 09:31.
a plug-in interface to use a module that makes decisions about the z-level, focus and maybe even the workspace and/or window-size and/or orientation of the window that is about coming up.

a configurable default module should exist and be used by default to apply simple rulesets such as "never", "always", "only raise'", etc. and offer an option to eval a script function or something.

it would keep simple things simple and make complex things possible.
0
votes
implemented
Selected solution (#15): Already implemented: How to set in Compiz
Written by gaxi the 21 Oct 11 at 07:27.
CompizConfig Settings Manager > General > General Options > Focus & Raise Behaviour
Focus Prevention Level = "Very High"

For me this works perfectly, new windows do not steal my focus any more when typing.
I'm using 11.04

Attachments


Duplicates


Comments
Estesark wrote on the 29 Feb 08 at 01:41
I realise this isn't quite what you were looking for, but there is already a "no focus" option in Compiz Fusion. You can access it through CompizConfig Settings Manager > Window Management > Window Rules.

lcampagn wrote on the 29 Feb 08 at 02:06
Focus stealing prevention is built into KDE!

smenjas wrote on the 29 Feb 08 at 05:18
Estesark: I use Compiz on my home computer, and although I have that feature turned on I still find that applications steal my focus. Maybe I'm not doing it right.

Unfortunately that's not always an option. At work I cannot enable Compiz, I'm guessing because of video card issues.

This should be standard on all window managers. Otherwise they're not really managing my windows, they're letting my windows manage me!

cmr wrote on the 29 Feb 08 at 05:22
this is a major annoyance, especially for those of us who prefer sloppy focus. things are certainly far better on linux systems in general than on other deskops, but i still deal with unwanted focus ambushes on a daily basis.

in my opinion, no window should have keyboard focus unless 1) i manually move the mouse pointer into it or 2) it is the only window visible.

Miquelets wrote on the 29 Feb 08 at 15:37
Icewm is configurable

brettalton wrote on the 29 Feb 08 at 16:18
I attached my related ubuntuforums.org thread here: http://ubuntuforums.org/showthread.php?t=600050

kilps wrote on the 29 Feb 08 at 16:21
I was going to post this idea ... it is especially applicable with slow starting applications; and I have found myself typing a password into another application without realising it simply because focus is transferred but the window is not yet showing itself...

wolfwitch wrote on the 29 Feb 08 at 17:38
This is a big problem for me too- very annoying. Also- since Compiz doesn't work on my laptop (damn you ATI!), disabling it as-such is not an option.

salutis wrote on the 29 Feb 08 at 19:12
Perfect idea!

nathan_s wrote on the 29 Feb 08 at 22:05
Here's the Storm to port Growl (compatibility, so things like network notifications work across platforms): http://brainstorm.ubuntu.com/idea/1820/

rawsausage wrote on the 29 Feb 08 at 22:46
This is also a security issue. Think of typing a password while looking down to the keyboard. Whoops you wrote it into some idiotic javascript popup window and sent to millions of people.

Software stealing focus should be handled as critical security vulnerabilities. Always.

tremby wrote on the 1 Mar 08 at 01:01
i run two X displays. i generally don't have a problem with focus stealing on any one of the two, but an application on :0 finishing loading frequently steals focus from my terminal on :0.1, which is extremely irritating.

wolfier wrote on the 1 Mar 08 at 03:39
@rawsausage:
Cannot agree more!! Focus-stealing software is a critical security threat - whenever it's seen, fixing it should take the highEST priority over any non-critical-security bugfixes.

If I could vote only ONE idea up multiple times, this will get 9999 votes.

arbitrix wrote on the 1 Mar 08 at 07:34
Focus stealing is a big part of what makes Windows such a torture. It also is a security risk as per rawsausage above. Such a bug does not belong in Ubuntu.

This is also an issue with Windows system tray popups. Torture case:

1) You are reading a big PDF on-screen
2) you have your cursor in the bottom right corner
so you can click and scroll down whilst reading
3) you click
4) a GMail notification has popped under (and STOLEN
FOCUS)
5) Firefox pops up with the GMail I just accidentally
clicked on
6) concentration is broken, world peace is never achieved.

manish wrote on the 1 Mar 08 at 13:00
My Experience: I was chatting with my friend in GMail inbuilt chat feature as I had not logged in the gmail account thought Pidgin.
I was running pidgin and logged in to Yahoo. While typing in gmail chat , suddenly a pidgin chat window opens up and i typed in it and hit enter. I type quite fast and before I could get that I had typed in pidgin and hit enter, its all done. Now I had to tell him what had happened.

Quite damn irritating.

fpgforce wrote on the 1 Mar 08 at 13:20
I agree with that, it's especially true in kopete, this app is driving me crazy

ketilwaa wrote on the 1 Mar 08 at 15:33
I think windows shouldn't steal focus, but still be able to noitfy you in some obvious yet non-obtrusive way. Like with Pidgin, I'd like to have the window pop up on a new message, but not gaining full focus, so I can see it, but still the window I'm writing in is still active. This might be tricky due to window sizes, but there is probably a good way to implement this.

fyo wrote on the 1 Mar 08 at 21:31
It's somewhat amusing that a good portion of the GNOME-specific "ideas" are already implemented in KDE.

Yes, focus-stealing is configurable in KDE.

ethana2 wrote on the 2 Mar 08 at 06:59
When I'm installing updates while chatting in pidgin, that window needs to leave me alone _by default_. Flash in the window list, I'll get to it when I get to it.

cheiron wrote on the 10 Mar 08 at 07:28
As ethana2 said, the Update Manager is particularly guilty of this, and seems to steal focus three or four times during a single round of updating (!).

Eldmannen wrote on the 19 Mar 08 at 02:40
Update Manager loves to steal focus.

Endolith wrote on the 27 May 08 at 15:38
Please please please fix this. Windows should NEVER steal focus. Just pop up the window in the background and make it blink in the taskbar.

uaneme wrote on the 24 Jul 08 at 02:40
+1000

Glad it never happened to me YET but imagine:

you are typing your login and password and something like Pidgin grabs focus.. A co-worker with a sence of humor could just look over your shoulder and wait for that moment to msg you and steal your password. ;-) yes funny, but not funny with serious data.

Or ... Creditcard numbers..

Or when your boss msg you just when you tell a friend that you hate the man.





Abra_Kadabra wrote on the 27 Aug 08 at 17:44
+100000000

Good Idea!

braaivleis wrote on the 8 Dec 08 at 19:41
+1

Its so annoying I tend to think of it as a bug.



braaivleis wrote on the 18 Dec 08 at 10:53
I accidentally sent someone my su password because my chat application stole my focus, while I was doing something in the terminal.



datakid wrote on the 14 Jan 09 at 07:22
can't believe I can only +1. Would love to +(amount needed to make sure that the full weight of canonical fixed it next as top priority). No other bug bugs me more.

Pander wrote on the 29 Jan 09 at 12:57
Sometimes a splash screen steals the focus and won't let go. This can be reproduced by starting Scribus and trying to alt-tab to another application.

Faz wrote on the 15 Feb 09 at 19:16
+1

I effectively can no longer multi-task whilst Update Manager is running. Very annoying! :(

Although due to number of updates the above effects me the most, the security aspect already mentioned should be enough reason to address this, as default behaviour too.

It should be classed as a security vulnerability IMHO.

alhernau wrote on the 1 Apr 09 at 10:00
Be careful with this one. At work this drives us crazy (stuck with RH4EL). We had to set focus stealing prevention to "none" since some applications used to open their menus and modal pop-ups below focused window !

runesvend wrote on the 15 Apr 09 at 11:53
My idea #18912 has been set to be a duplicate of this idea, can I change this?

I would like to remove the duplicate status of my idea #18912 as I don't think my idea is a duplicate of this one.

I think already running applications stealing focus and a newly launched application stealing focus are two distinct scenarios that should be handled separately.

Endolith wrote on the 15 Apr 09 at 14:41
I think those two cases are related enough to be combined into one idea.

runesvend wrote on the 17 Apr 09 at 07:33
Fair enough.

But I should point out that implementing solution #1 (to this idea) will not solve the problem I present in idea #18912. And, conversely, implementing the solution to idea #18912 (present here as solution #3) will not solve the problem presented here in idea #400.

I just think it's a bit confusing moving the solution to idea #18912 to idea #400 since it does not solve the problem presented in idea #400.
For that to work I think the rationale from idea #18912 should be merged with this idea as well (just as the solution to #18912 has been moved to here).

Endolith wrote on the 17 Apr 09 at 19:55
But I should point out that implementing solution #1 (to this idea) will not solve the problem I present in idea #18912. And, conversely, implementing the solution to idea #18912 (present here as solution #3) will not solve the problem presented here in idea #400.

That's why solutions #1 and #3 are separate from each other. You can vote +1 for both.


Endolith wrote on the 17 Apr 09 at 19:56
Yes, the rationales should be merged.

jordanwb wrote on the 19 Aug 09 at 01:23
+1 for solution #1.

Focus stealing should never happen on any platform. I find the Update manager to be a major culprit.

germulvey wrote on the 5 Sep 09 at 13:07
This is very annoying, enough to consider moving distro. As many have also said it is a security risk also. Many times I have sent my su password to a chat buddy!

enos76 wrote on the 6 Sep 09 at 10:02
This workaround prevents selected menu items and panel buttons from stealing focus under Gnome-Metacity.

1) Prevent applications launched from the terminal from stealing focus: launch gconf-editor, navigate to apps --> metacity --> general and set "focus new windows" to strict.

2) Pretend that menu items and panel buttons are launched from terminals, by modifying their "command" field. Some applications will not return the prompt immediately, therefore a further step is needed in the form of a script.

ORIGINAL COMMAND: firefox

INTERMEDIATE: gnome-terminal -e firefox

FINAL: gnome-terminal -e "/bin/bglaunch.sh firefox"

Where /bin/bglaunch.sh is the following script, which launches the application in background:

#!/bin/bash
nohup $1 >/dev/null &

Security is not guaranteed, plus it requires a little work for every program whose behaviour must be changed (it's easy to write a sed script which changes every link at once, though), but I find it very handy for those few slow apps that take ages to start.

euxneks wrote on the 18 Sep 09 at 03:02
PLEASE FOR THE LOVE OF ALL THAT IS HOLY IMPLEMENT THIS. I have no end of pain for the number of applications that are constantly popping up to get my attention. NOTHING is more important to me than the thing I'm *currently* doing. The computer is there to serve me, not the other way around.

amaranth (Ubuntu developer) wrote on the 31 Oct 09 at 21:43
We do obviously have focus stealing prevention (for a couple years now) so at this point your best bet is to file specific bugs for applications that steal focus. We would need detailed information on what application stole focus, what you were doing when it happened, etc.

It is possible we have bugs in the focus stealing prevention already implemented but it's also rather easy for applications to completely bypass this so it could be the application deciding it needs focus no matter what.

onlynone wrote on the 19 Nov 09 at 18:05
"It is possible we have bugs in the focus stealing prevention already implemented but it's also rather easy for applications to completely bypass this so it could be the application deciding it needs focus no matter what. "

Maybe I don't understand, but I assume there's some function that applications can call when they think they need the focus to be on them. Why can't metacity just flash their taskbar icon instead of actually giving them focus? I thought the whole point of a window manager was that it could manage windows.

keithlabs wrote on the 29 Dec 09 at 15:49
the number one reason I started using Linux was because I assumed this would be doable since I don't recall this happening in the past on Unix. Next I shall try KDE. After that I will try Solaris.

The application that gets me the most is Matlab since I may be running something for several seconds to minutes in the background. Then it leaps up while I'm in the middle of typing somewhere else. Then after I tab back it jumps up again to complain about the garbage I accidentally entered.

Ralph Corderoy wrote on the 8 Jan 10 at 13:50
freeguide is a huge culprit. It is slow to start, e.g. over one minute. So after a few seconds, by which time I'm back typing in a gnome-terminal, it pops up its "banner" window, taking focus. I minimise that and continue in gnome-terminal. A minute later, its finished loading and steals focus again as it pops up its main window.

Igor255 wrote on the 12 Jan 10 at 17:41
"We do obviously have focus stealing prevention (for a couple years now) so at this point your best bet is to file specific bugs for applications that steal focus. We would need detailed information on what application stole focus, what you were doing when it happened, etc.

It is possible we have bugs in the focus stealing prevention already implemented but it's also rather easy for applications to completely bypass this so it could be the application deciding it needs focus no matter what."

All aplications stilling focus :( If there is some stilling focus prvention it isn't work at all :(

This situation is wery annoying ... I hope You solve this soon ...

IcyJ wrote on the 25 May 10 at 16:27
This needs to be addressed! I was typing in a password in another application when I was waiting for gwibber to open. Guess what happened? As I was typing my password in another application gwibber opens and steals the focus so now I am typing my password in gwibber. By the time I pressed enter, it was too late. My password was posted to facebook for all to see, resulting in time lost changing passwords and quickly deleting a facebook post.

pererik87 wrote on the 3 Jun 10 at 16:47
Then thumbs up for #8. Its so darn annoying. especially when on a bad internet connection and your typing fast without paying attention to the screen. The fucking internet password pops up and before you know it you have typed. "have a nice day, i love" as a password for the wireless internet and hit the enter key. Then your fucked and have to go to the next room to get the password again. Or maybee you don't have the password anymore(that sucks)

mikko.rantalainen wrote on the 30 Jun 10 at 08:13
Focus stealing should be *absolutely forbidden* if user has clicked or typed inside any window (but the parent window as seen by the X server, to allow a window to open dialogs etc) within 2 seconds (user adjustable limit).

A window asking for a focus should only get "attention needed" status and *possibly* be raised second to top position in window order to make it easier to switch to it.

Auzy wrote on the 30 Jun 10 at 18:19
I disagree.. Windows 7 does that with UAC dialogs, and you get stuck wondering why your installation hasn't started..

Stealing focus DOES have its uses...

lddubeau wrote on the 6 Jul 10 at 19:59
Re. Auzy's comment...

Hmm... lemme see.

On one hand we have the *mere inconvenience* of not knowing whether an installation has started or not (à la Windows 7 UAC dialogs).

On other hand we have the security issue of accidentally sending a password out through chat (mentioned several times in the comments) or data loss (see below).

And we ought to have a discussion about which is more critical than the other? Really?

I'm commenting here because I started shutting down Open Office, went back to the terminal and while I was working in the terminal got a dialog asking me whether I wanted to save a document or not. I can't tell whether I won the "focus lottery" because I accidentally dismissed the dialog while navigating in 'less' in the terminal.

Auzy wrote on the 20 Jul 10 at 06:10
It is a tough one. One option is to change the sudo authentication window to be the same as windows (a click, rather than typing a password). This is actually more secure if you lock it down because hackers can't emulate a fake sudo prompt and steal the password. Or the option at least...

For terminal though, continue doing it the way its done now possibly

datakid wrote on the 2 Aug 10 at 10:04
I agree with all comments point toward security issues on this one. I also have experienced the "accidentally closing something important without saving due to focus stealing".

I +1 the idea that we can +(as many as needed to get it fixed, now) on this ticket.

The compiz solution doesn't work when you are using netbook remix for instance.

KIAaze (Idea reviewer) wrote on the 4 May 11 at 07:53
I am currently upgrading from 10.10 to 11.04 and was typing something.
A window shortly popped up exactly when I pressed enter to create a new line and disappeared right away.
I suppose it was asking me about some configuration file and what I wanted to do about it, but now I can't know anymore. :/
I hope everything goes well...

Focus stealing should be forbidden! And if there is focus-stealing, there should at least be some timeout or something to prevent actually using the focus-stealer for a few seconds.
(like with the win UAC where the screen slowly goes dark to only leave one window. Although I have no idea if you can use it while it goes dark.)

cheesehead (Brainstorm admin) wrote on the 19 Feb 12 at 02:50
Between the Compiz settings, notifyOSD, and Unity, the system seems to do a lot less stealing so I'm marking this Implemented. (We all knew it was a multiple-solution problem)

If you discover a system process or application that still steals focus, please file a bug report.


Post your comment