I am using KDE (with Kwin) on two screens. Often when I run a new application the new window shows on the second screen eventhough the mouse as well as the active window is on the main screen. How can I instruct KDE to always open new windows on the main screen?
Try System Settings - Display and Monitor - Multiple Monitors.
The setting Show Unmanaged Windows on allows you to select a display or use the display the mouse pointer is on.
I had this problem but only when I first started a session, anything I ran would always initially open on the second screen (which is a TV and usually turned off)
If you're having the same issue as me, I only got around it by creating a rule for the browser to save its position (Right click on title bar, advanced - special window settings - size & position, Check "Position", select "Remember")
Now when I log in if I open the browser first, it still opens on the second screen but the rule overrides whichever insane hidden setting is taking effect and forces it back to the first desktop, subsequent windows then open on the first desktop as well.
In the "windows behaviour" settings, you have to enable "Active screen follows mouse pointer". (approximate translation from French but I'm sure you'll find it).
This way, by default, windows will open on the current screen. (except some rare specific apps like VLC which use the last used screen).