#9: Solving “Flash in background issue”

Posted by | Comments (13) | Trackbacks (3)

This article is very specific and doesn't really fit into this series of general Linux tips but it covers such an annoying issue, whose solution is documented nowhere on the Internet, that I decided to include it into this Advent series. So if you're not concerned with this issue, stay tuned for tomorrow's blog post. ;-)

Since Adobe has introduced Flash, there have always been major and minor problems with that on all platforms, especially on Linux. One problem I often had to deal with is a focus stealing bug with Kwin, KDE's window manager. I don't know how far this is KDE related, perhaps also some Compiz users could encounter this problem under Gnome. If you are concerned, please let me know and write a comment.

For this short article I will focus on Kwin since it's my window manager of choice and that one I use. So what happens when this bug occurs? Well, this does not happen each time and also not on each website (e.g., I couldn't reproduce it for YouTube yet). Primarily, this bug occasionally occurs in Firefox on websites like Vimeo. When you switch to full screen mode, suddenly Flash decides to go into background and continues, whatever it's doing right at the moment, behind the browser window. That results in something like that:

Adobe Flash in fullscreen: the video starts behind the browser

To see what's going on there, you have to minimize your browser window or to hit <ALT>+<TAB>. That's very annoying and because your taskbar is always visible then, you don't even have a real full screen. But what to do? I have not figured out yet what the actual cause of this focus bug is. It might be a conflict between the browser and the Flash window, which runs in a separate process and not as a thread of the browser itself; but it could also be an issue with the compositor or something like that. Whatsoever, a way to fix this issue is to set up a window rule for the Flash full screen window. For this purpose open your system settings panel and go to “Window Behavior” → “Window Rules” and click “New”. To detect what to type in, you can click onto “Detect Window Properties” and then onto the window whose properties you need. But you might notice that this is not possible here because the full screen window closes as soon as it recognizes a focus out event, so when you click that button, Flash terminates full screen mode. But there's a little trick. Flash closes only on focus out events, but since it doesn't have the focus initially, we can do things when paying attention to not passing the focus to the Flash window in any way. So resize your browser window that it only fills part of the screen and position the properties window next to it. Arrange both windows that way that you still have some empty space on your screen. Now activate full screen, bring the properties window to the front carefully, click on “Detect Window Properties“ and then on your Flash full screen window.

Having this done you now should've got some weird information about your Flash full screen window. For Firefox it looks like this:

Class: <unknown> (<unknown> <unknown>)
Type: Normal Window
Title: <unknown>

For Chromium it's

Class: Exe (exe Exe)
Type: Normal Window
Title: exe

and for Opera

Class: Operapluginwrapper-ia32-linux (operapluginwrapper-ia32-linux Operapluginwrapper-ia32-linux)
Type: Normal Window
Title: operapluginwrapper-ia32-linux

That's not very meaningful information but hopefully unique on your system. So tick “Match also window title” and click OK. Then enter some (hopefully more expedient) description (e.g. “Adobe Flash full screen fix”) and go to the Workarounds tab. There activate “Focus stealing prevention” and set the first drop down menu to “Force”. After clicking OK and Apply you're done. Henceforth Flash should always get the focus when switching to full screen mode.

Update March 20th 2011:

Many people had trouble getting the technique above to work. Entering the values manually works, but that's not very convenient and you have to know the values for all browsers etc. For instance, if you use nspluginwrapper, the values are again different. Here just the values for Firefox:

Class: Npviewer.bin (npviewer.bin Npviewer.bin)
Type: Normal Window
Title: npviewer.bin

One workaround for this is that you first set a window rule for the window properties detector window. Click “New” to create a new window rule, then “Detect Window Properties” and then the “Edit Window-Specific Settings” window itself. Under “Preferences” now check “Accept focus”, set the drop-down menu to “Force” and leave the checkbox behind it unchecked. Click “OK” and “Apply”. Now Flash shouldn't close its fullscreen anymore when you click the “Detect Window Properties” button.


robo47 sent a Trackback on : (permalink)

RT @reflinux: #Advent series “24 Short #Linux #Hints”, day 9: Solving “#Flash in background issue” http://bit.ly/g7MSHG

Manko10 sent a Trackback on : (permalink)

RT @reflinux: #Advent series “24 Short #Linux #Hints”, day 9: Solving “#Flash in background issue” http://bit.ly/g7MSHG

Refining Linux sent a Trackback on : (permalink)

Adobe Flash has ever been a great source of anger due to many bugs (see here for example) and security vulnerabilities. Anyhow, it has evolved into a widely used technology and many, many websites need it to function correctly (yeah, HTML5 is coming, let’


There have been 13 comments submitted yet. Add one as well!
Tom wrote on : (permalink)

This problem is annoying for me too.
I tried your solution but when I click on “Detect Window Properties”, the fullscreen flash background immediately disappears and the video returns to the firefox window.


Janek Bevendorff
Janek Bevendorff wrote on : (permalink)

Did you follow the instructions step by step? If the Flash window ever gets the focus, it won’t work.
Open the browser and resize it so that it fills only part of the screen, open the window settings window and place it next to it (not above). You can also place it on a second monitor if you have one.
Then activate Flash full screen (it goes to background), click the” Detect Window Properties” button (don’t click somewhere else) and then onto the Flash full screen.
If it still doesn’t work, you can also write the properties manually (I hope, they are the same on all systems). For Firefox enter

<unknown> <unknown>

as the window class, activate “Match whole window class”, on the “Window Extra” tab, set the type to “Normal Window” and the Window title to


and select “Exact Match”. Then activate “Focus stealing prevention” as described in the article and click OK, then Apply.

For Chromium it’s the same, but the Window class has to be

exe exe

and the title


Hope, that helps.

Tomasz wrote on : (permalink)

I’ve found other way:
In WindowRule settings add rule for all windows (window class and other leave empty) with Fullscreen option set to Force unmarked. Then apply all settings, try to fullscreen flash. It will have titlebar. Press right mouse button on this title bar, select advanced – special window settings. It will have all important text inputs filled.

Tom wrote on : (permalink)

Hi Janek,
Thank you for the detailed response.
Even with the settings window on the second monitor, I still had the same problem.
However, writing the properties manually worked!! Thanks!!

Have a great 2011,

Janek Bevendorff
Janek Bevendorff wrote on : (permalink)

I’ve updated the article. Now you (and all the others having the same problem) should be able to use the automatic method as well.

Gunni wrote on : (permalink)

One thing i sometimes think it could be better, and you seem to be knowledgeable enogh to maybe find a solution:

How about Fullscreen Flash on dual monitor setups. If you want to view a flash video on one screen, and want to work on the other fullscreen gets closed as you click on something.
Is this doable with a kde workaround.

Janek Bevendorff
Janek Bevendorff wrote on : (permalink)

Well, I’m also struggling with that a lot. I’ve already tried many KDE settings but without success. Also enabling separate focus for each screen doesn’t work. I guess it’s insolvable with windows workarounds.

By the way, if you have active corners on your screen and one of them enables the desktop grid, be careful! If you accidentally activate the desktop grid while Flash is in fullscreen mode, you must not click the desktop with the fullscreen. If you do, KDE would not recognize any mouse or keyboard events anymore, so you have to kill KDE or reboot your computer. Instead choose another desktop first and then switch back. Perhaps I should file a bug report for that.

Nan wrote on : (permalink)

I use gnome, there are also the same problem

Janek Bevendorff
Janek Bevendorff wrote on : (permalink)

Unfortunately, I’m not a Gnome user, so I can’t help you here. But i’m sure, you can have similar settings there.
Compiz, e.g., lets you set some window rules I guess (at least with the right plugins). I recommend you play around with it. I don’t know, if Adobe will ever fix this. Flash is an extremely crappy piece of software.

Nan wrote on : (permalink)

Thank you for your reply, I just installed gnome, using the default metacity. Not installed compiz.
But did not find the gnome and the window where the rules set
Find a lot of places, here is a forum to know the link.
My English is not good, these are translated using google translate, please forgive me.

Janek Bevendorff
Janek Bevendorff wrote on : (permalink)

You don’t need to submit your comment thrice. It just doesn’t show up directly because it needs to be moderated first. smile

I don’t know how to set window rules in Metacity, but you could try to implement focus stealing prevention with wmctrl.

Nan wrote on : (permalink)

GFW very stubborn, so access to the international port will be blocked. so sorry.

Thank you for your help!

Write a comment:

HTML-Tags will be converted to Entities.
Textile-formatting allowed
Standard emoticons like :-) and ;-) are converted to images.
Design and Code Copyright © 2010-2017 Janek Bevendorff Content on this site is published under the terms of the GNU Free Documentation License (GFDL). You may redistribute content only in compliance with these terms. tweetbackcheck