Hey again! Thanks, that may make sense, considering the WindowServer process, which I’ve found usually has to do with open windows and connected devices or monitors. So do you keep any external devices connected?
Likewise, knowing if you have an Intel/M1/M2 MAC may help, as if Intel, you can reset the firmware, (SMC/NVRAM/PRAM), pretty easily.
Otherwise, My first guess for troubleshooting, considering the symptoms would be to reset the WindowServer property list(s).
If you do keep external devices connected, I’d disconnect them. Quit all open applications. Then delete these files if there:
Delete:
com.apple.WindowServer.plist from these locations, restart and test:
You should see these files in the user library:
Open Finder.
While holding the Option key, on the top menu click Go > Library.
Next open these directories ti find and delete the files:
Preferences
Preferences > ByHost
There you can delete the com.apple.WindowServer.plists.
May as well check the volume Library:
Finder > Go > Computer > Macintosh HD (Or the name of your internal drive) > Library for this file if there, delete, restart and test.
I the issue persists then there is some other reason this is happening, and other tests maybe needed. Many users here use and understand EtreCheck which is an awesome program to help figure out an issue before having to go in depth troubleshooting and isolation. And helps if an issue is intermittent or unpredictable.
Otherwise, some good tests, which help to isolate the source problem are testing in a new user and Safe Mode:
Start up your Mac in safe mode - Apple Support
Add a user or group on Mac - Apple Support
That may also help to isolate a possible cause, whether a system issue, connected device issue, or related to a connected device, account setting or account program launching at login:
https://support.apple.com/guide/mac-help/remove-login-items-resolve-startup-problems-mh21210/mac
Which can be deleted, or disabled.
Hope something here helps!