Why does PrintScreen put the wrong window on top?
You're not even telling which DE/WM you're using.
Sorry. I'm using plasma 5.25.4-1 on linux 5.18.16.artix1-1. The program bound to PrtSc is spectacle 22.04.3-1.
Can you run
spectacle
from a terminal window and tell us what the output says?
$ spectacle
(spectacle:1076): Gtk-WARNING **: 00:22:57.935: Unable to locate theme engine in module_path: "adwaita",
(spectacle:1076): Gtk-WARNING **: 00:22:57.935: Unable to locate theme engine in module_path: "adwaita",
Are you using multiple monitors per chance? It could be KDE isn't setting the correct monitor as "primary".
No, I'm on a laptop with a single monitor.
Another data point: sometimes spectacle puts a window that was closed several minute ago on top.
It's clearly either a misconfiguration or a bug in spectacle; test with "import -frame /tmp/window.png", click on the window you want and see the capture in /tmp.
import -frame /tmp/window.png
works. Then again spectacle works when selecting a window. It's when its in "Full Screen" mode that it takes the state of the screen minutes (or even hours) ago.
Well, for full-screen capture assign "import -window root /tmp/screenshot-$(date +%F-%R:%S).png" to PrtScr and profit. Use the previous 'import' command with, say, Shift-PrtScr for single-window captures.
import -window root /tmp/screenshot-$(date +%F-%R:%S).png
Still gets me an old state of the screen.
Do you happen to have xf86-video-intel installed? I used to have a similar problem when recording my screen that was fixed by uninstalling it.
Yes, I have xf86-video-intel installed. Will uninstalling a video driver break things?
If you have the fallback (xf86-video-modesetting), no. And even if it breaks things, you can use the TTY and reinstall it using pacman.
How old? Can you possibly see the ancient Egyptians building the pyramids in your screenshots?
Before you start a de/installation orgy, I recommend you read the Wiki.
https://wiki.archlinux.org/title/Screen_capture