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

From: A Farzat <a_AT_farzat.xyz>
Date: Mon, 30 Jan 2023 10:49:01 +0900

I sent this email two weeks ago over the weekend to no reply. I'm
sending it again now (just in case the timing was bad last time).

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.

Farzat

Received on Mon Jan 30 2023 - 02:49:01 CET

This archive was generated by hypermail 2.3.0 : Mon Jan 30 2023 - 03:00:08 CET