I am using Xfce with Kde Plamsa5 as Window Manager. I cant open Xfce Window Settings anymore but KDE System Settings. I cant find an option to automatically focus to newly created windows.

When I open up a new window the focus stays on the window it was on before, but I want the new window to be raised and focused automatically.

  • It could be "fixed" with a small addition, but more useful would be to find out why this happens Did you use this combination before? May 23, 2015 at 7:53
  • I used KDE before, then I installed Xfce and used that. Then I replaced the windows manager. In Xfce Windows Setting there are two options to focus and raise new windows - i also switched back to xf-window-manager and checked that settings and they are set, but of course they dont affect kwin_x11. May 23, 2015 at 8:05
  • i think i found - its "focus stealing prevention" in kwin window settings. if its set to "medium" newly opened windows get the focus. May 23, 2015 at 8:36
  • AHA, great, I'll remove my answer then. Maybe you should post it as an answer? May 23, 2015 at 8:37
  • thanks! yes, but first i'm testing it a little bit, there's so much stuff that changes over a sessions life and is different after a reboot.. could you then post your script as comment or so, it was very interessting. May 23, 2015 at 8:39

2 Answers 2


It's "focus stealing prevention" in the Kwin Window Settings. If it's set to "medium", newly opened windows get the focus automatically.

  • Do you still want my answer around? If not I'll delete it, this is the clean solution I was referring to :) May 23, 2015 at 10:17
  • maybe you could append it as comment, i think for some users it could still be interesting. thx May 23, 2015 at 10:41
  • I had to set focus stealing prevention to "None" for new windows to show up in the front.
    – donquixote
    Feb 27 at 11:47

The clean solution

I do not use plasma, so I cannot look into what causes the issue. No need to explain that eliminating the cause would be the "cleanest" solution.

If that seems impossible, and you do want to use this combination, you can however use the bandage below to make it work. The solution is an extremely "light" background script, keeping an eye on newly created windows, raising them if they appear.

How to use

  1. The script uses wmctrl

    sudo apt-get install wmctrl
  2. Copy the script below into an empty file, save it as raise_window.py

  3. Test-run it from a terminal by the command:

    python3 /path/to/raise_window.py

    Open some applications and see if their windows are automatically raised.

  4. If all works fine, add it to your startup applications: Dash > Startup Applications > Add the command.

The script

#!/usr/bin/env python3
import subprocess
import time
import os

get = lambda cmd: subprocess.check_output(cmd).decode("utf-8").strip()
curr_1 = get(["wmctrl", "-l"]).splitlines()

while True:
        curr_2 = get(["wmctrl", "-l"]).splitlines()
        new = [w for w in curr_2 if not w in curr_1]
        for w in new:
            w = w.split()[0]
            command = "wmctrl -ia "+w
            subprocess.Popen(["/bin/bash", "-c", command])
    curr_1 = curr_2

You must log in to answer this question.

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