I’m on Kubuntu 23.04 with Plasma 5.27.4 and use three screens. Most of the time, the sole occupant of the right screen is a Firefox window, the left screen is for Thunderbird and occasionally another Firefox window and the main/center screen is for everything else.
I use Alt+Tab probably hundreds of times a day to switch between windows. I’ve set KWin to sort windows in the order of most recently used.
Every now and then – and there doesn’t seem to be a clear-cut pattern for when this happens – when I’m Alt+Tabbing back and forth between, say, a Firefox window and VS Code on my main screen, instead of switching to the expected window, the Firefox window on the right screen gets the focus. If I Alt+Tab back, I get the previously focused window, and then if I Alt+Tab twice, I get the other window I originally intended to focus on. After that, I can continue to Alt+Tab back and forth between those two windows until the issue resurfaces, which happens anywhere from never to a dozen or so times a day.
It seems that for whatever reason KWin (or whatever is responsible for managing the Alt+Tab order of windows) occasionally slips this one Firefox window into the Alt+Tab stack as the most recently used window. Since there’s no apparent pattern to when or how often this happens, I have no idea what might be causing this. I’ve found two or three posts on Reddit, Stackoverflow, etc. that report similar issues, but nothing that reflects my issue 100 % and the proposed solutions didn’t work.
Has anyone here experienced this issue or an idea what might be causing it?
I have no help with your posted problem, but…
If you are frequently switching between two windows, I suggest setting a single-key shortcut for “Walk Through Windows Alternative”. It doesn’t do what it says, work as an alternative to Alt-Tab, it switches to the most recently used other window. I find it less awkward than pressing Alt-Tab for just one window.
I just tried this and it does seem to do the same thing as Alt+Tab, but maybe the issue with the wrong window being focused won’t happen there because the task switcher isn’t involved like with Alt+Tab.
Will see, thanks for the tip
I believe I have the same issue and recenlty I may have found the cause: it happens (at least more often) when I have my webmail (roundcube), mattermost or youtube open as the active tab in any browser window (Opera/Opera beta).
It seems that when the webmail, mattermost or youtube updates, the browser silently grabs focus (I can;t tell you how many times I wrote a command on a mattermost chat, to the bewilderment of my co-workers ).
I noticed it stopped happening when I had some issues with my browser and installed Mattermost’s desktop app.
I haven’t found a focus setting to prevent this silent focus grab, nor have I searched if there is an open bug report about it.
BTW, I’m too used to Alt+Tab’ing so I’m not sure I’ll be able to re-train my btain to use an alternate shortcut, but I’ll give @jlittle 's suggestion a try.
@richarson I can’t reproduce that for Youtube tabs and I don’t use Roundcube or Mattermost. I use Firefox instead of Opera, and which tab is the active one varies.
I think the main reason a Firefox window gets popped into the Alt+Tab stack is that they are consistently open (not minimized). I just wonder why it’s usually this particular window on my right screen. In one case it was the one on the middle screen, but it has never been the one on the left screen.
I’m going to swap the left- and right-screen Firefox windows to see if it’s anything particular about Firefox or the set of tabs in that window.
It probably happens with other sites as well, anything that auto-updates its interface (Facebook, Instagram, Whatsapp, Twitter?).
On Youtube it happnes for me when I receive a new notification.
Though I never experienced it with Grafana, which we use to monitor our infra at work, and other dashboards.
Maybe they’re different issues but since the end result is the same I think they might be related.
Any KDE developer out there that can point us a way to debug this?
And/oor how to open a proper bug report?