I’m trying to find out how dwm decides the initial position of the mouse cursor, after it started. I looked in dwm.c for a while, but my knowledge of C and X11 doesn’t cut it.
What I want to do is to place the cursor in my primary monitor. Now it is created on the other one, causing it to be initially selected. When I first start a terminal or something else (using the keyboard), it opens in the wrong monitor. It’s a minor annoyance, but also a pretext to learn something :)
I’m not sure if dwm should be responsible for that, or xorg is maybe? Is dwm aware of the primary output set with xrandr?
I tried to use XWarpPointer() in dwm.c, in main() just before run() is called. This way I managed to move the pointer to the center of the screen, but the wrong one :)
As suggested in the comments, it could be something wrong in my xrandr setup. Here it is:
xrandr —output DP-0 —rotate left xrandr —output DP-0 —left-of DP-4 xrandr —output DP-4 —pos 1080x160 xrandr —output DP-4 —primary
Edit: dwm initializes DP-0 first (where the status bar appears first). Though if I disconnect the mouse and reboot, dwm behaves correctly and the focus is on DP-4 (eventhough DP-0 is initialized first).
As a test I started i3wm instead of dwm. The pointer is initialized in the center of the screen (DP-4) as expected and all is fine.