How do I refocus a window when moving one to another desktop?

When I move a focused window to another virtual desktop, the window that I just moved is still focused, even if it is on another desktop. The light blue desktop in the Pager widget is the current desktop, but the glowing rectangle beside it is the window that is still focused.

image

Instead of this, I want to refocus to a window in the currently selected virtual desktop after moving a focused window to another one. How can I make this happen? Thank you.

if i drag a window to another desktop, it already has focus because i’m dragging it and it retains focus on the new desktop until i drop it and click to focus on something else.

also when i drag a window to a new desktop, then that becomes the current desktop… if i want to get back to the desktop where the window came from i need to switch back to that desktop.

is this not the behavior you are experiencing?

if not, maybe you can restate your question?

I don’t mean dragging it. I mean this:


I’m on Desktop 1 right now. If I clicked on “Move to 2 Desktop 2,” the window will still be focused on. I can still use hotkeys on it, even though I’m not the same desktop as the window. What I want is to automatically refocus on a window on Desktop 1 after moving a window to Desktop 2.

ah, got it.

if you click on the desktop, type “focus” and open the settings window that appears in the search result, you can change your window focus behavior.

perhaps “follows mouse” would work better? play with that, and see if it helps.

Unfortunately, no. I don’t want to focus on mouse hover, especially all the time. I only want to refocus on a window after I send the currently focused one to another virtual desktop. That, or just have the one I sent become unfocused if no windows on the current virtual desktop are present.

https://docs.kde.org/stable5/en/kwin/kcontrol/windowbehaviour/index.html

when i change to focus follows mouse, the behavior is that when the active window is sent to another desktop, the last window to have focus takes the focus back.

otherwise it’s still click to focus the rest of the time.

i think this is what you want.