Hi David,
On Tue, Aug 08, 2006 at 02:55:38PM +0100, David Tweed wrote:
> dwm is small enough that I will probably have a go at
> implementing this (very scarce spare time permitting
> :-) ). What I'm just hoping to initiate in this e-mail
> is a enough discussion to know if (a) such a feature
> would be accepted into the main distribution and (b)
> what architecture would be viewed as suitable.
>
> As far as I can see, there are two core requirements:
>
> (1) A way to ask dwm to output the names of the titles
> of all the windows with the currently active tag.
I'm not sure if the currently active tag would be sufficient,
I'd prefer access to the global list. This can be queried
without asking dwm, simply querying the window tree of X
directly similiar to scan() of dwm:
static void
scan()
{
unsigned int i, num;
Window *wins, d1, d2;
XWindowAttributes wa;
if(XQueryTree(dpy, root, &d1, &d2, &wins, &num)) {
for(i = 0; i < num; i++) {
if(!XGetWindowAttributes(dpy, wins[i], &wa))
continue;
if(wa.override_redirect)
continue;
/* TODO: ask for window's title */
}
}
if(wins)
XFree(wins);
}
> (2) A way to ask dwm to focus a window whose title is
> the same as a given one.
This is the only part, where dwm might provide a way to assist.
EWMH defines the _NET_ACTIVE_WINDOW root window property, which
can be set by clients to ask the window manager to focus a
different window. The changes to achieve this look marginal to
me (you need to set this hint when initializing the
netwm[NetSupported] atom, beside setting the correct
window id whenever focus() is performed (or unmanage())
to this property.
To enable dwm handling such activation requests you need to
extend propertynotify() which might call view() and focus().
Then only a utility is necessary which can be used as follows:
wtool focus "`wtool list | wmiimenu`"
Whereas wtool focus sets _NET_ACTIVE_WINDOW to the id of the
window title supplied (if that can be queried), and wtool list
outputs newline-separated list of all window titles currently
run by the X server.
> >From my philosophy, providing it fails gracefully,
> there's no need to get corner cases "perfect". Off the
> top of my head, these corner cases include the race
> between getting the list of names and submitting the
> focus request where a client exits, or changes its
> title between times, or gets retagged. Likewise if
> there's multiple clients with the same title.
In such a case, first match will win. I won't bother for further
cases, because it is indecidable anyways (and XQueryTree will
find the bottom-most window first)...
Regards,
-- Anselm R. Garbe ><>< www.ebrag.de ><>< GPG key: 0D73F361Received on Tue Aug 08 2006 - 16:52:10 UTC
This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 14:30:01 UTC