KDE Plasma desktop focus issues

I am running Tumbleweed with KDE Plasma desktop. Lately (I am not sure since when) I have been having this issue with Windows focus. After a fresh start or waking up from sleep, the window that I click on gets the focus but does not move to the front. So the focused window stays at the back of whichever window that I was working on before this. But my clicks and typing goes into the focused window. I don’t have the “always on top” option on this un-focused window.

I can make it normal again by going into “Window management” in Settings and just change something in any of the rules that I have there and clicking apply. After that it works fine until the next restart or waking up from sleep.

Here is my neofetch output:

OS: openSUSE Tumbleweed x86_64 
Host: 82B5 Lenovo Legion 5 15ARH05 
Kernel: 6.2.9-1-default 
Uptime: 1 day, 18 hours, 4 mins 
Packages: 4743 (rpm), 19 (flatpak) 
Shell: bash 5.2.15 
Resolution: 1920x1080 
WM: KWin 
Theme: Breeze [GTK2/3] 
Icons: breeze [GTK2/3] 
Terminal: yakuake 
CPU: AMD Ryzen 7 4800H with Radeon Graphics (16) @ 2.900GHz 
GPU: AMD ATI 05:00.0 Renoir 
GPU: NVIDIA 01:00.0 NVIDIA Corporation TU117M 
Memory: 9383MiB / 15338MiB

Please also share the output from

inxi -SGa

Here is the output of inxi -SGa :

System:
  Host: venks-lappy Kernel: 6.2.9-1-default arch: x86_64 bits: 64
    compiler: gcc v: 13.0.1 parameters: BOOT_IMAGE=/boot/vmlinuz-6.2.9-1-default
    root=UUID=0931b4df-991a-4bcf-9018-1a59df66ae58 splash=silent
    resume=/dev/disk/by-label/SWAP quiet mitigations=auto nosimplefb=1
  Console: pty pts/0 wm: kwin_wayland DM: SDDM Distro: openSUSE Tumbleweed
    20230410
Graphics:
  Device-1: NVIDIA TU117M vendor: Lenovo driver: nvidia v: 525.105.17
    alternate: nouveau,nvidia_drm non-free: 520.xx+
    status: current (as of 2022-10) arch: Turing code: TUxxx
    process: TSMC 12nm built: 2018-22 pcie: gen: 1 speed: 2.5 GT/s lanes: 8
    link-max: gen: 3 speed: 8 GT/s lanes: 16 ports: active: none
    empty: DP-1,HDMI-A-1,eDP-2 bus-ID: 01:00.0 chip-ID: 10de:1f99
    class-ID: 0300
  Device-2: AMD Renoir vendor: Lenovo driver: amdgpu v: kernel arch: GCN-5.1
    code: Vega-2 process: TSMC n7 (7nm) built: 2018-21 pcie: gen: 4
    speed: 16 GT/s lanes: 16 ports: active: eDP-1 empty: none bus-ID: 05:00.0
    chip-ID: 1002:1636 class-ID: 0300 temp: 35.0 C
  Device-3: IMC Networks Integrated Camera type: USB driver: uvcvideo
    bus-ID: 2-3:2 chip-ID: 13d3:56ff class-ID: 0e02
  Display: server: X.org v: 1.21.1.8 with: Xwayland v: 23.1.1
    compositor: kwin_wayland driver: X: loaded: modesetting,nvidia
    alternate: intel dri: radeonsi gpu: amdgpu display-ID: :1 screens: 1
  Screen-1: 0 s-res: 1920x1080 s-dpi: 96 s-size: 508x286mm (20.00x11.26")
    s-diag: 583mm (22.95")
  Monitor-1: eDP-1 model: AU Optronics 0xd1ed built: 2019 res: 1920x1080
    hz: 120 dpi: 143 gamma: 1.2 size: 340x190mm (13.39x7.48")
    diag: 394mm (15.5") ratio: 16:9 modes: max: 1920x1080 min: 640x480
  API: OpenGL v: 4.6 Mesa 23.0.1 renderer: AMD Radeon Graphics (renoir LLVM
    16.0.0 DRM 3.49 6.2.9-1-default) direct render: Yes

Ok, so you are using KDE Plasma (Wayland). Can you test focus behaviour in a X11 session instead?

This thread may be of interest
https://www.reddit.com/r/kde/comments/ua4y0f/window_focus_issues/

Let’s see what others have to say as well.

Are you only using the mouse?

What if you use the keyboard to cycle thru the windows ? (Alt-Tab)

Yes, I was using the mouse. When I tried using the keyboard to cycle through, the window that is in front stays there while my task switcher work in the background. Meaning the animation and the task thumbnails are covered by the window that is in front.

As you are using a Wayland session, does this behaviour occur regardless of Wayland app windows, and/or apps running via Xwayland?

Something to try: Create a new user and see if the same behaviour exists when logged in as that user.

I am running KDE on X11 since yesterday. No issue at all.

Ok, good to know, but did you also try a creating a new user and checking focus behaviour in a KDE Wayland session?

I have not tried creating new user yet. Since I can use it with X11, I want to finish my work first before trying that out.

I just encountered the issue but on another activity. I have two activities one is the default one and another is called teaching. When running on Wayland, I had this problem cropping up on both the activities. Now (on X11) it happened on the second activity. I have since removed the second activity and the problem seems to have gone. But more testing needs to be done.

I will be testing this with a new user over the weekend and report back.

i have created a new user and logged in using Wayland. I cannot reproduce the problem.

When I log in back to my main account using Wayland, the problem comes back.

Compare differences with ~/.config/kwinrc between the two user accounts.

Here is the diff output:

venantius@venks-lappy:~> sudo diff ../sundari/.config/kwinrc .config/kwinrc 
5a6,8
> GLCore=true
> GLTextureFilter=1
> LatencyPolicy=Medium
9,10c12,18
< Id_1=c9d66398-61c4-4523-b13f-3ba19ffaaf89
< Id_2=7a07bd7e-d45b-40e8-bbf4-b062e8f69b83
---
> Id_1=6d4b38ad-28ff-4f32-82bc-38b20bcb2c09
> Id_2=459eb6a1-81be-46f5-b54e-5d0d03a83a1b
> Id_3=c5b853a8-5cf7-4218-8f61-98e3c5a5c6b1
> Id_4=c27877b7-bc6e-4241-a8dc-2d57152bb40c
> Id_5=edc630e3-2273-4996-b1d6-05e81717c756
> Id_6=d7128d36-5c65-477f-9196-508b34cfe200
> Number=6
12a21,93
> [DrmOutputs][11ee8dabec][11ee8dabec]
> Mode=1920x1080_120213
> Scale=1
> Transform=normal
> 
> [DrmOutputs][b537311761][b537311761]
> Scale=1
> TabBox=true
> 
> [Effect-CoverSwitch]
> TabBox=true
> 
> [Effect-DesktopGrid]
> BorderActivate=7
> 
> [Effect-MouseClick]
> Color1=128,0,0
> ShowText=false
> 
> [Effect-PresentWindows]
> BorderActivateAll=9
> 
> [Effect-mouseclick]
> Color1=128,0,0
> ShowText=false
> 
> [Effect-overview]
> BorderActivate=7
> 
> [Effect-presentwindows]
> BorderActivateAll=9
> 
> [Effect-windowview]
> BorderActivateAll=9
> 
> [MouseBindings]
> CommandTitlebarWheel=Change Opacity
> 
> [NightColor]
> Active=true
> LatitudeAuto=3.1071
> LongitudeAuto=101.5526
> 
> [Plugins]
> coverswitchEnabled=true
> flipswitchEnabled=true
> glideEnabled=true
> highlightwindowEnabled=true
> kwin4_effect_scaleEnabled=false
> kwin4_effect_squashEnabled=false
> magiclampEnabled=true
> minimizeallEnabled=false
> mouseclickEnabled=true
> slidebackEnabled=true
> steadyScreenEnabled=false
> synchronizeskipswitcherEnabled=false
> trackmouseEnabled=true
> videowallEnabled=false
> 
> [SubSession: 3e9bfe2a-21a9-49a6-9ded-5b793721e38d]
> active=-1
> count=0
> 
> [SubSession: 6e94b266-d291-4203-8897-e1d9681904a7]
> active=-1
> count=0
> 
> [TabBox]
> ActivitiesMode=0
> BorderActivate=9
> DesktopMode=0
> LayoutName=coverswitch
> 
15a97,108
> [Tiling][03a44688-708d-5329-9de5-804536551438]
> tiles={"layoutDirection":"horizontal","tiles":[{"width":0.25},{"width":0.5},{"width":0.25}]}
> 
> [Tiling][03d2c3ff-d00d-5b8b-860e-b16aaf375743]
> tiles={"layoutDirection":"horizontal","tiles":[{"width":0.25},{"width":0.5},{"width":0.25}]}
> 
> [Tiling][23d84027-6b81-5a63-91b8-8e7e614d6fad]
> tiles={"layoutDirection":"horizontal","tiles":[{"width":0.25},{"width":0.5},{"width":0.25}]}
> 
> [Tiling][36dc0b2c-0cfd-517a-8ed1-c2bbadfec328]
> tiles={"layoutDirection":"horizontal","tiles":[{"width":0.25},{"width":0.5},{"width":0.25}]}
> 
18a112,135
> [Tiling][45eb0355-476d-55e6-8211-39ea12e22b2e]
> tiles={"layoutDirection":"horizontal","tiles":[{"width":0.25},{"width":0.5},{"width":0.25}]}
> 
> [Tiling][4656e9c7-29d2-5198-aef7-e64495a298e9]
> tiles={"layoutDirection":"horizontal","tiles":[{"width":0.25},{"width":0.5},{"width":0.25}]}
> 
> [Tiling][5b7a5ba4-43cc-5910-8e98-f358f9d54b43]
> tiles={"layoutDirection":"horizontal","tiles":[{"width":0.25},{"width":0.5},{"width":0.25}]}
> 
> [Tiling][892d9657-38cb-5a7f-8ed5-7d2399cbb33e]
> tiles={"layoutDirection":"horizontal","tiles":[{"width":0.25},{"width":0.5},{"width":0.25}]}
> 
> [Tiling][92e842d7-5928-5c43-884a-4912e7cc82ed]
> tiles={"layoutDirection":"horizontal","tiles":[{"width":0.25},{"width":0.5},{"width":0.25}]}
> 
> [Tiling][a3d991e5-e4d6-5b87-b0c7-d6949c612be9]
> tiles={"layoutDirection":"horizontal","tiles":[{"width":0.25},{"width":0.5},{"width":0.25}]}
> 
> [Tiling][aee2ae5e-db3e-5186-a984-6b2b3a0b308f]
> tiles={"layoutDirection":"horizontal","tiles":[{"width":0.25},{"width":0.5},{"width":0.25}]}
> 
> [Tiling][b777518d-0557-5c00-946e-cae29cfda99f]
> tiles={"layoutDirection":"horizontal","tiles":[{"width":0.25},{"width":0.5},{"width":0.25}]}
> 
22,23c139,147
< [Xwayland]
< Scale=1
---
> [Tiling][fc898f24-6af6-5586-8723-0a14e7152a78]
> tiles={"layoutDirection":"horizontal","tiles":[{"width":0.25},{"width":0.5},{"width":0.25}]}
> 
> [Windows]
> RollOverDesktops=true
> 
> [org.kde.kdecoration2]
> ButtonsOnLeft=MF
> ButtonsOnRight=IAX

The file on the right is new user. I must admit there are quite a few changes I made to the default setup over the years.

Nothing obvious sticks out here…most of the additional entries are with the second (right hand) file. You could try renaming the original file, and copying the new one across then log out and log back in again, to test behaviour (or reconfigure the desired Window behaviour by hand again perhaps).

I renamed the kwinrc file and logged in so that KDE will create a default file. I have setup my rules. So far everything is fine in Wayland. I have been working on it for a day now. However I must also mentioned that I updated the system quite frequently.

Thanks for your help.

That is good to know. Just make sure you note whether any user config changes cause unexpected behaviour again.

1 Like