[dev] [dwm] Set input focus to barwin on empty monitors

From: A Farzat <a_AT_farzat.xyz>
Date: Fri, 20 Jan 2023 18:45:59 +0900

Stein wrote in the commit message of commit c2b748e:
> The edge case scenario that dmenu does not handle on its own, and the
> effect of removing this mechanism, is that if the user trigger
> focusmon via keybindings to change focus to another monitor that has
> no clients, then dmenu will open on the monitor containing the window
> with input focus (or the monitor with the mouse cursor if no windows
> have input focus).
> If this edge case is important to cover then this can be addressed by
> setting input focus to selmon->barwin in the focus function if there
> is no client to give focus to (rather than giving focus back to the
> root window).

Even though the commit has been reverted, I am still interested in
implementing this, as it enables other programs to know which monitor is
currently focused (I had asked about this like a week ago, and this
seems like a good solution).

I'm not sure though how to implement it. My guess is that the command
`XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);`[line 808]
in the focus function becomes
`XSetInputFocus(dpy, selmon->barwin, RevertToPointerRoot, CurrentTime);`
I'm not sure about the next line though: does the command
`XDeleteProperty(dpy, root, netatom[NetActiveWindow]);` stay as it is?
Or do I need to change it somehow?

Maybe this can even be posted as a patch on the wiki? Sounds like
something other might find helpful as well.

Thanks for the help.


Received on Fri Jan 20 2023 - 10:45:59 CET

This archive was generated by hypermail 2.3.0 : Fri Jan 20 2023 - 10:48:07 CET